diff options
Diffstat (limited to 'include/linux')
152 files changed, 5707 insertions, 1821 deletions
diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 358c01b971db..5320153c311b 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h | |||
| @@ -29,17 +29,17 @@ | |||
| 29 | #include <linux/ioport.h> /* for struct resource */ | 29 | #include <linux/ioport.h> /* for struct resource */ |
| 30 | #include <linux/device.h> | 30 | #include <linux/device.h> |
| 31 | 31 | ||
| 32 | #ifdef CONFIG_ACPI | ||
| 33 | |||
| 34 | #ifndef _LINUX | 32 | #ifndef _LINUX |
| 35 | #define _LINUX | 33 | #define _LINUX |
| 36 | #endif | 34 | #endif |
| 35 | #include <acpi/acpi.h> | ||
| 36 | |||
| 37 | #ifdef CONFIG_ACPI | ||
| 37 | 38 | ||
| 38 | #include <linux/list.h> | 39 | #include <linux/list.h> |
| 39 | #include <linux/mod_devicetable.h> | 40 | #include <linux/mod_devicetable.h> |
| 40 | #include <linux/dynamic_debug.h> | 41 | #include <linux/dynamic_debug.h> |
| 41 | 42 | ||
| 42 | #include <acpi/acpi.h> | ||
| 43 | #include <acpi/acpi_bus.h> | 43 | #include <acpi/acpi_bus.h> |
| 44 | #include <acpi/acpi_drivers.h> | 44 | #include <acpi/acpi_drivers.h> |
| 45 | #include <acpi/acpi_numa.h> | 45 | #include <acpi/acpi_numa.h> |
diff --git a/include/linux/aer.h b/include/linux/aer.h index 4dbaa7081530..c826d1c28f9c 100644 --- a/include/linux/aer.h +++ b/include/linux/aer.h | |||
| @@ -11,6 +11,8 @@ | |||
| 11 | #define AER_FATAL 1 | 11 | #define AER_FATAL 1 |
| 12 | #define AER_CORRECTABLE 2 | 12 | #define AER_CORRECTABLE 2 |
| 13 | 13 | ||
| 14 | struct pci_dev; | ||
| 15 | |||
| 14 | struct aer_header_log_regs { | 16 | struct aer_header_log_regs { |
| 15 | unsigned int dw0; | 17 | unsigned int dw0; |
| 16 | unsigned int dw1; | 18 | unsigned int dw1; |
diff --git a/include/linux/ahci_platform.h b/include/linux/ahci_platform.h index 6dfd51a04d77..09a947e8bc87 100644 --- a/include/linux/ahci_platform.h +++ b/include/linux/ahci_platform.h | |||
| @@ -43,10 +43,7 @@ struct ahci_host_priv *ahci_platform_get_resources( | |||
| 43 | struct platform_device *pdev); | 43 | struct platform_device *pdev); |
| 44 | int ahci_platform_init_host(struct platform_device *pdev, | 44 | int ahci_platform_init_host(struct platform_device *pdev, |
| 45 | struct ahci_host_priv *hpriv, | 45 | struct ahci_host_priv *hpriv, |
| 46 | const struct ata_port_info *pi_template, | 46 | const struct ata_port_info *pi_template); |
| 47 | unsigned long host_flags, | ||
| 48 | unsigned int force_port_map, | ||
| 49 | unsigned int mask_port_map); | ||
| 50 | 47 | ||
| 51 | int ahci_platform_suspend_host(struct device *dev); | 48 | int ahci_platform_suspend_host(struct device *dev); |
| 52 | int ahci_platform_resume_host(struct device *dev); | 49 | int ahci_platform_resume_host(struct device *dev); |
diff --git a/include/linux/amd-iommu.h b/include/linux/amd-iommu.h index 15f6b9edd0b1..2b08e79f5100 100644 --- a/include/linux/amd-iommu.h +++ b/include/linux/amd-iommu.h | |||
| @@ -119,6 +119,13 @@ typedef int (*amd_iommu_invalid_ppr_cb)(struct pci_dev *pdev, | |||
| 119 | extern int amd_iommu_set_invalid_ppr_cb(struct pci_dev *pdev, | 119 | extern int amd_iommu_set_invalid_ppr_cb(struct pci_dev *pdev, |
| 120 | amd_iommu_invalid_ppr_cb cb); | 120 | amd_iommu_invalid_ppr_cb cb); |
| 121 | 121 | ||
| 122 | #define PPR_FAULT_EXEC (1 << 1) | ||
| 123 | #define PPR_FAULT_READ (1 << 2) | ||
| 124 | #define PPR_FAULT_WRITE (1 << 5) | ||
| 125 | #define PPR_FAULT_USER (1 << 6) | ||
| 126 | #define PPR_FAULT_RSVD (1 << 7) | ||
| 127 | #define PPR_FAULT_GN (1 << 8) | ||
| 128 | |||
| 122 | /** | 129 | /** |
| 123 | * amd_iommu_device_info() - Get information about IOMMUv2 support of a | 130 | * amd_iommu_device_info() - Get information about IOMMUv2 support of a |
| 124 | * PCI device | 131 | * PCI device |
diff --git a/include/linux/arcdevice.h b/include/linux/arcdevice.h index 7216b0daf544..df0356220730 100644 --- a/include/linux/arcdevice.h +++ b/include/linux/arcdevice.h | |||
| @@ -22,10 +22,6 @@ | |||
| 22 | #ifdef __KERNEL__ | 22 | #ifdef __KERNEL__ |
| 23 | #include <linux/irqreturn.h> | 23 | #include <linux/irqreturn.h> |
| 24 | 24 | ||
| 25 | #ifndef bool | ||
| 26 | #define bool int | ||
| 27 | #endif | ||
| 28 | |||
| 29 | /* | 25 | /* |
| 30 | * RECON_THRESHOLD is the maximum number of RECON messages to receive | 26 | * RECON_THRESHOLD is the maximum number of RECON messages to receive |
| 31 | * within one minute before printing a "cabling problem" warning. The | 27 | * within one minute before printing a "cabling problem" warning. The |
| @@ -285,9 +281,9 @@ struct arcnet_local { | |||
| 285 | unsigned long first_recon; /* time of "first" RECON message to count */ | 281 | unsigned long first_recon; /* time of "first" RECON message to count */ |
| 286 | unsigned long last_recon; /* time of most recent RECON */ | 282 | unsigned long last_recon; /* time of most recent RECON */ |
| 287 | int num_recons; /* number of RECONs between first and last. */ | 283 | int num_recons; /* number of RECONs between first and last. */ |
| 288 | bool network_down; /* do we think the network is down? */ | 284 | int network_down; /* do we think the network is down? */ |
| 289 | 285 | ||
| 290 | bool excnak_pending; /* We just got an excesive nak interrupt */ | 286 | int excnak_pending; /* We just got an excesive nak interrupt */ |
| 291 | 287 | ||
| 292 | struct { | 288 | struct { |
| 293 | uint16_t sequence; /* sequence number (incs with each packet) */ | 289 | uint16_t sequence; /* sequence number (incs with each packet) */ |
| @@ -305,7 +301,7 @@ struct arcnet_local { | |||
| 305 | void (*command) (struct net_device * dev, int cmd); | 301 | void (*command) (struct net_device * dev, int cmd); |
| 306 | int (*status) (struct net_device * dev); | 302 | int (*status) (struct net_device * dev); |
| 307 | void (*intmask) (struct net_device * dev, int mask); | 303 | void (*intmask) (struct net_device * dev, int mask); |
| 308 | bool (*reset) (struct net_device * dev, bool really_reset); | 304 | int (*reset) (struct net_device * dev, int really_reset); |
| 309 | void (*open) (struct net_device * dev); | 305 | void (*open) (struct net_device * dev); |
| 310 | void (*close) (struct net_device * dev); | 306 | void (*close) (struct net_device * dev); |
| 311 | 307 | ||
diff --git a/include/linux/atmel-ssc.h b/include/linux/atmel-ssc.h index 571a12ebb018..7c0f6549898b 100644 --- a/include/linux/atmel-ssc.h +++ b/include/linux/atmel-ssc.h | |||
| @@ -7,6 +7,7 @@ | |||
| 7 | 7 | ||
| 8 | struct atmel_ssc_platform_data { | 8 | struct atmel_ssc_platform_data { |
| 9 | int use_dma; | 9 | int use_dma; |
| 10 | int has_fslen_ext; | ||
| 10 | }; | 11 | }; |
| 11 | 12 | ||
| 12 | struct ssc_device { | 13 | struct ssc_device { |
| @@ -71,6 +72,12 @@ void ssc_free(struct ssc_device *ssc); | |||
| 71 | #define SSC_RFMR_DATNB_OFFSET 8 | 72 | #define SSC_RFMR_DATNB_OFFSET 8 |
| 72 | #define SSC_RFMR_FSEDGE_SIZE 1 | 73 | #define SSC_RFMR_FSEDGE_SIZE 1 |
| 73 | #define SSC_RFMR_FSEDGE_OFFSET 24 | 74 | #define SSC_RFMR_FSEDGE_OFFSET 24 |
| 75 | /* | ||
| 76 | * The FSLEN_EXT exist on at91sam9rl, at91sam9g10, | ||
| 77 | * at91sam9g20, and at91sam9g45 and newer SoCs | ||
| 78 | */ | ||
| 79 | #define SSC_RFMR_FSLEN_EXT_SIZE 4 | ||
| 80 | #define SSC_RFMR_FSLEN_EXT_OFFSET 28 | ||
| 74 | #define SSC_RFMR_FSLEN_SIZE 4 | 81 | #define SSC_RFMR_FSLEN_SIZE 4 |
| 75 | #define SSC_RFMR_FSLEN_OFFSET 16 | 82 | #define SSC_RFMR_FSLEN_OFFSET 16 |
| 76 | #define SSC_RFMR_FSOS_SIZE 4 | 83 | #define SSC_RFMR_FSOS_SIZE 4 |
| @@ -109,6 +116,12 @@ void ssc_free(struct ssc_device *ssc); | |||
| 109 | #define SSC_TFMR_FSDEN_OFFSET 23 | 116 | #define SSC_TFMR_FSDEN_OFFSET 23 |
| 110 | #define SSC_TFMR_FSEDGE_SIZE 1 | 117 | #define SSC_TFMR_FSEDGE_SIZE 1 |
| 111 | #define SSC_TFMR_FSEDGE_OFFSET 24 | 118 | #define SSC_TFMR_FSEDGE_OFFSET 24 |
| 119 | /* | ||
| 120 | * The FSLEN_EXT exist on at91sam9rl, at91sam9g10, | ||
| 121 | * at91sam9g20, and at91sam9g45 and newer SoCs | ||
| 122 | */ | ||
| 123 | #define SSC_TFMR_FSLEN_EXT_SIZE 4 | ||
| 124 | #define SSC_TFMR_FSLEN_EXT_OFFSET 28 | ||
| 112 | #define SSC_TFMR_FSLEN_SIZE 4 | 125 | #define SSC_TFMR_FSLEN_SIZE 4 |
| 113 | #define SSC_TFMR_FSLEN_OFFSET 16 | 126 | #define SSC_TFMR_FSLEN_OFFSET 16 |
| 114 | #define SSC_TFMR_FSOS_SIZE 3 | 127 | #define SSC_TFMR_FSOS_SIZE 3 |
diff --git a/include/linux/bcma/bcma.h b/include/linux/bcma/bcma.h index 0b3bb16c705a..0272e49135d0 100644 --- a/include/linux/bcma/bcma.h +++ b/include/linux/bcma/bcma.h | |||
| @@ -6,6 +6,7 @@ | |||
| 6 | 6 | ||
| 7 | #include <linux/bcma/bcma_driver_chipcommon.h> | 7 | #include <linux/bcma/bcma_driver_chipcommon.h> |
| 8 | #include <linux/bcma/bcma_driver_pci.h> | 8 | #include <linux/bcma/bcma_driver_pci.h> |
| 9 | #include <linux/bcma/bcma_driver_pcie2.h> | ||
| 9 | #include <linux/bcma/bcma_driver_mips.h> | 10 | #include <linux/bcma/bcma_driver_mips.h> |
| 10 | #include <linux/bcma/bcma_driver_gmac_cmn.h> | 11 | #include <linux/bcma/bcma_driver_gmac_cmn.h> |
| 11 | #include <linux/ssb/ssb.h> /* SPROM sharing */ | 12 | #include <linux/ssb/ssb.h> /* SPROM sharing */ |
| @@ -72,17 +73,17 @@ struct bcma_host_ops { | |||
| 72 | /* Core-ID values. */ | 73 | /* Core-ID values. */ |
| 73 | #define BCMA_CORE_OOB_ROUTER 0x367 /* Out of band */ | 74 | #define BCMA_CORE_OOB_ROUTER 0x367 /* Out of band */ |
| 74 | #define BCMA_CORE_4706_CHIPCOMMON 0x500 | 75 | #define BCMA_CORE_4706_CHIPCOMMON 0x500 |
| 75 | #define BCMA_CORE_PCIEG2 0x501 | 76 | #define BCMA_CORE_NS_PCIEG2 0x501 |
| 76 | #define BCMA_CORE_DMA 0x502 | 77 | #define BCMA_CORE_NS_DMA 0x502 |
| 77 | #define BCMA_CORE_SDIO3 0x503 | 78 | #define BCMA_CORE_NS_SDIO3 0x503 |
| 78 | #define BCMA_CORE_USB20 0x504 | 79 | #define BCMA_CORE_NS_USB20 0x504 |
| 79 | #define BCMA_CORE_USB30 0x505 | 80 | #define BCMA_CORE_NS_USB30 0x505 |
| 80 | #define BCMA_CORE_A9JTAG 0x506 | 81 | #define BCMA_CORE_NS_A9JTAG 0x506 |
| 81 | #define BCMA_CORE_DDR23 0x507 | 82 | #define BCMA_CORE_NS_DDR23 0x507 |
| 82 | #define BCMA_CORE_ROM 0x508 | 83 | #define BCMA_CORE_NS_ROM 0x508 |
| 83 | #define BCMA_CORE_NAND 0x509 | 84 | #define BCMA_CORE_NS_NAND 0x509 |
| 84 | #define BCMA_CORE_QSPI 0x50A | 85 | #define BCMA_CORE_NS_QSPI 0x50A |
| 85 | #define BCMA_CORE_CHIPCOMMON_B 0x50B | 86 | #define BCMA_CORE_NS_CHIPCOMMON_B 0x50B |
| 86 | #define BCMA_CORE_4706_SOC_RAM 0x50E | 87 | #define BCMA_CORE_4706_SOC_RAM 0x50E |
| 87 | #define BCMA_CORE_ARMCA9 0x510 | 88 | #define BCMA_CORE_ARMCA9 0x510 |
| 88 | #define BCMA_CORE_4706_MAC_GBIT 0x52D | 89 | #define BCMA_CORE_4706_MAC_GBIT 0x52D |
| @@ -157,6 +158,9 @@ struct bcma_host_ops { | |||
| 157 | /* Chip IDs of PCIe devices */ | 158 | /* Chip IDs of PCIe devices */ |
| 158 | #define BCMA_CHIP_ID_BCM4313 0x4313 | 159 | #define BCMA_CHIP_ID_BCM4313 0x4313 |
| 159 | #define BCMA_CHIP_ID_BCM43142 43142 | 160 | #define BCMA_CHIP_ID_BCM43142 43142 |
| 161 | #define BCMA_CHIP_ID_BCM43131 43131 | ||
| 162 | #define BCMA_CHIP_ID_BCM43217 43217 | ||
| 163 | #define BCMA_CHIP_ID_BCM43222 43222 | ||
| 160 | #define BCMA_CHIP_ID_BCM43224 43224 | 164 | #define BCMA_CHIP_ID_BCM43224 43224 |
| 161 | #define BCMA_PKG_ID_BCM43224_FAB_CSM 0x8 | 165 | #define BCMA_PKG_ID_BCM43224_FAB_CSM 0x8 |
| 162 | #define BCMA_PKG_ID_BCM43224_FAB_SMIC 0xa | 166 | #define BCMA_PKG_ID_BCM43224_FAB_SMIC 0xa |
| @@ -333,6 +337,7 @@ struct bcma_bus { | |||
| 333 | 337 | ||
| 334 | struct bcma_drv_cc drv_cc; | 338 | struct bcma_drv_cc drv_cc; |
| 335 | struct bcma_drv_pci drv_pci[2]; | 339 | struct bcma_drv_pci drv_pci[2]; |
| 340 | struct bcma_drv_pcie2 drv_pcie2; | ||
| 336 | struct bcma_drv_mips drv_mips; | 341 | struct bcma_drv_mips drv_mips; |
| 337 | struct bcma_drv_gmac_cmn drv_gmac_cmn; | 342 | struct bcma_drv_gmac_cmn drv_gmac_cmn; |
| 338 | 343 | ||
diff --git a/include/linux/bcma/bcma_driver_pcie2.h b/include/linux/bcma/bcma_driver_pcie2.h new file mode 100644 index 000000000000..5988b05781c3 --- /dev/null +++ b/include/linux/bcma/bcma_driver_pcie2.h | |||
| @@ -0,0 +1,158 @@ | |||
| 1 | #ifndef LINUX_BCMA_DRIVER_PCIE2_H_ | ||
| 2 | #define LINUX_BCMA_DRIVER_PCIE2_H_ | ||
| 3 | |||
| 4 | #define BCMA_CORE_PCIE2_CLK_CONTROL 0x0000 | ||
| 5 | #define PCIE2_CLKC_RST_OE 0x0001 /* When set, drives PCI_RESET out to pin */ | ||
| 6 | #define PCIE2_CLKC_RST 0x0002 /* Value driven out to pin */ | ||
| 7 | #define PCIE2_CLKC_SPERST 0x0004 /* SurvivePeRst */ | ||
| 8 | #define PCIE2_CLKC_DISABLE_L1CLK_GATING 0x0010 | ||
| 9 | #define PCIE2_CLKC_DLYPERST 0x0100 /* Delay PeRst to CoE Core */ | ||
| 10 | #define PCIE2_CLKC_DISSPROMLD 0x0200 /* DisableSpromLoadOnPerst */ | ||
| 11 | #define PCIE2_CLKC_WAKE_MODE_L2 0x1000 /* Wake on L2 */ | ||
| 12 | #define BCMA_CORE_PCIE2_RC_PM_CONTROL 0x0004 | ||
| 13 | #define BCMA_CORE_PCIE2_RC_PM_STATUS 0x0008 | ||
| 14 | #define BCMA_CORE_PCIE2_EP_PM_CONTROL 0x000C | ||
| 15 | #define BCMA_CORE_PCIE2_EP_PM_STATUS 0x0010 | ||
| 16 | #define BCMA_CORE_PCIE2_EP_LTR_CONTROL 0x0014 | ||
| 17 | #define BCMA_CORE_PCIE2_EP_LTR_STATUS 0x0018 | ||
| 18 | #define BCMA_CORE_PCIE2_EP_OBFF_STATUS 0x001C | ||
| 19 | #define BCMA_CORE_PCIE2_PCIE_ERR_STATUS 0x0020 | ||
| 20 | #define BCMA_CORE_PCIE2_RC_AXI_CONFIG 0x0100 | ||
| 21 | #define BCMA_CORE_PCIE2_EP_AXI_CONFIG 0x0104 | ||
| 22 | #define BCMA_CORE_PCIE2_RXDEBUG_STATUS0 0x0108 | ||
| 23 | #define BCMA_CORE_PCIE2_RXDEBUG_CONTROL0 0x010C | ||
| 24 | #define BCMA_CORE_PCIE2_CONFIGINDADDR 0x0120 | ||
| 25 | #define BCMA_CORE_PCIE2_CONFIGINDDATA 0x0124 | ||
| 26 | #define BCMA_CORE_PCIE2_MDIOCONTROL 0x0128 | ||
| 27 | #define BCMA_CORE_PCIE2_MDIOWRDATA 0x012C | ||
| 28 | #define BCMA_CORE_PCIE2_MDIORDDATA 0x0130 | ||
| 29 | #define BCMA_CORE_PCIE2_DATAINTF 0x0180 | ||
| 30 | #define BCMA_CORE_PCIE2_D2H_INTRLAZY_0 0x0188 | ||
| 31 | #define BCMA_CORE_PCIE2_H2D_INTRLAZY_0 0x018c | ||
| 32 | #define BCMA_CORE_PCIE2_H2D_INTSTAT_0 0x0190 | ||
| 33 | #define BCMA_CORE_PCIE2_H2D_INTMASK_0 0x0194 | ||
| 34 | #define BCMA_CORE_PCIE2_D2H_INTSTAT_0 0x0198 | ||
| 35 | #define BCMA_CORE_PCIE2_D2H_INTMASK_0 0x019c | ||
| 36 | #define BCMA_CORE_PCIE2_LTR_STATE 0x01A0 /* Latency Tolerance Reporting */ | ||
| 37 | #define PCIE2_LTR_ACTIVE 2 | ||
| 38 | #define PCIE2_LTR_ACTIVE_IDLE 1 | ||
| 39 | #define PCIE2_LTR_SLEEP 0 | ||
| 40 | #define PCIE2_LTR_FINAL_MASK 0x300 | ||
| 41 | #define PCIE2_LTR_FINAL_SHIFT 8 | ||
| 42 | #define BCMA_CORE_PCIE2_PWR_INT_STATUS 0x01A4 | ||
| 43 | #define BCMA_CORE_PCIE2_PWR_INT_MASK 0x01A8 | ||
| 44 | #define BCMA_CORE_PCIE2_CFG_ADDR 0x01F8 | ||
| 45 | #define BCMA_CORE_PCIE2_CFG_DATA 0x01FC | ||
| 46 | #define BCMA_CORE_PCIE2_SYS_EQ_PAGE 0x0200 | ||
| 47 | #define BCMA_CORE_PCIE2_SYS_MSI_PAGE 0x0204 | ||
| 48 | #define BCMA_CORE_PCIE2_SYS_MSI_INTREN 0x0208 | ||
| 49 | #define BCMA_CORE_PCIE2_SYS_MSI_CTRL0 0x0210 | ||
| 50 | #define BCMA_CORE_PCIE2_SYS_MSI_CTRL1 0x0214 | ||
| 51 | #define BCMA_CORE_PCIE2_SYS_MSI_CTRL2 0x0218 | ||
| 52 | #define BCMA_CORE_PCIE2_SYS_MSI_CTRL3 0x021C | ||
| 53 | #define BCMA_CORE_PCIE2_SYS_MSI_CTRL4 0x0220 | ||
| 54 | #define BCMA_CORE_PCIE2_SYS_MSI_CTRL5 0x0224 | ||
| 55 | #define BCMA_CORE_PCIE2_SYS_EQ_HEAD0 0x0250 | ||
| 56 | #define BCMA_CORE_PCIE2_SYS_EQ_TAIL0 0x0254 | ||
| 57 | #define BCMA_CORE_PCIE2_SYS_EQ_HEAD1 0x0258 | ||
| 58 | #define BCMA_CORE_PCIE2_SYS_EQ_TAIL1 0x025C | ||
| 59 | #define BCMA_CORE_PCIE2_SYS_EQ_HEAD2 0x0260 | ||
| 60 | #define BCMA_CORE_PCIE2_SYS_EQ_TAIL2 0x0264 | ||
| 61 | #define BCMA_CORE_PCIE2_SYS_EQ_HEAD3 0x0268 | ||
| 62 | #define BCMA_CORE_PCIE2_SYS_EQ_TAIL3 0x026C | ||
| 63 | #define BCMA_CORE_PCIE2_SYS_EQ_HEAD4 0x0270 | ||
| 64 | #define BCMA_CORE_PCIE2_SYS_EQ_TAIL4 0x0274 | ||
| 65 | #define BCMA_CORE_PCIE2_SYS_EQ_HEAD5 0x0278 | ||
| 66 | #define BCMA_CORE_PCIE2_SYS_EQ_TAIL5 0x027C | ||
| 67 | #define BCMA_CORE_PCIE2_SYS_RC_INTX_EN 0x0330 | ||
| 68 | #define BCMA_CORE_PCIE2_SYS_RC_INTX_CSR 0x0334 | ||
| 69 | #define BCMA_CORE_PCIE2_SYS_MSI_REQ 0x0340 | ||
| 70 | #define BCMA_CORE_PCIE2_SYS_HOST_INTR_EN 0x0344 | ||
| 71 | #define BCMA_CORE_PCIE2_SYS_HOST_INTR_CSR 0x0348 | ||
| 72 | #define BCMA_CORE_PCIE2_SYS_HOST_INTR0 0x0350 | ||
| 73 | #define BCMA_CORE_PCIE2_SYS_HOST_INTR1 0x0354 | ||
| 74 | #define BCMA_CORE_PCIE2_SYS_HOST_INTR2 0x0358 | ||
| 75 | #define BCMA_CORE_PCIE2_SYS_HOST_INTR3 0x035C | ||
| 76 | #define BCMA_CORE_PCIE2_SYS_EP_INT_EN0 0x0360 | ||
| 77 | #define BCMA_CORE_PCIE2_SYS_EP_INT_EN1 0x0364 | ||
| 78 | #define BCMA_CORE_PCIE2_SYS_EP_INT_CSR0 0x0370 | ||
| 79 | #define BCMA_CORE_PCIE2_SYS_EP_INT_CSR1 0x0374 | ||
| 80 | #define BCMA_CORE_PCIE2_SPROM(wordoffset) (0x0800 + ((wordoffset) * 2)) | ||
| 81 | #define BCMA_CORE_PCIE2_FUNC0_IMAP0_0 0x0C00 | ||
| 82 | #define BCMA_CORE_PCIE2_FUNC0_IMAP0_1 0x0C04 | ||
| 83 | #define BCMA_CORE_PCIE2_FUNC0_IMAP0_2 0x0C08 | ||
| 84 | #define BCMA_CORE_PCIE2_FUNC0_IMAP0_3 0x0C0C | ||
| 85 | #define BCMA_CORE_PCIE2_FUNC0_IMAP0_4 0x0C10 | ||
| 86 | #define BCMA_CORE_PCIE2_FUNC0_IMAP0_5 0x0C14 | ||
| 87 | #define BCMA_CORE_PCIE2_FUNC0_IMAP0_6 0x0C18 | ||
| 88 | #define BCMA_CORE_PCIE2_FUNC0_IMAP0_7 0x0C1C | ||
| 89 | #define BCMA_CORE_PCIE2_FUNC1_IMAP0_0 0x0C20 | ||
| 90 | #define BCMA_CORE_PCIE2_FUNC1_IMAP0_1 0x0C24 | ||
| 91 | #define BCMA_CORE_PCIE2_FUNC1_IMAP0_2 0x0C28 | ||
| 92 | #define BCMA_CORE_PCIE2_FUNC1_IMAP0_3 0x0C2C | ||
| 93 | #define BCMA_CORE_PCIE2_FUNC1_IMAP0_4 0x0C30 | ||
| 94 | #define BCMA_CORE_PCIE2_FUNC1_IMAP0_5 0x0C34 | ||
| 95 | #define BCMA_CORE_PCIE2_FUNC1_IMAP0_6 0x0C38 | ||
| 96 | #define BCMA_CORE_PCIE2_FUNC1_IMAP0_7 0x0C3C | ||
| 97 | #define BCMA_CORE_PCIE2_FUNC0_IMAP1 0x0C80 | ||
| 98 | #define BCMA_CORE_PCIE2_FUNC1_IMAP1 0x0C88 | ||
| 99 | #define BCMA_CORE_PCIE2_FUNC0_IMAP2 0x0CC0 | ||
| 100 | #define BCMA_CORE_PCIE2_FUNC1_IMAP2 0x0CC8 | ||
| 101 | #define BCMA_CORE_PCIE2_IARR0_LOWER 0x0D00 | ||
| 102 | #define BCMA_CORE_PCIE2_IARR0_UPPER 0x0D04 | ||
| 103 | #define BCMA_CORE_PCIE2_IARR1_LOWER 0x0D08 | ||
| 104 | #define BCMA_CORE_PCIE2_IARR1_UPPER 0x0D0C | ||
| 105 | #define BCMA_CORE_PCIE2_IARR2_LOWER 0x0D10 | ||
| 106 | #define BCMA_CORE_PCIE2_IARR2_UPPER 0x0D14 | ||
| 107 | #define BCMA_CORE_PCIE2_OARR0 0x0D20 | ||
| 108 | #define BCMA_CORE_PCIE2_OARR1 0x0D28 | ||
| 109 | #define BCMA_CORE_PCIE2_OARR2 0x0D30 | ||
| 110 | #define BCMA_CORE_PCIE2_OMAP0_LOWER 0x0D40 | ||
| 111 | #define BCMA_CORE_PCIE2_OMAP0_UPPER 0x0D44 | ||
| 112 | #define BCMA_CORE_PCIE2_OMAP1_LOWER 0x0D48 | ||
| 113 | #define BCMA_CORE_PCIE2_OMAP1_UPPER 0x0D4C | ||
| 114 | #define BCMA_CORE_PCIE2_OMAP2_LOWER 0x0D50 | ||
| 115 | #define BCMA_CORE_PCIE2_OMAP2_UPPER 0x0D54 | ||
| 116 | #define BCMA_CORE_PCIE2_FUNC1_IARR1_SIZE 0x0D58 | ||
| 117 | #define BCMA_CORE_PCIE2_FUNC1_IARR2_SIZE 0x0D5C | ||
| 118 | #define BCMA_CORE_PCIE2_MEM_CONTROL 0x0F00 | ||
| 119 | #define BCMA_CORE_PCIE2_MEM_ECC_ERRLOG0 0x0F04 | ||
| 120 | #define BCMA_CORE_PCIE2_MEM_ECC_ERRLOG1 0x0F08 | ||
| 121 | #define BCMA_CORE_PCIE2_LINK_STATUS 0x0F0C | ||
| 122 | #define BCMA_CORE_PCIE2_STRAP_STATUS 0x0F10 | ||
| 123 | #define BCMA_CORE_PCIE2_RESET_STATUS 0x0F14 | ||
| 124 | #define BCMA_CORE_PCIE2_RESETEN_IN_LINKDOWN 0x0F18 | ||
| 125 | #define BCMA_CORE_PCIE2_MISC_INTR_EN 0x0F1C | ||
| 126 | #define BCMA_CORE_PCIE2_TX_DEBUG_CFG 0x0F20 | ||
| 127 | #define BCMA_CORE_PCIE2_MISC_CONFIG 0x0F24 | ||
| 128 | #define BCMA_CORE_PCIE2_MISC_STATUS 0x0F28 | ||
| 129 | #define BCMA_CORE_PCIE2_INTR_EN 0x0F30 | ||
| 130 | #define BCMA_CORE_PCIE2_INTR_CLEAR 0x0F34 | ||
| 131 | #define BCMA_CORE_PCIE2_INTR_STATUS 0x0F38 | ||
| 132 | |||
| 133 | /* PCIE gen2 config regs */ | ||
| 134 | #define PCIE2_INTSTATUS 0x090 | ||
| 135 | #define PCIE2_INTMASK 0x094 | ||
| 136 | #define PCIE2_SBMBX 0x098 | ||
| 137 | |||
| 138 | #define PCIE2_PMCR_REFUP 0x1814 /* Trefup time */ | ||
| 139 | |||
| 140 | #define PCIE2_CAP_DEVSTSCTRL2_OFFSET 0xD4 | ||
| 141 | #define PCIE2_CAP_DEVSTSCTRL2_LTRENAB 0x400 | ||
| 142 | #define PCIE2_PVT_REG_PM_CLK_PERIOD 0x184c | ||
| 143 | |||
| 144 | struct bcma_drv_pcie2 { | ||
| 145 | struct bcma_device *core; | ||
| 146 | }; | ||
| 147 | |||
| 148 | #define pcie2_read16(pcie2, offset) bcma_read16((pcie2)->core, offset) | ||
| 149 | #define pcie2_read32(pcie2, offset) bcma_read32((pcie2)->core, offset) | ||
| 150 | #define pcie2_write16(pcie2, offset, val) bcma_write16((pcie2)->core, offset, val) | ||
| 151 | #define pcie2_write32(pcie2, offset, val) bcma_write32((pcie2)->core, offset, val) | ||
| 152 | |||
| 153 | #define pcie2_set32(pcie2, offset, set) bcma_set32((pcie2)->core, offset, set) | ||
| 154 | #define pcie2_mask32(pcie2, offset, mask) bcma_mask32((pcie2)->core, offset, mask) | ||
| 155 | |||
| 156 | void bcma_core_pcie2_init(struct bcma_drv_pcie2 *pcie2); | ||
| 157 | |||
| 158 | #endif /* LINUX_BCMA_DRIVER_PCIE2_H_ */ | ||
diff --git a/include/linux/capability.h b/include/linux/capability.h index 84b13ad67c1c..aa93e5ef594c 100644 --- a/include/linux/capability.h +++ b/include/linux/capability.h | |||
| @@ -78,8 +78,11 @@ extern const kernel_cap_t __cap_init_eff_set; | |||
| 78 | # error Fix up hand-coded capability macro initializers | 78 | # error Fix up hand-coded capability macro initializers |
| 79 | #else /* HAND-CODED capability initializers */ | 79 | #else /* HAND-CODED capability initializers */ |
| 80 | 80 | ||
| 81 | #define CAP_LAST_U32 ((_KERNEL_CAPABILITY_U32S) - 1) | ||
| 82 | #define CAP_LAST_U32_VALID_MASK (CAP_TO_MASK(CAP_LAST_CAP + 1) -1) | ||
| 83 | |||
| 81 | # define CAP_EMPTY_SET ((kernel_cap_t){{ 0, 0 }}) | 84 | # define CAP_EMPTY_SET ((kernel_cap_t){{ 0, 0 }}) |
| 82 | # define CAP_FULL_SET ((kernel_cap_t){{ ~0, ~0 }}) | 85 | # define CAP_FULL_SET ((kernel_cap_t){{ ~0, CAP_LAST_U32_VALID_MASK }}) |
| 83 | # define CAP_FS_SET ((kernel_cap_t){{ CAP_FS_MASK_B0 \ | 86 | # define CAP_FS_SET ((kernel_cap_t){{ CAP_FS_MASK_B0 \ |
| 84 | | CAP_TO_MASK(CAP_LINUX_IMMUTABLE), \ | 87 | | CAP_TO_MASK(CAP_LINUX_IMMUTABLE), \ |
| 85 | CAP_FS_MASK_B1 } }) | 88 | CAP_FS_MASK_B1 } }) |
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h index 8a111dd42d7a..b5223c570eba 100644 --- a/include/linux/cgroup.h +++ b/include/linux/cgroup.h | |||
| @@ -203,7 +203,15 @@ struct cgroup { | |||
| 203 | struct kernfs_node *kn; /* cgroup kernfs entry */ | 203 | struct kernfs_node *kn; /* cgroup kernfs entry */ |
| 204 | struct kernfs_node *populated_kn; /* kn for "cgroup.subtree_populated" */ | 204 | struct kernfs_node *populated_kn; /* kn for "cgroup.subtree_populated" */ |
| 205 | 205 | ||
| 206 | /* the bitmask of subsystems enabled on the child cgroups */ | 206 | /* |
| 207 | * The bitmask of subsystems enabled on the child cgroups. | ||
| 208 | * ->subtree_control is the one configured through | ||
| 209 | * "cgroup.subtree_control" while ->child_subsys_mask is the | ||
| 210 | * effective one which may have more subsystems enabled. | ||
| 211 | * Controller knobs are made available iff it's enabled in | ||
| 212 | * ->subtree_control. | ||
| 213 | */ | ||
| 214 | unsigned int subtree_control; | ||
| 207 | unsigned int child_subsys_mask; | 215 | unsigned int child_subsys_mask; |
| 208 | 216 | ||
| 209 | /* Private pointers for each registered subsystem */ | 217 | /* Private pointers for each registered subsystem */ |
| @@ -248,73 +256,9 @@ struct cgroup { | |||
| 248 | 256 | ||
| 249 | /* cgroup_root->flags */ | 257 | /* cgroup_root->flags */ |
| 250 | enum { | 258 | enum { |
| 251 | /* | 259 | CGRP_ROOT_SANE_BEHAVIOR = (1 << 0), /* __DEVEL__sane_behavior specified */ |
| 252 | * Unfortunately, cgroup core and various controllers are riddled | ||
| 253 | * with idiosyncrasies and pointless options. The following flag, | ||
| 254 | * when set, will force sane behavior - some options are forced on, | ||
| 255 | * others are disallowed, and some controllers will change their | ||
| 256 | * hierarchical or other behaviors. | ||
| 257 | * | ||
| 258 | * The set of behaviors affected by this flag are still being | ||
| 259 | * determined and developed and the mount option for this flag is | ||
| 260 | * prefixed with __DEVEL__. The prefix will be dropped once we | ||
| 261 | * reach the point where all behaviors are compatible with the | ||
| 262 | * planned unified hierarchy, which will automatically turn on this | ||
| 263 | * flag. | ||
| 264 | * | ||
| 265 | * The followings are the behaviors currently affected this flag. | ||
| 266 | * | ||
| 267 | * - Mount options "noprefix", "xattr", "clone_children", | ||
| 268 | * "release_agent" and "name" are disallowed. | ||
| 269 | * | ||
| 270 | * - When mounting an existing superblock, mount options should | ||
| 271 | * match. | ||
| 272 | * | ||
| 273 | * - Remount is disallowed. | ||
| 274 | * | ||
| 275 | * - rename(2) is disallowed. | ||
| 276 | * | ||
| 277 | * - "tasks" is removed. Everything should be at process | ||
| 278 | * granularity. Use "cgroup.procs" instead. | ||
| 279 | * | ||
| 280 | * - "cgroup.procs" is not sorted. pids will be unique unless they | ||
| 281 | * got recycled inbetween reads. | ||
| 282 | * | ||
| 283 | * - "release_agent" and "notify_on_release" are removed. | ||
| 284 | * Replacement notification mechanism will be implemented. | ||
| 285 | * | ||
| 286 | * - "cgroup.clone_children" is removed. | ||
| 287 | * | ||
| 288 | * - "cgroup.subtree_populated" is available. Its value is 0 if | ||
| 289 | * the cgroup and its descendants contain no task; otherwise, 1. | ||
| 290 | * The file also generates kernfs notification which can be | ||
| 291 | * monitored through poll and [di]notify when the value of the | ||
| 292 | * file changes. | ||
| 293 | * | ||
| 294 | * - If mount is requested with sane_behavior but without any | ||
| 295 | * subsystem, the default unified hierarchy is mounted. | ||
| 296 | * | ||
| 297 | * - cpuset: tasks will be kept in empty cpusets when hotplug happens | ||
| 298 | * and take masks of ancestors with non-empty cpus/mems, instead of | ||
| 299 | * being moved to an ancestor. | ||
| 300 | * | ||
| 301 | * - cpuset: a task can be moved into an empty cpuset, and again it | ||
| 302 | * takes masks of ancestors. | ||
| 303 | * | ||
| 304 | * - memcg: use_hierarchy is on by default and the cgroup file for | ||
| 305 | * the flag is not created. | ||
| 306 | * | ||
| 307 | * - blkcg: blk-throttle becomes properly hierarchical. | ||
| 308 | * | ||
| 309 | * - debug: disallowed on the default hierarchy. | ||
| 310 | */ | ||
| 311 | CGRP_ROOT_SANE_BEHAVIOR = (1 << 0), | ||
| 312 | |||
| 313 | CGRP_ROOT_NOPREFIX = (1 << 1), /* mounted subsystems have no named prefix */ | 260 | CGRP_ROOT_NOPREFIX = (1 << 1), /* mounted subsystems have no named prefix */ |
| 314 | CGRP_ROOT_XATTR = (1 << 2), /* supports extended attributes */ | 261 | CGRP_ROOT_XATTR = (1 << 2), /* supports extended attributes */ |
| 315 | |||
| 316 | /* mount options live below bit 16 */ | ||
| 317 | CGRP_ROOT_OPTION_MASK = (1 << 16) - 1, | ||
| 318 | }; | 262 | }; |
| 319 | 263 | ||
| 320 | /* | 264 | /* |
| @@ -440,9 +384,11 @@ struct css_set { | |||
| 440 | enum { | 384 | enum { |
| 441 | CFTYPE_ONLY_ON_ROOT = (1 << 0), /* only create on root cgrp */ | 385 | CFTYPE_ONLY_ON_ROOT = (1 << 0), /* only create on root cgrp */ |
| 442 | CFTYPE_NOT_ON_ROOT = (1 << 1), /* don't create on root cgrp */ | 386 | CFTYPE_NOT_ON_ROOT = (1 << 1), /* don't create on root cgrp */ |
| 443 | CFTYPE_INSANE = (1 << 2), /* don't create if sane_behavior */ | ||
| 444 | CFTYPE_NO_PREFIX = (1 << 3), /* (DON'T USE FOR NEW FILES) no subsys prefix */ | 387 | CFTYPE_NO_PREFIX = (1 << 3), /* (DON'T USE FOR NEW FILES) no subsys prefix */ |
| 445 | CFTYPE_ONLY_ON_DFL = (1 << 4), /* only on default hierarchy */ | 388 | |
| 389 | /* internal flags, do not use outside cgroup core proper */ | ||
| 390 | __CFTYPE_ONLY_ON_DFL = (1 << 16), /* only on default hierarchy */ | ||
| 391 | __CFTYPE_NOT_ON_DFL = (1 << 17), /* not on default hierarchy */ | ||
| 446 | }; | 392 | }; |
| 447 | 393 | ||
| 448 | #define MAX_CFTYPE_NAME 64 | 394 | #define MAX_CFTYPE_NAME 64 |
| @@ -526,20 +472,64 @@ struct cftype { | |||
| 526 | extern struct cgroup_root cgrp_dfl_root; | 472 | extern struct cgroup_root cgrp_dfl_root; |
| 527 | extern struct css_set init_css_set; | 473 | extern struct css_set init_css_set; |
| 528 | 474 | ||
| 475 | /** | ||
| 476 | * cgroup_on_dfl - test whether a cgroup is on the default hierarchy | ||
| 477 | * @cgrp: the cgroup of interest | ||
| 478 | * | ||
| 479 | * The default hierarchy is the v2 interface of cgroup and this function | ||
| 480 | * can be used to test whether a cgroup is on the default hierarchy for | ||
| 481 | * cases where a subsystem should behave differnetly depending on the | ||
| 482 | * interface version. | ||
| 483 | * | ||
| 484 | * The set of behaviors which change on the default hierarchy are still | ||
| 485 | * being determined and the mount option is prefixed with __DEVEL__. | ||
| 486 | * | ||
| 487 | * List of changed behaviors: | ||
| 488 | * | ||
| 489 | * - Mount options "noprefix", "xattr", "clone_children", "release_agent" | ||
| 490 | * and "name" are disallowed. | ||
| 491 | * | ||
| 492 | * - When mounting an existing superblock, mount options should match. | ||
| 493 | * | ||
| 494 | * - Remount is disallowed. | ||
| 495 | * | ||
| 496 | * - rename(2) is disallowed. | ||
| 497 | * | ||
| 498 | * - "tasks" is removed. Everything should be at process granularity. Use | ||
| 499 | * "cgroup.procs" instead. | ||
| 500 | * | ||
| 501 | * - "cgroup.procs" is not sorted. pids will be unique unless they got | ||
| 502 | * recycled inbetween reads. | ||
| 503 | * | ||
| 504 | * - "release_agent" and "notify_on_release" are removed. Replacement | ||
| 505 | * notification mechanism will be implemented. | ||
| 506 | * | ||
| 507 | * - "cgroup.clone_children" is removed. | ||
| 508 | * | ||
| 509 | * - "cgroup.subtree_populated" is available. Its value is 0 if the cgroup | ||
| 510 | * and its descendants contain no task; otherwise, 1. The file also | ||
| 511 | * generates kernfs notification which can be monitored through poll and | ||
| 512 | * [di]notify when the value of the file changes. | ||
| 513 | * | ||
| 514 | * - cpuset: tasks will be kept in empty cpusets when hotplug happens and | ||
| 515 | * take masks of ancestors with non-empty cpus/mems, instead of being | ||
| 516 | * moved to an ancestor. | ||
| 517 | * | ||
| 518 | * - cpuset: a task can be moved into an empty cpuset, and again it takes | ||
| 519 | * masks of ancestors. | ||
| 520 | * | ||
| 521 | * - memcg: use_hierarchy is on by default and the cgroup file for the flag | ||
| 522 | * is not created. | ||
| 523 | * | ||
| 524 | * - blkcg: blk-throttle becomes properly hierarchical. | ||
| 525 | * | ||
| 526 | * - debug: disallowed on the default hierarchy. | ||
| 527 | */ | ||
| 529 | static inline bool cgroup_on_dfl(const struct cgroup *cgrp) | 528 | static inline bool cgroup_on_dfl(const struct cgroup *cgrp) |
| 530 | { | 529 | { |
| 531 | return cgrp->root == &cgrp_dfl_root; | 530 | return cgrp->root == &cgrp_dfl_root; |
| 532 | } | 531 | } |
| 533 | 532 | ||
| 534 | /* | ||
| 535 | * See the comment above CGRP_ROOT_SANE_BEHAVIOR for details. This | ||
| 536 | * function can be called as long as @cgrp is accessible. | ||
| 537 | */ | ||
| 538 | static inline bool cgroup_sane_behavior(const struct cgroup *cgrp) | ||
| 539 | { | ||
| 540 | return cgrp->root->flags & CGRP_ROOT_SANE_BEHAVIOR; | ||
| 541 | } | ||
| 542 | |||
| 543 | /* no synchronization, the result can only be used as a hint */ | 533 | /* no synchronization, the result can only be used as a hint */ |
| 544 | static inline bool cgroup_has_tasks(struct cgroup *cgrp) | 534 | static inline bool cgroup_has_tasks(struct cgroup *cgrp) |
| 545 | { | 535 | { |
| @@ -602,7 +592,8 @@ static inline void pr_cont_cgroup_path(struct cgroup *cgrp) | |||
| 602 | 592 | ||
| 603 | char *task_cgroup_path(struct task_struct *task, char *buf, size_t buflen); | 593 | char *task_cgroup_path(struct task_struct *task, char *buf, size_t buflen); |
| 604 | 594 | ||
| 605 | int cgroup_add_cftypes(struct cgroup_subsys *ss, struct cftype *cfts); | 595 | int cgroup_add_dfl_cftypes(struct cgroup_subsys *ss, struct cftype *cfts); |
| 596 | int cgroup_add_legacy_cftypes(struct cgroup_subsys *ss, struct cftype *cfts); | ||
| 606 | int cgroup_rm_cftypes(struct cftype *cfts); | 597 | int cgroup_rm_cftypes(struct cftype *cfts); |
| 607 | 598 | ||
| 608 | bool cgroup_is_descendant(struct cgroup *cgrp, struct cgroup *ancestor); | 599 | bool cgroup_is_descendant(struct cgroup *cgrp, struct cgroup *ancestor); |
| @@ -634,6 +625,7 @@ struct cgroup_subsys { | |||
| 634 | int (*css_online)(struct cgroup_subsys_state *css); | 625 | int (*css_online)(struct cgroup_subsys_state *css); |
| 635 | void (*css_offline)(struct cgroup_subsys_state *css); | 626 | void (*css_offline)(struct cgroup_subsys_state *css); |
| 636 | void (*css_free)(struct cgroup_subsys_state *css); | 627 | void (*css_free)(struct cgroup_subsys_state *css); |
| 628 | void (*css_reset)(struct cgroup_subsys_state *css); | ||
| 637 | 629 | ||
| 638 | int (*can_attach)(struct cgroup_subsys_state *css, | 630 | int (*can_attach)(struct cgroup_subsys_state *css, |
| 639 | struct cgroup_taskset *tset); | 631 | struct cgroup_taskset *tset); |
| @@ -682,8 +674,21 @@ struct cgroup_subsys { | |||
| 682 | */ | 674 | */ |
| 683 | struct list_head cfts; | 675 | struct list_head cfts; |
| 684 | 676 | ||
| 685 | /* base cftypes, automatically registered with subsys itself */ | 677 | /* |
| 686 | struct cftype *base_cftypes; | 678 | * Base cftypes which are automatically registered. The two can |
| 679 | * point to the same array. | ||
| 680 | */ | ||
| 681 | struct cftype *dfl_cftypes; /* for the default hierarchy */ | ||
| 682 | struct cftype *legacy_cftypes; /* for the legacy hierarchies */ | ||
| 683 | |||
| 684 | /* | ||
| 685 | * A subsystem may depend on other subsystems. When such subsystem | ||
| 686 | * is enabled on a cgroup, the depended-upon subsystems are enabled | ||
| 687 | * together if available. Subsystems enabled due to dependency are | ||
| 688 | * not visible to userland until explicitly enabled. The following | ||
| 689 | * specifies the mask of subsystems that this one depends on. | ||
| 690 | */ | ||
| 691 | unsigned int depends_on; | ||
| 687 | }; | 692 | }; |
| 688 | 693 | ||
| 689 | #define SUBSYS(_x) extern struct cgroup_subsys _x ## _cgrp_subsys; | 694 | #define SUBSYS(_x) extern struct cgroup_subsys _x ## _cgrp_subsys; |
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index 0c287dbbb144..411dd7eb2653 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h | |||
| @@ -619,5 +619,10 @@ static inline void clk_writel(u32 val, u32 __iomem *reg) | |||
| 619 | 619 | ||
| 620 | #endif /* platform dependent I/O accessors */ | 620 | #endif /* platform dependent I/O accessors */ |
| 621 | 621 | ||
| 622 | #ifdef CONFIG_DEBUG_FS | ||
| 623 | struct dentry *clk_debugfs_add_file(struct clk *clk, char *name, umode_t mode, | ||
| 624 | void *data, const struct file_operations *fops); | ||
| 625 | #endif | ||
| 626 | |||
| 622 | #endif /* CONFIG_COMMON_CLK */ | 627 | #endif /* CONFIG_COMMON_CLK */ |
| 623 | #endif /* CLK_PROVIDER_H */ | 628 | #endif /* CLK_PROVIDER_H */ |
diff --git a/include/linux/clk/clk-conf.h b/include/linux/clk/clk-conf.h new file mode 100644 index 000000000000..f3050e15f833 --- /dev/null +++ b/include/linux/clk/clk-conf.h | |||
| @@ -0,0 +1,20 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2014 Samsung Electronics Co., Ltd. | ||
| 3 | * Sylwester Nawrocki <s.nawrocki@samsung.com> | ||
| 4 | * | ||
| 5 | * This program is free software; you can redistribute it and/or modify | ||
| 6 | * it under the terms of the GNU General Public License version 2 as | ||
| 7 | * published by the Free Software Foundation. | ||
| 8 | */ | ||
| 9 | |||
| 10 | struct device_node; | ||
| 11 | |||
| 12 | #if defined(CONFIG_OF) && defined(CONFIG_COMMON_CLK) | ||
| 13 | int of_clk_set_defaults(struct device_node *node, bool clk_supplier); | ||
| 14 | #else | ||
| 15 | static inline int of_clk_set_defaults(struct device_node *node, | ||
| 16 | bool clk_supplier) | ||
| 17 | { | ||
| 18 | return 0; | ||
| 19 | } | ||
| 20 | #endif | ||
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h index a16b497d5159..653f0e2b6ca9 100644 --- a/include/linux/clocksource.h +++ b/include/linux/clocksource.h | |||
| @@ -162,7 +162,6 @@ extern u64 timecounter_cyc2time(struct timecounter *tc, | |||
| 162 | * @archdata: arch-specific data | 162 | * @archdata: arch-specific data |
| 163 | * @suspend: suspend function for the clocksource, if necessary | 163 | * @suspend: suspend function for the clocksource, if necessary |
| 164 | * @resume: resume function for the clocksource, if necessary | 164 | * @resume: resume function for the clocksource, if necessary |
| 165 | * @cycle_last: most recent cycle counter value seen by ::read() | ||
| 166 | * @owner: module reference, must be set by clocksource in modules | 165 | * @owner: module reference, must be set by clocksource in modules |
| 167 | */ | 166 | */ |
| 168 | struct clocksource { | 167 | struct clocksource { |
| @@ -171,7 +170,6 @@ struct clocksource { | |||
| 171 | * clocksource itself is cacheline aligned. | 170 | * clocksource itself is cacheline aligned. |
| 172 | */ | 171 | */ |
| 173 | cycle_t (*read)(struct clocksource *cs); | 172 | cycle_t (*read)(struct clocksource *cs); |
| 174 | cycle_t cycle_last; | ||
| 175 | cycle_t mask; | 173 | cycle_t mask; |
| 176 | u32 mult; | 174 | u32 mult; |
| 177 | u32 shift; | 175 | u32 shift; |
diff --git a/include/linux/component.h b/include/linux/component.h index 68870182ca1e..c00dcc302611 100644 --- a/include/linux/component.h +++ b/include/linux/component.h | |||
| @@ -29,4 +29,11 @@ void component_master_del(struct device *, | |||
| 29 | int component_master_add_child(struct master *master, | 29 | int component_master_add_child(struct master *master, |
| 30 | int (*compare)(struct device *, void *), void *compare_data); | 30 | int (*compare)(struct device *, void *), void *compare_data); |
| 31 | 31 | ||
| 32 | struct component_match; | ||
| 33 | |||
| 34 | int component_master_add_with_match(struct device *, | ||
| 35 | const struct component_master_ops *, struct component_match *); | ||
| 36 | void component_match_add(struct device *, struct component_match **, | ||
| 37 | int (*compare)(struct device *, void *), void *compare_data); | ||
| 38 | |||
| 32 | #endif | 39 | #endif |
diff --git a/include/linux/cper.h b/include/linux/cper.h index 2fc0ec3d89cc..76abba4b238e 100644 --- a/include/linux/cper.h +++ b/include/linux/cper.h | |||
| @@ -22,6 +22,7 @@ | |||
| 22 | #define LINUX_CPER_H | 22 | #define LINUX_CPER_H |
| 23 | 23 | ||
| 24 | #include <linux/uuid.h> | 24 | #include <linux/uuid.h> |
| 25 | #include <linux/trace_seq.h> | ||
| 25 | 26 | ||
| 26 | /* CPER record signature and the size */ | 27 | /* CPER record signature and the size */ |
| 27 | #define CPER_SIG_RECORD "CPER" | 28 | #define CPER_SIG_RECORD "CPER" |
| @@ -36,6 +37,13 @@ | |||
| 36 | #define CPER_RECORD_REV 0x0100 | 37 | #define CPER_RECORD_REV 0x0100 |
| 37 | 38 | ||
| 38 | /* | 39 | /* |
| 40 | * CPER record length contains the CPER fields which are relevant for further | ||
| 41 | * handling of a memory error in userspace (we don't carry all the fields | ||
| 42 | * defined in the UEFI spec because some of them don't make any sense.) | ||
| 43 | * Currently, a length of 256 should be more than enough. | ||
| 44 | */ | ||
| 45 | #define CPER_REC_LEN 256 | ||
| 46 | /* | ||
| 39 | * Severity difinition for error_severity in struct cper_record_header | 47 | * Severity difinition for error_severity in struct cper_record_header |
| 40 | * and section_severity in struct cper_section_descriptor | 48 | * and section_severity in struct cper_section_descriptor |
| 41 | */ | 49 | */ |
| @@ -356,6 +364,24 @@ struct cper_sec_mem_err { | |||
| 356 | __u16 mem_dev_handle; /* module handle in UEFI 2.4 */ | 364 | __u16 mem_dev_handle; /* module handle in UEFI 2.4 */ |
| 357 | }; | 365 | }; |
| 358 | 366 | ||
| 367 | struct cper_mem_err_compact { | ||
| 368 | __u64 validation_bits; | ||
| 369 | __u16 node; | ||
| 370 | __u16 card; | ||
| 371 | __u16 module; | ||
| 372 | __u16 bank; | ||
| 373 | __u16 device; | ||
| 374 | __u16 row; | ||
| 375 | __u16 column; | ||
| 376 | __u16 bit_pos; | ||
| 377 | __u64 requestor_id; | ||
| 378 | __u64 responder_id; | ||
| 379 | __u64 target_id; | ||
| 380 | __u16 rank; | ||
| 381 | __u16 mem_array_handle; | ||
| 382 | __u16 mem_dev_handle; | ||
| 383 | }; | ||
| 384 | |||
| 359 | struct cper_sec_pcie { | 385 | struct cper_sec_pcie { |
| 360 | __u64 validation_bits; | 386 | __u64 validation_bits; |
| 361 | __u32 port_type; | 387 | __u32 port_type; |
| @@ -395,7 +421,13 @@ struct cper_sec_pcie { | |||
| 395 | #pragma pack() | 421 | #pragma pack() |
| 396 | 422 | ||
| 397 | u64 cper_next_record_id(void); | 423 | u64 cper_next_record_id(void); |
| 424 | const char *cper_severity_str(unsigned int); | ||
| 425 | const char *cper_mem_err_type_str(unsigned int); | ||
| 398 | void cper_print_bits(const char *prefix, unsigned int bits, | 426 | void cper_print_bits(const char *prefix, unsigned int bits, |
| 399 | const char * const strs[], unsigned int strs_size); | 427 | const char * const strs[], unsigned int strs_size); |
| 428 | void cper_mem_err_pack(const struct cper_sec_mem_err *, | ||
| 429 | struct cper_mem_err_compact *); | ||
| 430 | const char *cper_mem_err_unpack(struct trace_seq *, | ||
| 431 | struct cper_mem_err_compact *); | ||
| 400 | 432 | ||
| 401 | #endif | 433 | #endif |
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index 8f8ae95c6e27..7d1955afa62c 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h | |||
| @@ -176,6 +176,7 @@ static inline void disable_cpufreq(void) { } | |||
| 176 | 176 | ||
| 177 | #define CPUFREQ_RELATION_L 0 /* lowest frequency at or above target */ | 177 | #define CPUFREQ_RELATION_L 0 /* lowest frequency at or above target */ |
| 178 | #define CPUFREQ_RELATION_H 1 /* highest frequency below or at target */ | 178 | #define CPUFREQ_RELATION_H 1 /* highest frequency below or at target */ |
| 179 | #define CPUFREQ_RELATION_C 2 /* closest frequency to target */ | ||
| 179 | 180 | ||
| 180 | struct freq_attr { | 181 | struct freq_attr { |
| 181 | struct attribute attr; | 182 | struct attribute attr; |
diff --git a/include/linux/crc32.h b/include/linux/crc32.h index 7d275c4fc011..9e8a032c1788 100644 --- a/include/linux/crc32.h +++ b/include/linux/crc32.h | |||
| @@ -8,8 +8,8 @@ | |||
| 8 | #include <linux/types.h> | 8 | #include <linux/types.h> |
| 9 | #include <linux/bitrev.h> | 9 | #include <linux/bitrev.h> |
| 10 | 10 | ||
| 11 | extern u32 crc32_le(u32 crc, unsigned char const *p, size_t len); | 11 | u32 __pure crc32_le(u32 crc, unsigned char const *p, size_t len); |
| 12 | extern u32 crc32_be(u32 crc, unsigned char const *p, size_t len); | 12 | u32 __pure crc32_be(u32 crc, unsigned char const *p, size_t len); |
| 13 | 13 | ||
| 14 | /** | 14 | /** |
| 15 | * crc32_le_combine - Combine two crc32 check values into one. For two | 15 | * crc32_le_combine - Combine two crc32 check values into one. For two |
| @@ -29,9 +29,14 @@ extern u32 crc32_be(u32 crc, unsigned char const *p, size_t len); | |||
| 29 | * with the same initializer as crc1, and crc2 seed was 0. See | 29 | * with the same initializer as crc1, and crc2 seed was 0. See |
| 30 | * also crc32_combine_test(). | 30 | * also crc32_combine_test(). |
| 31 | */ | 31 | */ |
| 32 | extern u32 crc32_le_combine(u32 crc1, u32 crc2, size_t len2); | 32 | u32 __attribute_const__ crc32_le_shift(u32 crc, size_t len); |
| 33 | 33 | ||
| 34 | extern u32 __crc32c_le(u32 crc, unsigned char const *p, size_t len); | 34 | static inline u32 crc32_le_combine(u32 crc1, u32 crc2, size_t len2) |
| 35 | { | ||
| 36 | return crc32_le_shift(crc1, len2) ^ crc2; | ||
| 37 | } | ||
| 38 | |||
| 39 | u32 __pure __crc32c_le(u32 crc, unsigned char const *p, size_t len); | ||
| 35 | 40 | ||
| 36 | /** | 41 | /** |
| 37 | * __crc32c_le_combine - Combine two crc32c check values into one. For two | 42 | * __crc32c_le_combine - Combine two crc32c check values into one. For two |
| @@ -51,7 +56,12 @@ extern u32 __crc32c_le(u32 crc, unsigned char const *p, size_t len); | |||
| 51 | * seeded with the same initializer as crc1, and crc2 seed | 56 | * seeded with the same initializer as crc1, and crc2 seed |
| 52 | * was 0. See also crc32c_combine_test(). | 57 | * was 0. See also crc32c_combine_test(). |
| 53 | */ | 58 | */ |
| 54 | extern u32 __crc32c_le_combine(u32 crc1, u32 crc2, size_t len2); | 59 | u32 __attribute_const__ __crc32c_le_shift(u32 crc, size_t len); |
| 60 | |||
| 61 | static inline u32 __crc32c_le_combine(u32 crc1, u32 crc2, size_t len2) | ||
| 62 | { | ||
| 63 | return __crc32c_le_shift(crc1, len2) ^ crc2; | ||
| 64 | } | ||
| 55 | 65 | ||
| 56 | #define crc32(seed, data, length) crc32_le(seed, (unsigned char const *)(data), length) | 66 | #define crc32(seed, data, length) crc32_le(seed, (unsigned char const *)(data), length) |
| 57 | 67 | ||
diff --git a/include/linux/crypto.h b/include/linux/crypto.h index b92eadf92d72..d45e949699ea 100644 --- a/include/linux/crypto.h +++ b/include/linux/crypto.h | |||
| @@ -710,9 +710,9 @@ static inline void ablkcipher_request_free(struct ablkcipher_request *req) | |||
| 710 | 710 | ||
| 711 | static inline void ablkcipher_request_set_callback( | 711 | static inline void ablkcipher_request_set_callback( |
| 712 | struct ablkcipher_request *req, | 712 | struct ablkcipher_request *req, |
| 713 | u32 flags, crypto_completion_t complete, void *data) | 713 | u32 flags, crypto_completion_t compl, void *data) |
| 714 | { | 714 | { |
| 715 | req->base.complete = complete; | 715 | req->base.complete = compl; |
| 716 | req->base.data = data; | 716 | req->base.data = data; |
| 717 | req->base.flags = flags; | 717 | req->base.flags = flags; |
| 718 | } | 718 | } |
| @@ -841,10 +841,10 @@ static inline void aead_request_free(struct aead_request *req) | |||
| 841 | 841 | ||
| 842 | static inline void aead_request_set_callback(struct aead_request *req, | 842 | static inline void aead_request_set_callback(struct aead_request *req, |
| 843 | u32 flags, | 843 | u32 flags, |
| 844 | crypto_completion_t complete, | 844 | crypto_completion_t compl, |
| 845 | void *data) | 845 | void *data) |
| 846 | { | 846 | { |
| 847 | req->base.complete = complete; | 847 | req->base.complete = compl; |
| 848 | req->base.data = data; | 848 | req->base.data = data; |
| 849 | req->base.flags = flags; | 849 | req->base.flags = flags; |
| 850 | } | 850 | } |
diff --git a/include/linux/device.h b/include/linux/device.h index af424acd393d..43d183aeb25b 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
| @@ -124,7 +124,7 @@ struct bus_type { | |||
| 124 | 124 | ||
| 125 | const struct dev_pm_ops *pm; | 125 | const struct dev_pm_ops *pm; |
| 126 | 126 | ||
| 127 | struct iommu_ops *iommu_ops; | 127 | const struct iommu_ops *iommu_ops; |
| 128 | 128 | ||
| 129 | struct subsys_private *p; | 129 | struct subsys_private *p; |
| 130 | struct lock_class_key lock_key; | 130 | struct lock_class_key lock_key; |
| @@ -605,6 +605,10 @@ extern int devres_release_group(struct device *dev, void *id); | |||
| 605 | 605 | ||
| 606 | /* managed devm_k.alloc/kfree for device drivers */ | 606 | /* managed devm_k.alloc/kfree for device drivers */ |
| 607 | extern void *devm_kmalloc(struct device *dev, size_t size, gfp_t gfp); | 607 | extern void *devm_kmalloc(struct device *dev, size_t size, gfp_t gfp); |
| 608 | extern char *devm_kvasprintf(struct device *dev, gfp_t gfp, const char *fmt, | ||
| 609 | va_list ap); | ||
| 610 | extern char *devm_kasprintf(struct device *dev, gfp_t gfp, | ||
| 611 | const char *fmt, ...); | ||
| 608 | static inline void *devm_kzalloc(struct device *dev, size_t size, gfp_t gfp) | 612 | static inline void *devm_kzalloc(struct device *dev, size_t size, gfp_t gfp) |
| 609 | { | 613 | { |
| 610 | return devm_kmalloc(dev, size, gfp | __GFP_ZERO); | 614 | return devm_kmalloc(dev, size, gfp | __GFP_ZERO); |
| @@ -631,8 +635,6 @@ extern unsigned long devm_get_free_pages(struct device *dev, | |||
| 631 | extern void devm_free_pages(struct device *dev, unsigned long addr); | 635 | extern void devm_free_pages(struct device *dev, unsigned long addr); |
| 632 | 636 | ||
| 633 | void __iomem *devm_ioremap_resource(struct device *dev, struct resource *res); | 637 | void __iomem *devm_ioremap_resource(struct device *dev, struct resource *res); |
| 634 | void __iomem *devm_request_and_ioremap(struct device *dev, | ||
| 635 | struct resource *res); | ||
| 636 | 638 | ||
| 637 | /* allows to add/remove a custom action to devres stack */ | 639 | /* allows to add/remove a custom action to devres stack */ |
| 638 | int devm_add_action(struct device *dev, void (*action)(void *), void *data); | 640 | int devm_add_action(struct device *dev, void (*action)(void *), void *data); |
diff --git a/include/linux/dma-buf.h b/include/linux/dma-buf.h index f886985a28b2..694e1fe1c4b4 100644 --- a/include/linux/dma-buf.h +++ b/include/linux/dma-buf.h | |||
| @@ -30,6 +30,8 @@ | |||
| 30 | #include <linux/list.h> | 30 | #include <linux/list.h> |
| 31 | #include <linux/dma-mapping.h> | 31 | #include <linux/dma-mapping.h> |
| 32 | #include <linux/fs.h> | 32 | #include <linux/fs.h> |
| 33 | #include <linux/fence.h> | ||
| 34 | #include <linux/wait.h> | ||
| 33 | 35 | ||
| 34 | struct device; | 36 | struct device; |
| 35 | struct dma_buf; | 37 | struct dma_buf; |
| @@ -115,6 +117,7 @@ struct dma_buf_ops { | |||
| 115 | * @exp_name: name of the exporter; useful for debugging. | 117 | * @exp_name: name of the exporter; useful for debugging. |
| 116 | * @list_node: node for dma_buf accounting and debugging. | 118 | * @list_node: node for dma_buf accounting and debugging. |
| 117 | * @priv: exporter specific private data for this buffer object. | 119 | * @priv: exporter specific private data for this buffer object. |
| 120 | * @resv: reservation object linked to this dma-buf | ||
| 118 | */ | 121 | */ |
| 119 | struct dma_buf { | 122 | struct dma_buf { |
| 120 | size_t size; | 123 | size_t size; |
| @@ -128,6 +131,17 @@ struct dma_buf { | |||
| 128 | const char *exp_name; | 131 | const char *exp_name; |
| 129 | struct list_head list_node; | 132 | struct list_head list_node; |
| 130 | void *priv; | 133 | void *priv; |
| 134 | struct reservation_object *resv; | ||
| 135 | |||
| 136 | /* poll support */ | ||
| 137 | wait_queue_head_t poll; | ||
| 138 | |||
| 139 | struct dma_buf_poll_cb_t { | ||
| 140 | struct fence_cb cb; | ||
| 141 | wait_queue_head_t *poll; | ||
| 142 | |||
| 143 | unsigned long active; | ||
| 144 | } cb_excl, cb_shared; | ||
| 131 | }; | 145 | }; |
| 132 | 146 | ||
| 133 | /** | 147 | /** |
| @@ -168,10 +182,11 @@ void dma_buf_detach(struct dma_buf *dmabuf, | |||
| 168 | struct dma_buf_attachment *dmabuf_attach); | 182 | struct dma_buf_attachment *dmabuf_attach); |
| 169 | 183 | ||
| 170 | struct dma_buf *dma_buf_export_named(void *priv, const struct dma_buf_ops *ops, | 184 | struct dma_buf *dma_buf_export_named(void *priv, const struct dma_buf_ops *ops, |
| 171 | size_t size, int flags, const char *); | 185 | size_t size, int flags, const char *, |
| 186 | struct reservation_object *); | ||
| 172 | 187 | ||
| 173 | #define dma_buf_export(priv, ops, size, flags) \ | 188 | #define dma_buf_export(priv, ops, size, flags, resv) \ |
| 174 | dma_buf_export_named(priv, ops, size, flags, KBUILD_MODNAME) | 189 | dma_buf_export_named(priv, ops, size, flags, KBUILD_MODNAME, resv) |
| 175 | 190 | ||
| 176 | int dma_buf_fd(struct dma_buf *dmabuf, int flags); | 191 | int dma_buf_fd(struct dma_buf *dmabuf, int flags); |
| 177 | struct dma_buf *dma_buf_get(int fd); | 192 | struct dma_buf *dma_buf_get(int fd); |
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h index d2c5cc7c583c..3d1c2aa51530 100644 --- a/include/linux/dmaengine.h +++ b/include/linux/dmaengine.h | |||
| @@ -299,6 +299,7 @@ enum dma_slave_buswidth { | |||
| 299 | DMA_SLAVE_BUSWIDTH_UNDEFINED = 0, | 299 | DMA_SLAVE_BUSWIDTH_UNDEFINED = 0, |
| 300 | DMA_SLAVE_BUSWIDTH_1_BYTE = 1, | 300 | DMA_SLAVE_BUSWIDTH_1_BYTE = 1, |
| 301 | DMA_SLAVE_BUSWIDTH_2_BYTES = 2, | 301 | DMA_SLAVE_BUSWIDTH_2_BYTES = 2, |
| 302 | DMA_SLAVE_BUSWIDTH_3_BYTES = 3, | ||
| 302 | DMA_SLAVE_BUSWIDTH_4_BYTES = 4, | 303 | DMA_SLAVE_BUSWIDTH_4_BYTES = 4, |
| 303 | DMA_SLAVE_BUSWIDTH_8_BYTES = 8, | 304 | DMA_SLAVE_BUSWIDTH_8_BYTES = 8, |
| 304 | }; | 305 | }; |
diff --git a/include/linux/dmar.h b/include/linux/dmar.h index 23c8db129560..1deece46a0ca 100644 --- a/include/linux/dmar.h +++ b/include/linux/dmar.h | |||
| @@ -114,22 +114,30 @@ extern int dmar_remove_dev_scope(struct dmar_pci_notify_info *info, | |||
| 114 | /* Intel IOMMU detection */ | 114 | /* Intel IOMMU detection */ |
| 115 | extern int detect_intel_iommu(void); | 115 | extern int detect_intel_iommu(void); |
| 116 | extern int enable_drhd_fault_handling(void); | 116 | extern int enable_drhd_fault_handling(void); |
| 117 | #else | 117 | |
| 118 | struct dmar_pci_notify_info; | 118 | #ifdef CONFIG_INTEL_IOMMU |
| 119 | static inline int detect_intel_iommu(void) | 119 | extern int iommu_detected, no_iommu; |
| 120 | extern int intel_iommu_init(void); | ||
| 121 | extern int dmar_parse_one_rmrr(struct acpi_dmar_header *header); | ||
| 122 | extern int dmar_parse_one_atsr(struct acpi_dmar_header *header); | ||
| 123 | extern int dmar_iommu_notify_scope_dev(struct dmar_pci_notify_info *info); | ||
| 124 | #else /* !CONFIG_INTEL_IOMMU: */ | ||
| 125 | static inline int intel_iommu_init(void) { return -ENODEV; } | ||
| 126 | static inline int dmar_parse_one_rmrr(struct acpi_dmar_header *header) | ||
| 120 | { | 127 | { |
| 121 | return -ENODEV; | 128 | return 0; |
| 122 | } | 129 | } |
| 123 | 130 | static inline int dmar_parse_one_atsr(struct acpi_dmar_header *header) | |
| 124 | static inline int dmar_table_init(void) | ||
| 125 | { | 131 | { |
| 126 | return -ENODEV; | 132 | return 0; |
| 127 | } | 133 | } |
| 128 | static inline int enable_drhd_fault_handling(void) | 134 | static inline int dmar_iommu_notify_scope_dev(struct dmar_pci_notify_info *info) |
| 129 | { | 135 | { |
| 130 | return -1; | 136 | return 0; |
| 131 | } | 137 | } |
| 132 | #endif /* !CONFIG_DMAR_TABLE */ | 138 | #endif /* CONFIG_INTEL_IOMMU */ |
| 139 | |||
| 140 | #endif /* CONFIG_DMAR_TABLE */ | ||
| 133 | 141 | ||
| 134 | struct irte { | 142 | struct irte { |
| 135 | union { | 143 | union { |
| @@ -177,26 +185,4 @@ extern int dmar_set_interrupt(struct intel_iommu *iommu); | |||
| 177 | extern irqreturn_t dmar_fault(int irq, void *dev_id); | 185 | extern irqreturn_t dmar_fault(int irq, void *dev_id); |
| 178 | extern int arch_setup_dmar_msi(unsigned int irq); | 186 | extern int arch_setup_dmar_msi(unsigned int irq); |
| 179 | 187 | ||
| 180 | #ifdef CONFIG_INTEL_IOMMU | ||
| 181 | extern int iommu_detected, no_iommu; | ||
| 182 | extern int dmar_parse_one_rmrr(struct acpi_dmar_header *header); | ||
| 183 | extern int dmar_parse_one_atsr(struct acpi_dmar_header *header); | ||
| 184 | extern int dmar_iommu_notify_scope_dev(struct dmar_pci_notify_info *info); | ||
| 185 | extern int intel_iommu_init(void); | ||
| 186 | #else /* !CONFIG_INTEL_IOMMU: */ | ||
| 187 | static inline int intel_iommu_init(void) { return -ENODEV; } | ||
| 188 | static inline int dmar_parse_one_rmrr(struct acpi_dmar_header *header) | ||
| 189 | { | ||
| 190 | return 0; | ||
| 191 | } | ||
| 192 | static inline int dmar_parse_one_atsr(struct acpi_dmar_header *header) | ||
| 193 | { | ||
| 194 | return 0; | ||
| 195 | } | ||
| 196 | static inline int dmar_iommu_notify_scope_dev(struct dmar_pci_notify_info *info) | ||
| 197 | { | ||
| 198 | return 0; | ||
| 199 | } | ||
| 200 | #endif /* CONFIG_INTEL_IOMMU */ | ||
| 201 | |||
| 202 | #endif /* __DMAR_H__ */ | 188 | #endif /* __DMAR_H__ */ |
diff --git a/include/linux/efi.h b/include/linux/efi.h index 41bbf8ba4ba8..efc681fd5895 100644 --- a/include/linux/efi.h +++ b/include/linux/efi.h | |||
| @@ -20,6 +20,7 @@ | |||
| 20 | #include <linux/ioport.h> | 20 | #include <linux/ioport.h> |
| 21 | #include <linux/pfn.h> | 21 | #include <linux/pfn.h> |
| 22 | #include <linux/pstore.h> | 22 | #include <linux/pstore.h> |
| 23 | #include <linux/reboot.h> | ||
| 23 | 24 | ||
| 24 | #include <asm/page.h> | 25 | #include <asm/page.h> |
| 25 | 26 | ||
| @@ -521,6 +522,8 @@ typedef efi_status_t efi_query_capsule_caps_t(efi_capsule_header_t **capsules, | |||
| 521 | int *reset_type); | 522 | int *reset_type); |
| 522 | typedef efi_status_t efi_query_variable_store_t(u32 attributes, unsigned long size); | 523 | typedef efi_status_t efi_query_variable_store_t(u32 attributes, unsigned long size); |
| 523 | 524 | ||
| 525 | void efi_native_runtime_setup(void); | ||
| 526 | |||
| 524 | /* | 527 | /* |
| 525 | * EFI Configuration Table and GUID definitions | 528 | * EFI Configuration Table and GUID definitions |
| 526 | */ | 529 | */ |
| @@ -870,11 +873,13 @@ extern int __init efi_uart_console_only (void); | |||
| 870 | extern void efi_initialize_iomem_resources(struct resource *code_resource, | 873 | extern void efi_initialize_iomem_resources(struct resource *code_resource, |
| 871 | struct resource *data_resource, struct resource *bss_resource); | 874 | struct resource *data_resource, struct resource *bss_resource); |
| 872 | extern void efi_get_time(struct timespec *now); | 875 | extern void efi_get_time(struct timespec *now); |
| 873 | extern int efi_set_rtc_mmss(const struct timespec *now); | ||
| 874 | extern void efi_reserve_boot_services(void); | 876 | extern void efi_reserve_boot_services(void); |
| 875 | extern int efi_get_fdt_params(struct efi_fdt_params *params, int verbose); | 877 | extern int efi_get_fdt_params(struct efi_fdt_params *params, int verbose); |
| 876 | extern struct efi_memory_map memmap; | 878 | extern struct efi_memory_map memmap; |
| 877 | 879 | ||
| 880 | extern int efi_reboot_quirk_mode; | ||
| 881 | extern bool efi_poweroff_required(void); | ||
| 882 | |||
| 878 | /* Iterate through an efi_memory_map */ | 883 | /* Iterate through an efi_memory_map */ |
| 879 | #define for_each_efi_memory_desc(m, md) \ | 884 | #define for_each_efi_memory_desc(m, md) \ |
| 880 | for ((md) = (m)->map; \ | 885 | for ((md) = (m)->map; \ |
| @@ -916,7 +921,8 @@ extern int __init efi_setup_pcdp_console(char *); | |||
| 916 | #define EFI_RUNTIME_SERVICES 3 /* Can we use runtime services? */ | 921 | #define EFI_RUNTIME_SERVICES 3 /* Can we use runtime services? */ |
| 917 | #define EFI_MEMMAP 4 /* Can we use EFI memory map? */ | 922 | #define EFI_MEMMAP 4 /* Can we use EFI memory map? */ |
| 918 | #define EFI_64BIT 5 /* Is the firmware 64-bit? */ | 923 | #define EFI_64BIT 5 /* Is the firmware 64-bit? */ |
| 919 | #define EFI_ARCH_1 6 /* First arch-specific bit */ | 924 | #define EFI_PARAVIRT 6 /* Access is via a paravirt interface */ |
| 925 | #define EFI_ARCH_1 7 /* First arch-specific bit */ | ||
| 920 | 926 | ||
| 921 | #ifdef CONFIG_EFI | 927 | #ifdef CONFIG_EFI |
| 922 | /* | 928 | /* |
| @@ -926,11 +932,14 @@ static inline bool efi_enabled(int feature) | |||
| 926 | { | 932 | { |
| 927 | return test_bit(feature, &efi.flags) != 0; | 933 | return test_bit(feature, &efi.flags) != 0; |
| 928 | } | 934 | } |
| 935 | extern void efi_reboot(enum reboot_mode reboot_mode, const char *__unused); | ||
| 929 | #else | 936 | #else |
| 930 | static inline bool efi_enabled(int feature) | 937 | static inline bool efi_enabled(int feature) |
| 931 | { | 938 | { |
| 932 | return false; | 939 | return false; |
| 933 | } | 940 | } |
| 941 | static inline void | ||
| 942 | efi_reboot(enum reboot_mode reboot_mode, const char *__unused) {} | ||
| 934 | #endif | 943 | #endif |
| 935 | 944 | ||
| 936 | /* | 945 | /* |
| @@ -1031,12 +1040,8 @@ struct efivar_operations { | |||
| 1031 | struct efivars { | 1040 | struct efivars { |
| 1032 | /* | 1041 | /* |
| 1033 | * ->lock protects two things: | 1042 | * ->lock protects two things: |
| 1034 | * 1) ->list - adds, removals, reads, writes | 1043 | * 1) efivarfs_list and efivars_sysfs_list |
| 1035 | * 2) ops.[gs]et_variable() calls. | 1044 | * 2) ->ops calls |
| 1036 | * It must not be held when creating sysfs entries or calling kmalloc. | ||
| 1037 | * ops.get_next_variable() is only called from register_efivars() | ||
| 1038 | * or efivar_update_sysfs_entries(), | ||
| 1039 | * which is protected by the BKL, so that path is safe. | ||
| 1040 | */ | 1045 | */ |
| 1041 | spinlock_t lock; | 1046 | spinlock_t lock; |
| 1042 | struct kset *kset; | 1047 | struct kset *kset; |
| @@ -1161,4 +1166,46 @@ static inline void | |||
| 1161 | efi_runtime_map_setup(void *map, int nr_entries, u32 desc_size) {} | 1166 | efi_runtime_map_setup(void *map, int nr_entries, u32 desc_size) {} |
| 1162 | #endif | 1167 | #endif |
| 1163 | 1168 | ||
| 1169 | /* prototypes shared between arch specific and generic stub code */ | ||
| 1170 | |||
| 1171 | #define pr_efi(sys_table, msg) efi_printk(sys_table, "EFI stub: "msg) | ||
| 1172 | #define pr_efi_err(sys_table, msg) efi_printk(sys_table, "EFI stub: ERROR: "msg) | ||
| 1173 | |||
| 1174 | void efi_printk(efi_system_table_t *sys_table_arg, char *str); | ||
| 1175 | |||
| 1176 | void efi_free(efi_system_table_t *sys_table_arg, unsigned long size, | ||
| 1177 | unsigned long addr); | ||
| 1178 | |||
| 1179 | char *efi_convert_cmdline(efi_system_table_t *sys_table_arg, | ||
| 1180 | efi_loaded_image_t *image, int *cmd_line_len); | ||
| 1181 | |||
| 1182 | efi_status_t efi_get_memory_map(efi_system_table_t *sys_table_arg, | ||
| 1183 | efi_memory_desc_t **map, | ||
| 1184 | unsigned long *map_size, | ||
| 1185 | unsigned long *desc_size, | ||
| 1186 | u32 *desc_ver, | ||
| 1187 | unsigned long *key_ptr); | ||
| 1188 | |||
| 1189 | efi_status_t efi_low_alloc(efi_system_table_t *sys_table_arg, | ||
| 1190 | unsigned long size, unsigned long align, | ||
| 1191 | unsigned long *addr); | ||
| 1192 | |||
| 1193 | efi_status_t efi_high_alloc(efi_system_table_t *sys_table_arg, | ||
| 1194 | unsigned long size, unsigned long align, | ||
| 1195 | unsigned long *addr, unsigned long max); | ||
| 1196 | |||
| 1197 | efi_status_t efi_relocate_kernel(efi_system_table_t *sys_table_arg, | ||
| 1198 | unsigned long *image_addr, | ||
| 1199 | unsigned long image_size, | ||
| 1200 | unsigned long alloc_size, | ||
| 1201 | unsigned long preferred_addr, | ||
| 1202 | unsigned long alignment); | ||
| 1203 | |||
| 1204 | efi_status_t handle_cmdline_files(efi_system_table_t *sys_table_arg, | ||
| 1205 | efi_loaded_image_t *image, | ||
| 1206 | char *cmd_line, char *option_string, | ||
| 1207 | unsigned long max_addr, | ||
| 1208 | unsigned long *load_addr, | ||
| 1209 | unsigned long *load_size); | ||
| 1210 | |||
| 1164 | #endif /* _LINUX_EFI_H */ | 1211 | #endif /* _LINUX_EFI_H */ |
diff --git a/include/linux/extcon/sm5502.h b/include/linux/extcon/sm5502.h new file mode 100644 index 000000000000..030526bf8d79 --- /dev/null +++ b/include/linux/extcon/sm5502.h | |||
| @@ -0,0 +1,287 @@ | |||
| 1 | /* | ||
| 2 | * sm5502.h | ||
| 3 | * | ||
| 4 | * Copyright (c) 2014 Samsung Electronics Co., Ltd | ||
| 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 | * 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 | |||
| 17 | #ifndef __LINUX_EXTCON_SM5502_H | ||
| 18 | #define __LINUX_EXTCON_SM5502_H | ||
| 19 | |||
| 20 | enum sm5502_types { | ||
| 21 | TYPE_SM5502, | ||
| 22 | }; | ||
| 23 | |||
| 24 | /* SM5502 registers */ | ||
| 25 | enum sm5502_reg { | ||
| 26 | SM5502_REG_DEVICE_ID = 0x01, | ||
| 27 | SM5502_REG_CONTROL, | ||
| 28 | SM5502_REG_INT1, | ||
| 29 | SM5502_REG_INT2, | ||
| 30 | SM5502_REG_INTMASK1, | ||
| 31 | SM5502_REG_INTMASK2, | ||
| 32 | SM5502_REG_ADC, | ||
| 33 | SM5502_REG_TIMING_SET1, | ||
| 34 | SM5502_REG_TIMING_SET2, | ||
| 35 | SM5502_REG_DEV_TYPE1, | ||
| 36 | SM5502_REG_DEV_TYPE2, | ||
| 37 | SM5502_REG_BUTTON1, | ||
| 38 | SM5502_REG_BUTTON2, | ||
| 39 | SM5502_REG_CAR_KIT_STATUS, | ||
| 40 | SM5502_REG_RSVD1, | ||
| 41 | SM5502_REG_RSVD2, | ||
| 42 | SM5502_REG_RSVD3, | ||
| 43 | SM5502_REG_RSVD4, | ||
| 44 | SM5502_REG_MANUAL_SW1, | ||
| 45 | SM5502_REG_MANUAL_SW2, | ||
| 46 | SM5502_REG_DEV_TYPE3, | ||
| 47 | SM5502_REG_RSVD5, | ||
| 48 | SM5502_REG_RSVD6, | ||
| 49 | SM5502_REG_RSVD7, | ||
| 50 | SM5502_REG_RSVD8, | ||
| 51 | SM5502_REG_RSVD9, | ||
| 52 | SM5502_REG_RESET, | ||
| 53 | SM5502_REG_RSVD10, | ||
| 54 | SM5502_REG_RESERVED_ID1, | ||
| 55 | SM5502_REG_RSVD11, | ||
| 56 | SM5502_REG_RSVD12, | ||
| 57 | SM5502_REG_RESERVED_ID2, | ||
| 58 | SM5502_REG_RSVD13, | ||
| 59 | SM5502_REG_OCP, | ||
| 60 | SM5502_REG_RSVD14, | ||
| 61 | SM5502_REG_RSVD15, | ||
| 62 | SM5502_REG_RSVD16, | ||
| 63 | SM5502_REG_RSVD17, | ||
| 64 | SM5502_REG_RSVD18, | ||
| 65 | SM5502_REG_RSVD19, | ||
| 66 | SM5502_REG_RSVD20, | ||
| 67 | SM5502_REG_RSVD21, | ||
| 68 | SM5502_REG_RSVD22, | ||
| 69 | SM5502_REG_RSVD23, | ||
| 70 | SM5502_REG_RSVD24, | ||
| 71 | SM5502_REG_RSVD25, | ||
| 72 | SM5502_REG_RSVD26, | ||
| 73 | SM5502_REG_RSVD27, | ||
| 74 | SM5502_REG_RSVD28, | ||
| 75 | SM5502_REG_RSVD29, | ||
| 76 | SM5502_REG_RSVD30, | ||
| 77 | SM5502_REG_RSVD31, | ||
| 78 | SM5502_REG_RSVD32, | ||
| 79 | SM5502_REG_RSVD33, | ||
| 80 | SM5502_REG_RSVD34, | ||
| 81 | SM5502_REG_RSVD35, | ||
| 82 | SM5502_REG_RSVD36, | ||
| 83 | SM5502_REG_RESERVED_ID3, | ||
| 84 | |||
| 85 | SM5502_REG_END, | ||
| 86 | }; | ||
| 87 | |||
| 88 | /* Define SM5502 MASK/SHIFT constant */ | ||
| 89 | #define SM5502_REG_DEVICE_ID_VENDOR_SHIFT 0 | ||
| 90 | #define SM5502_REG_DEVICE_ID_VERSION_SHIFT 3 | ||
| 91 | #define SM5502_REG_DEVICE_ID_VENDOR_MASK (0x3 << SM5502_REG_DEVICE_ID_VENDOR_SHIFT) | ||
| 92 | #define SM5502_REG_DEVICE_ID_VERSION_MASK (0x1f << SM5502_REG_DEVICE_ID_VERSION_SHIFT) | ||
| 93 | |||
| 94 | #define SM5502_REG_CONTROL_MASK_INT_SHIFT 0 | ||
| 95 | #define SM5502_REG_CONTROL_WAIT_SHIFT 1 | ||
| 96 | #define SM5502_REG_CONTROL_MANUAL_SW_SHIFT 2 | ||
| 97 | #define SM5502_REG_CONTROL_RAW_DATA_SHIFT 3 | ||
| 98 | #define SM5502_REG_CONTROL_SW_OPEN_SHIFT 4 | ||
| 99 | #define SM5502_REG_CONTROL_MASK_INT_MASK (0x1 << SM5502_REG_CONTROL_MASK_INT_SHIFT) | ||
| 100 | #define SM5502_REG_CONTROL_WAIT_MASK (0x1 << SM5502_REG_CONTROL_WAIT_SHIFT) | ||
| 101 | #define SM5502_REG_CONTROL_MANUAL_SW_MASK (0x1 << SM5502_REG_CONTROL_MANUAL_SW_SHIFT) | ||
| 102 | #define SM5502_REG_CONTROL_RAW_DATA_MASK (0x1 << SM5502_REG_CONTROL_RAW_DATA_SHIFT) | ||
| 103 | #define SM5502_REG_CONTROL_SW_OPEN_MASK (0x1 << SM5502_REG_CONTROL_SW_OPEN_SHIFT) | ||
| 104 | |||
| 105 | #define SM5502_REG_INTM1_ATTACH_SHIFT 0 | ||
| 106 | #define SM5502_REG_INTM1_DETACH_SHIFT 1 | ||
| 107 | #define SM5502_REG_INTM1_KP_SHIFT 2 | ||
| 108 | #define SM5502_REG_INTM1_LKP_SHIFT 3 | ||
| 109 | #define SM5502_REG_INTM1_LKR_SHIFT 4 | ||
| 110 | #define SM5502_REG_INTM1_OVP_EVENT_SHIFT 5 | ||
| 111 | #define SM5502_REG_INTM1_OCP_EVENT_SHIFT 6 | ||
| 112 | #define SM5502_REG_INTM1_OVP_OCP_DIS_SHIFT 7 | ||
| 113 | #define SM5502_REG_INTM1_ATTACH_MASK (0x1 << SM5502_REG_INTM1_ATTACH_SHIFT) | ||
| 114 | #define SM5502_REG_INTM1_DETACH_MASK (0x1 << SM5502_REG_INTM1_DETACH_SHIFT) | ||
| 115 | #define SM5502_REG_INTM1_KP_MASK (0x1 << SM5502_REG_INTM1_KP_SHIFT) | ||
| 116 | #define SM5502_REG_INTM1_LKP_MASK (0x1 << SM5502_REG_INTM1_LKP_SHIFT) | ||
| 117 | #define SM5502_REG_INTM1_LKR_MASK (0x1 << SM5502_REG_INTM1_LKR_SHIFT) | ||
| 118 | #define SM5502_REG_INTM1_OVP_EVENT_MASK (0x1 << SM5502_REG_INTM1_OVP_EVENT_SHIFT) | ||
| 119 | #define SM5502_REG_INTM1_OCP_EVENT_MASK (0x1 << SM5502_REG_INTM1_OCP_EVENT_SHIFT) | ||
| 120 | #define SM5502_REG_INTM1_OVP_OCP_DIS_MASK (0x1 << SM5502_REG_INTM1_OVP_OCP_DIS_SHIFT) | ||
| 121 | |||
| 122 | #define SM5502_REG_INTM2_VBUS_DET_SHIFT 0 | ||
| 123 | #define SM5502_REG_INTM2_REV_ACCE_SHIFT 1 | ||
| 124 | #define SM5502_REG_INTM2_ADC_CHG_SHIFT 2 | ||
| 125 | #define SM5502_REG_INTM2_STUCK_KEY_SHIFT 3 | ||
| 126 | #define SM5502_REG_INTM2_STUCK_KEY_RCV_SHIFT 4 | ||
| 127 | #define SM5502_REG_INTM2_MHL_SHIFT 5 | ||
| 128 | #define SM5502_REG_INTM2_VBUS_DET_MASK (0x1 << SM5502_REG_INTM2_VBUS_DET_SHIFT) | ||
| 129 | #define SM5502_REG_INTM2_REV_ACCE_MASK (0x1 << SM5502_REG_INTM2_REV_ACCE_SHIFT) | ||
| 130 | #define SM5502_REG_INTM2_ADC_CHG_MASK (0x1 << SM5502_REG_INTM2_ADC_CHG_SHIFT) | ||
| 131 | #define SM5502_REG_INTM2_STUCK_KEY_MASK (0x1 << SM5502_REG_INTM2_STUCK_KEY_SHIFT) | ||
| 132 | #define SM5502_REG_INTM2_STUCK_KEY_RCV_MASK (0x1 << SM5502_REG_INTM2_STUCK_KEY_RCV_SHIFT) | ||
| 133 | #define SM5502_REG_INTM2_MHL_MASK (0x1 << SM5502_REG_INTM2_MHL_SHIFT) | ||
| 134 | |||
| 135 | #define SM5502_REG_ADC_SHIFT 0 | ||
| 136 | #define SM5502_REG_ADC_MASK (0x1f << SM5502_REG_ADC_SHIFT) | ||
| 137 | |||
| 138 | #define SM5502_REG_TIMING_SET1_KEY_PRESS_SHIFT 4 | ||
| 139 | #define SM5502_REG_TIMING_SET1_KEY_PRESS_MASK (0xf << SM5502_REG_TIMING_SET1_KEY_PRESS_SHIFT) | ||
| 140 | #define TIMING_KEY_PRESS_100MS 0x0 | ||
| 141 | #define TIMING_KEY_PRESS_200MS 0x1 | ||
| 142 | #define TIMING_KEY_PRESS_300MS 0x2 | ||
| 143 | #define TIMING_KEY_PRESS_400MS 0x3 | ||
| 144 | #define TIMING_KEY_PRESS_500MS 0x4 | ||
| 145 | #define TIMING_KEY_PRESS_600MS 0x5 | ||
| 146 | #define TIMING_KEY_PRESS_700MS 0x6 | ||
| 147 | #define TIMING_KEY_PRESS_800MS 0x7 | ||
| 148 | #define TIMING_KEY_PRESS_900MS 0x8 | ||
| 149 | #define TIMING_KEY_PRESS_1000MS 0x9 | ||
| 150 | #define SM5502_REG_TIMING_SET1_ADC_DET_SHIFT 0 | ||
| 151 | #define SM5502_REG_TIMING_SET1_ADC_DET_MASK (0xf << SM5502_REG_TIMING_SET1_ADC_DET_SHIFT) | ||
| 152 | #define TIMING_ADC_DET_50MS 0x0 | ||
| 153 | #define TIMING_ADC_DET_100MS 0x1 | ||
| 154 | #define TIMING_ADC_DET_150MS 0x2 | ||
| 155 | #define TIMING_ADC_DET_200MS 0x3 | ||
| 156 | #define TIMING_ADC_DET_300MS 0x4 | ||
| 157 | #define TIMING_ADC_DET_400MS 0x5 | ||
| 158 | #define TIMING_ADC_DET_500MS 0x6 | ||
| 159 | #define TIMING_ADC_DET_600MS 0x7 | ||
| 160 | #define TIMING_ADC_DET_700MS 0x8 | ||
| 161 | #define TIMING_ADC_DET_800MS 0x9 | ||
| 162 | #define TIMING_ADC_DET_900MS 0xA | ||
| 163 | #define TIMING_ADC_DET_1000MS 0xB | ||
| 164 | |||
| 165 | #define SM5502_REG_TIMING_SET2_SW_WAIT_SHIFT 4 | ||
| 166 | #define SM5502_REG_TIMING_SET2_SW_WAIT_MASK (0xf << SM5502_REG_TIMING_SET2_SW_WAIT_SHIFT) | ||
| 167 | #define TIMING_SW_WAIT_10MS 0x0 | ||
| 168 | #define TIMING_SW_WAIT_30MS 0x1 | ||
| 169 | #define TIMING_SW_WAIT_50MS 0x2 | ||
| 170 | #define TIMING_SW_WAIT_70MS 0x3 | ||
| 171 | #define TIMING_SW_WAIT_90MS 0x4 | ||
| 172 | #define TIMING_SW_WAIT_110MS 0x5 | ||
| 173 | #define TIMING_SW_WAIT_130MS 0x6 | ||
| 174 | #define TIMING_SW_WAIT_150MS 0x7 | ||
| 175 | #define TIMING_SW_WAIT_170MS 0x8 | ||
| 176 | #define TIMING_SW_WAIT_190MS 0x9 | ||
| 177 | #define TIMING_SW_WAIT_210MS 0xA | ||
| 178 | #define SM5502_REG_TIMING_SET2_LONG_KEY_SHIFT 0 | ||
| 179 | #define SM5502_REG_TIMING_SET2_LONG_KEY_MASK (0xf << SM5502_REG_TIMING_SET2_LONG_KEY_SHIFT) | ||
| 180 | #define TIMING_LONG_KEY_300MS 0x0 | ||
| 181 | #define TIMING_LONG_KEY_400MS 0x1 | ||
| 182 | #define TIMING_LONG_KEY_500MS 0x2 | ||
| 183 | #define TIMING_LONG_KEY_600MS 0x3 | ||
| 184 | #define TIMING_LONG_KEY_700MS 0x4 | ||
| 185 | #define TIMING_LONG_KEY_800MS 0x5 | ||
| 186 | #define TIMING_LONG_KEY_900MS 0x6 | ||
| 187 | #define TIMING_LONG_KEY_1000MS 0x7 | ||
| 188 | #define TIMING_LONG_KEY_1100MS 0x8 | ||
| 189 | #define TIMING_LONG_KEY_1200MS 0x9 | ||
| 190 | #define TIMING_LONG_KEY_1300MS 0xA | ||
| 191 | #define TIMING_LONG_KEY_1400MS 0xB | ||
| 192 | #define TIMING_LONG_KEY_1500MS 0xC | ||
| 193 | |||
| 194 | #define SM5502_REG_DEV_TYPE1_AUDIO_TYPE1_SHIFT 0 | ||
| 195 | #define SM5502_REG_DEV_TYPE1_AUDIO_TYPE2_SHIFT 1 | ||
| 196 | #define SM5502_REG_DEV_TYPE1_USB_SDP_SHIFT 2 | ||
| 197 | #define SM5502_REG_DEV_TYPE1_UART_SHIFT 3 | ||
| 198 | #define SM5502_REG_DEV_TYPE1_CAR_KIT_CHARGER_SHIFT 4 | ||
| 199 | #define SM5502_REG_DEV_TYPE1_USB_CHG_SHIFT 5 | ||
| 200 | #define SM5502_REG_DEV_TYPE1_DEDICATED_CHG_SHIFT 6 | ||
| 201 | #define SM5502_REG_DEV_TYPE1_USB_OTG_SHIFT 7 | ||
| 202 | #define SM5502_REG_DEV_TYPE1_AUDIO_TYPE1_MASK (0x1 << SM5502_REG_DEV_TYPE1_AUDIO_TYPE1_SHIFT) | ||
| 203 | #define SM5502_REG_DEV_TYPE1_AUDIO_TYPE1__MASK (0x1 << SM5502_REG_DEV_TYPE1_AUDIO_TYPE2_SHIFT) | ||
| 204 | #define SM5502_REG_DEV_TYPE1_USB_SDP_MASK (0x1 << SM5502_REG_DEV_TYPE1_USB_SDP_SHIFT) | ||
| 205 | #define SM5502_REG_DEV_TYPE1_UART_MASK (0x1 << SM5502_REG_DEV_TYPE1_UART_SHIFT) | ||
| 206 | #define SM5502_REG_DEV_TYPE1_CAR_KIT_CHARGER_MASK (0x1 << SM5502_REG_DEV_TYPE1_CAR_KIT_CHARGER_SHIFT) | ||
| 207 | #define SM5502_REG_DEV_TYPE1_USB_CHG_MASK (0x1 << SM5502_REG_DEV_TYPE1_USB_CHG_SHIFT) | ||
| 208 | #define SM5502_REG_DEV_TYPE1_DEDICATED_CHG_MASK (0x1 << SM5502_REG_DEV_TYPE1_DEDICATED_CHG_SHIFT) | ||
| 209 | #define SM5502_REG_DEV_TYPE1_USB_OTG_MASK (0x1 << SM5502_REG_DEV_TYPE1_USB_OTG_SHIFT) | ||
| 210 | |||
| 211 | #define SM5502_REG_DEV_TYPE2_JIG_USB_ON_SHIFT 0 | ||
| 212 | #define SM5502_REG_DEV_TYPE2_JIG_USB_OFF_SHIFT 1 | ||
| 213 | #define SM5502_REG_DEV_TYPE2_JIG_UART_ON_SHIFT 2 | ||
| 214 | #define SM5502_REG_DEV_TYPE2_JIG_UART_OFF_SHIFT 3 | ||
| 215 | #define SM5502_REG_DEV_TYPE2_PPD_SHIFT 4 | ||
| 216 | #define SM5502_REG_DEV_TYPE2_TTY_SHIFT 5 | ||
| 217 | #define SM5502_REG_DEV_TYPE2_AV_CABLE_SHIFT 6 | ||
| 218 | #define SM5502_REG_DEV_TYPE2_JIG_USB_ON_MASK (0x1 << SM5502_REG_DEV_TYPE2_JIG_USB_ON_SHIFT) | ||
| 219 | #define SM5502_REG_DEV_TYPE2_JIG_USB_OFF_MASK (0x1 << SM5502_REG_DEV_TYPE2_JIG_USB_OFF_SHIFT) | ||
| 220 | #define SM5502_REG_DEV_TYPE2_JIG_UART_ON_MASK (0x1 << SM5502_REG_DEV_TYPE2_JIG_UART_ON_SHIFT) | ||
| 221 | #define SM5502_REG_DEV_TYPE2_JIG_UART_OFF_MASK (0x1 << SM5502_REG_DEV_TYPE2_JIG_UART_OFF_SHIFT) | ||
| 222 | #define SM5502_REG_DEV_TYPE2_PPD_MASK (0x1 << SM5502_REG_DEV_TYPE2_PPD_SHIFT) | ||
| 223 | #define SM5502_REG_DEV_TYPE2_TTY_MASK (0x1 << SM5502_REG_DEV_TYPE2_TTY_SHIFT) | ||
| 224 | #define SM5502_REG_DEV_TYPE2_AV_CABLE_MASK (0x1 << SM5502_REG_DEV_TYPE2_AV_CABLE_SHIFT) | ||
| 225 | |||
| 226 | #define SM5502_REG_MANUAL_SW1_VBUSIN_SHIFT 0 | ||
| 227 | #define SM5502_REG_MANUAL_SW1_DP_SHIFT 2 | ||
| 228 | #define SM5502_REG_MANUAL_SW1_DM_SHIFT 5 | ||
| 229 | #define SM5502_REG_MANUAL_SW1_VBUSIN_MASK (0x3 << SM5502_REG_MANUAL_SW1_VBUSIN_SHIFT) | ||
| 230 | #define SM5502_REG_MANUAL_SW1_DP_MASK (0x7 << SM5502_REG_MANUAL_SW1_DP_SHIFT) | ||
| 231 | #define SM5502_REG_MANUAL_SW1_DM_MASK (0x7 << SM5502_REG_MANUAL_SW1_DM_SHIFT) | ||
| 232 | #define VBUSIN_SWITCH_OPEN 0x0 | ||
| 233 | #define VBUSIN_SWITCH_VBUSOUT 0x1 | ||
| 234 | #define VBUSIN_SWITCH_MIC 0x2 | ||
| 235 | #define VBUSIN_SWITCH_VBUSOUT_WITH_USB 0x3 | ||
| 236 | #define DM_DP_CON_SWITCH_OPEN 0x0 | ||
| 237 | #define DM_DP_CON_SWITCH_USB 0x1 | ||
| 238 | #define DM_DP_CON_SWITCH_AUDIO 0x2 | ||
| 239 | #define DM_DP_CON_SWITCH_UART 0x3 | ||
| 240 | #define DM_DP_SWITCH_OPEN ((DM_DP_CON_SWITCH_OPEN <<SM5502_REG_MANUAL_SW1_DP_SHIFT) \ | ||
| 241 | | (DM_DP_CON_SWITCH_OPEN <<SM5502_REG_MANUAL_SW1_DM_SHIFT)) | ||
| 242 | #define DM_DP_SWITCH_USB ((DM_DP_CON_SWITCH_USB <<SM5502_REG_MANUAL_SW1_DP_SHIFT) \ | ||
| 243 | | (DM_DP_CON_SWITCH_USB <<SM5502_REG_MANUAL_SW1_DM_SHIFT)) | ||
| 244 | #define DM_DP_SWITCH_AUDIO ((DM_DP_CON_SWITCH_AUDIO <<SM5502_REG_MANUAL_SW1_DP_SHIFT) \ | ||
| 245 | | (DM_DP_CON_SWITCH_AUDIO <<SM5502_REG_MANUAL_SW1_DM_SHIFT)) | ||
| 246 | #define DM_DP_SWITCH_UART ((DM_DP_CON_SWITCH_UART <<SM5502_REG_MANUAL_SW1_DP_SHIFT) \ | ||
| 247 | | (DM_DP_CON_SWITCH_UART <<SM5502_REG_MANUAL_SW1_DM_SHIFT)) | ||
| 248 | |||
| 249 | /* SM5502 Interrupts */ | ||
| 250 | enum sm5502_irq { | ||
| 251 | /* INT1 */ | ||
| 252 | SM5502_IRQ_INT1_ATTACH, | ||
| 253 | SM5502_IRQ_INT1_DETACH, | ||
| 254 | SM5502_IRQ_INT1_KP, | ||
| 255 | SM5502_IRQ_INT1_LKP, | ||
| 256 | SM5502_IRQ_INT1_LKR, | ||
| 257 | SM5502_IRQ_INT1_OVP_EVENT, | ||
| 258 | SM5502_IRQ_INT1_OCP_EVENT, | ||
| 259 | SM5502_IRQ_INT1_OVP_OCP_DIS, | ||
| 260 | |||
| 261 | /* INT2 */ | ||
| 262 | SM5502_IRQ_INT2_VBUS_DET, | ||
| 263 | SM5502_IRQ_INT2_REV_ACCE, | ||
| 264 | SM5502_IRQ_INT2_ADC_CHG, | ||
| 265 | SM5502_IRQ_INT2_STUCK_KEY, | ||
| 266 | SM5502_IRQ_INT2_STUCK_KEY_RCV, | ||
| 267 | SM5502_IRQ_INT2_MHL, | ||
| 268 | |||
| 269 | SM5502_IRQ_NUM, | ||
| 270 | }; | ||
| 271 | |||
| 272 | #define SM5502_IRQ_INT1_ATTACH_MASK BIT(0) | ||
| 273 | #define SM5502_IRQ_INT1_DETACH_MASK BIT(1) | ||
| 274 | #define SM5502_IRQ_INT1_KP_MASK BIT(2) | ||
| 275 | #define SM5502_IRQ_INT1_LKP_MASK BIT(3) | ||
| 276 | #define SM5502_IRQ_INT1_LKR_MASK BIT(4) | ||
| 277 | #define SM5502_IRQ_INT1_OVP_EVENT_MASK BIT(5) | ||
| 278 | #define SM5502_IRQ_INT1_OCP_EVENT_MASK BIT(6) | ||
| 279 | #define SM5502_IRQ_INT1_OVP_OCP_DIS_MASK BIT(7) | ||
| 280 | #define SM5502_IRQ_INT2_VBUS_DET_MASK BIT(0) | ||
| 281 | #define SM5502_IRQ_INT2_REV_ACCE_MASK BIT(1) | ||
| 282 | #define SM5502_IRQ_INT2_ADC_CHG_MASK BIT(2) | ||
| 283 | #define SM5502_IRQ_INT2_STUCK_KEY_MASK BIT(3) | ||
| 284 | #define SM5502_IRQ_INT2_STUCK_KEY_RCV_MASK BIT(4) | ||
| 285 | #define SM5502_IRQ_INT2_MHL_MASK BIT(5) | ||
| 286 | |||
| 287 | #endif /* __LINUX_EXTCON_SM5502_H */ | ||
diff --git a/include/linux/fence.h b/include/linux/fence.h new file mode 100644 index 000000000000..d174585b874b --- /dev/null +++ b/include/linux/fence.h | |||
| @@ -0,0 +1,360 @@ | |||
| 1 | /* | ||
| 2 | * Fence mechanism for dma-buf to allow for asynchronous dma access | ||
| 3 | * | ||
| 4 | * Copyright (C) 2012 Canonical Ltd | ||
| 5 | * Copyright (C) 2012 Texas Instruments | ||
| 6 | * | ||
| 7 | * Authors: | ||
| 8 | * Rob Clark <robdclark@gmail.com> | ||
| 9 | * Maarten Lankhorst <maarten.lankhorst@canonical.com> | ||
| 10 | * | ||
| 11 | * This program is free software; you can redistribute it and/or modify it | ||
| 12 | * under the terms of the GNU General Public License version 2 as published by | ||
| 13 | * the Free Software Foundation. | ||
| 14 | * | ||
| 15 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
| 16 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| 17 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
| 18 | * more details. | ||
| 19 | */ | ||
| 20 | |||
| 21 | #ifndef __LINUX_FENCE_H | ||
| 22 | #define __LINUX_FENCE_H | ||
| 23 | |||
| 24 | #include <linux/err.h> | ||
| 25 | #include <linux/wait.h> | ||
| 26 | #include <linux/list.h> | ||
| 27 | #include <linux/bitops.h> | ||
| 28 | #include <linux/kref.h> | ||
| 29 | #include <linux/sched.h> | ||
| 30 | #include <linux/printk.h> | ||
| 31 | #include <linux/rcupdate.h> | ||
| 32 | |||
| 33 | struct fence; | ||
| 34 | struct fence_ops; | ||
| 35 | struct fence_cb; | ||
| 36 | |||
| 37 | /** | ||
| 38 | * struct fence - software synchronization primitive | ||
| 39 | * @refcount: refcount for this fence | ||
| 40 | * @ops: fence_ops associated with this fence | ||
| 41 | * @rcu: used for releasing fence with kfree_rcu | ||
| 42 | * @cb_list: list of all callbacks to call | ||
| 43 | * @lock: spin_lock_irqsave used for locking | ||
| 44 | * @context: execution context this fence belongs to, returned by | ||
| 45 | * fence_context_alloc() | ||
| 46 | * @seqno: the sequence number of this fence inside the execution context, | ||
| 47 | * can be compared to decide which fence would be signaled later. | ||
| 48 | * @flags: A mask of FENCE_FLAG_* defined below | ||
| 49 | * @timestamp: Timestamp when the fence was signaled. | ||
| 50 | * @status: Optional, only valid if < 0, must be set before calling | ||
| 51 | * fence_signal, indicates that the fence has completed with an error. | ||
| 52 | * | ||
| 53 | * the flags member must be manipulated and read using the appropriate | ||
| 54 | * atomic ops (bit_*), so taking the spinlock will not be needed most | ||
| 55 | * of the time. | ||
| 56 | * | ||
| 57 | * FENCE_FLAG_SIGNALED_BIT - fence is already signaled | ||
| 58 | * FENCE_FLAG_ENABLE_SIGNAL_BIT - enable_signaling might have been called* | ||
| 59 | * FENCE_FLAG_USER_BITS - start of the unused bits, can be used by the | ||
| 60 | * implementer of the fence for its own purposes. Can be used in different | ||
| 61 | * ways by different fence implementers, so do not rely on this. | ||
| 62 | * | ||
| 63 | * *) Since atomic bitops are used, this is not guaranteed to be the case. | ||
| 64 | * Particularly, if the bit was set, but fence_signal was called right | ||
| 65 | * before this bit was set, it would have been able to set the | ||
| 66 | * FENCE_FLAG_SIGNALED_BIT, before enable_signaling was called. | ||
| 67 | * Adding a check for FENCE_FLAG_SIGNALED_BIT after setting | ||
| 68 | * FENCE_FLAG_ENABLE_SIGNAL_BIT closes this race, and makes sure that | ||
| 69 | * after fence_signal was called, any enable_signaling call will have either | ||
| 70 | * been completed, or never called at all. | ||
| 71 | */ | ||
| 72 | struct fence { | ||
| 73 | struct kref refcount; | ||
| 74 | const struct fence_ops *ops; | ||
| 75 | struct rcu_head rcu; | ||
| 76 | struct list_head cb_list; | ||
| 77 | spinlock_t *lock; | ||
| 78 | unsigned context, seqno; | ||
| 79 | unsigned long flags; | ||
| 80 | ktime_t timestamp; | ||
| 81 | int status; | ||
| 82 | }; | ||
| 83 | |||
| 84 | enum fence_flag_bits { | ||
| 85 | FENCE_FLAG_SIGNALED_BIT, | ||
| 86 | FENCE_FLAG_ENABLE_SIGNAL_BIT, | ||
| 87 | FENCE_FLAG_USER_BITS, /* must always be last member */ | ||
| 88 | }; | ||
| 89 | |||
| 90 | typedef void (*fence_func_t)(struct fence *fence, struct fence_cb *cb); | ||
| 91 | |||
| 92 | /** | ||
| 93 | * struct fence_cb - callback for fence_add_callback | ||
| 94 | * @node: used by fence_add_callback to append this struct to fence::cb_list | ||
| 95 | * @func: fence_func_t to call | ||
| 96 | * | ||
| 97 | * This struct will be initialized by fence_add_callback, additional | ||
| 98 | * data can be passed along by embedding fence_cb in another struct. | ||
| 99 | */ | ||
| 100 | struct fence_cb { | ||
| 101 | struct list_head node; | ||
| 102 | fence_func_t func; | ||
| 103 | }; | ||
| 104 | |||
| 105 | /** | ||
| 106 | * struct fence_ops - operations implemented for fence | ||
| 107 | * @get_driver_name: returns the driver name. | ||
| 108 | * @get_timeline_name: return the name of the context this fence belongs to. | ||
| 109 | * @enable_signaling: enable software signaling of fence. | ||
| 110 | * @signaled: [optional] peek whether the fence is signaled, can be null. | ||
| 111 | * @wait: custom wait implementation, or fence_default_wait. | ||
| 112 | * @release: [optional] called on destruction of fence, can be null | ||
| 113 | * @fill_driver_data: [optional] callback to fill in free-form debug info | ||
| 114 | * Returns amount of bytes filled, or -errno. | ||
| 115 | * @fence_value_str: [optional] fills in the value of the fence as a string | ||
| 116 | * @timeline_value_str: [optional] fills in the current value of the timeline | ||
| 117 | * as a string | ||
| 118 | * | ||
| 119 | * Notes on enable_signaling: | ||
| 120 | * For fence implementations that have the capability for hw->hw | ||
| 121 | * signaling, they can implement this op to enable the necessary | ||
| 122 | * irqs, or insert commands into cmdstream, etc. This is called | ||
| 123 | * in the first wait() or add_callback() path to let the fence | ||
| 124 | * implementation know that there is another driver waiting on | ||
| 125 | * the signal (ie. hw->sw case). | ||
| 126 | * | ||
| 127 | * This function can be called called from atomic context, but not | ||
| 128 | * from irq context, so normal spinlocks can be used. | ||
| 129 | * | ||
| 130 | * A return value of false indicates the fence already passed, | ||
| 131 | * or some failure occured that made it impossible to enable | ||
| 132 | * signaling. True indicates succesful enabling. | ||
| 133 | * | ||
| 134 | * fence->status may be set in enable_signaling, but only when false is | ||
| 135 | * returned. | ||
| 136 | * | ||
| 137 | * Calling fence_signal before enable_signaling is called allows | ||
| 138 | * for a tiny race window in which enable_signaling is called during, | ||
| 139 | * before, or after fence_signal. To fight this, it is recommended | ||
| 140 | * that before enable_signaling returns true an extra reference is | ||
| 141 | * taken on the fence, to be released when the fence is signaled. | ||
| 142 | * This will mean fence_signal will still be called twice, but | ||
| 143 | * the second time will be a noop since it was already signaled. | ||
| 144 | * | ||
| 145 | * Notes on signaled: | ||
| 146 | * May set fence->status if returning true. | ||
| 147 | * | ||
| 148 | * Notes on wait: | ||
| 149 | * Must not be NULL, set to fence_default_wait for default implementation. | ||
| 150 | * the fence_default_wait implementation should work for any fence, as long | ||
| 151 | * as enable_signaling works correctly. | ||
| 152 | * | ||
| 153 | * Must return -ERESTARTSYS if the wait is intr = true and the wait was | ||
| 154 | * interrupted, and remaining jiffies if fence has signaled, or 0 if wait | ||
| 155 | * timed out. Can also return other error values on custom implementations, | ||
| 156 | * which should be treated as if the fence is signaled. For example a hardware | ||
| 157 | * lockup could be reported like that. | ||
| 158 | * | ||
| 159 | * Notes on release: | ||
| 160 | * Can be NULL, this function allows additional commands to run on | ||
| 161 | * destruction of the fence. Can be called from irq context. | ||
| 162 | * If pointer is set to NULL, kfree will get called instead. | ||
| 163 | */ | ||
| 164 | |||
| 165 | struct fence_ops { | ||
| 166 | const char * (*get_driver_name)(struct fence *fence); | ||
| 167 | const char * (*get_timeline_name)(struct fence *fence); | ||
| 168 | bool (*enable_signaling)(struct fence *fence); | ||
| 169 | bool (*signaled)(struct fence *fence); | ||
| 170 | signed long (*wait)(struct fence *fence, bool intr, signed long timeout); | ||
| 171 | void (*release)(struct fence *fence); | ||
| 172 | |||
| 173 | int (*fill_driver_data)(struct fence *fence, void *data, int size); | ||
| 174 | void (*fence_value_str)(struct fence *fence, char *str, int size); | ||
| 175 | void (*timeline_value_str)(struct fence *fence, char *str, int size); | ||
| 176 | }; | ||
| 177 | |||
| 178 | void fence_init(struct fence *fence, const struct fence_ops *ops, | ||
| 179 | spinlock_t *lock, unsigned context, unsigned seqno); | ||
| 180 | |||
| 181 | void fence_release(struct kref *kref); | ||
| 182 | void fence_free(struct fence *fence); | ||
| 183 | |||
| 184 | /** | ||
| 185 | * fence_get - increases refcount of the fence | ||
| 186 | * @fence: [in] fence to increase refcount of | ||
| 187 | * | ||
| 188 | * Returns the same fence, with refcount increased by 1. | ||
| 189 | */ | ||
| 190 | static inline struct fence *fence_get(struct fence *fence) | ||
| 191 | { | ||
| 192 | if (fence) | ||
| 193 | kref_get(&fence->refcount); | ||
| 194 | return fence; | ||
| 195 | } | ||
| 196 | |||
| 197 | /** | ||
| 198 | * fence_get_rcu - get a fence from a reservation_object_list with rcu read lock | ||
| 199 | * @fence: [in] fence to increase refcount of | ||
| 200 | * | ||
| 201 | * Function returns NULL if no refcount could be obtained, or the fence. | ||
| 202 | */ | ||
| 203 | static inline struct fence *fence_get_rcu(struct fence *fence) | ||
| 204 | { | ||
| 205 | if (kref_get_unless_zero(&fence->refcount)) | ||
| 206 | return fence; | ||
| 207 | else | ||
| 208 | return NULL; | ||
| 209 | } | ||
| 210 | |||
| 211 | /** | ||
| 212 | * fence_put - decreases refcount of the fence | ||
| 213 | * @fence: [in] fence to reduce refcount of | ||
| 214 | */ | ||
| 215 | static inline void fence_put(struct fence *fence) | ||
| 216 | { | ||
| 217 | if (fence) | ||
| 218 | kref_put(&fence->refcount, fence_release); | ||
| 219 | } | ||
| 220 | |||
| 221 | int fence_signal(struct fence *fence); | ||
| 222 | int fence_signal_locked(struct fence *fence); | ||
| 223 | signed long fence_default_wait(struct fence *fence, bool intr, signed long timeout); | ||
| 224 | int fence_add_callback(struct fence *fence, struct fence_cb *cb, | ||
| 225 | fence_func_t func); | ||
| 226 | bool fence_remove_callback(struct fence *fence, struct fence_cb *cb); | ||
| 227 | void fence_enable_sw_signaling(struct fence *fence); | ||
| 228 | |||
| 229 | /** | ||
| 230 | * fence_is_signaled_locked - Return an indication if the fence is signaled yet. | ||
| 231 | * @fence: [in] the fence to check | ||
| 232 | * | ||
| 233 | * Returns true if the fence was already signaled, false if not. Since this | ||
| 234 | * function doesn't enable signaling, it is not guaranteed to ever return | ||
| 235 | * true if fence_add_callback, fence_wait or fence_enable_sw_signaling | ||
| 236 | * haven't been called before. | ||
| 237 | * | ||
| 238 | * This function requires fence->lock to be held. | ||
| 239 | */ | ||
| 240 | static inline bool | ||
| 241 | fence_is_signaled_locked(struct fence *fence) | ||
| 242 | { | ||
| 243 | if (test_bit(FENCE_FLAG_SIGNALED_BIT, &fence->flags)) | ||
| 244 | return true; | ||
| 245 | |||
| 246 | if (fence->ops->signaled && fence->ops->signaled(fence)) { | ||
| 247 | fence_signal_locked(fence); | ||
| 248 | return true; | ||
| 249 | } | ||
| 250 | |||
| 251 | return false; | ||
| 252 | } | ||
| 253 | |||
| 254 | /** | ||
| 255 | * fence_is_signaled - Return an indication if the fence is signaled yet. | ||
| 256 | * @fence: [in] the fence to check | ||
| 257 | * | ||
| 258 | * Returns true if the fence was already signaled, false if not. Since this | ||
| 259 | * function doesn't enable signaling, it is not guaranteed to ever return | ||
| 260 | * true if fence_add_callback, fence_wait or fence_enable_sw_signaling | ||
| 261 | * haven't been called before. | ||
| 262 | * | ||
| 263 | * It's recommended for seqno fences to call fence_signal when the | ||
| 264 | * operation is complete, it makes it possible to prevent issues from | ||
| 265 | * wraparound between time of issue and time of use by checking the return | ||
| 266 | * value of this function before calling hardware-specific wait instructions. | ||
| 267 | */ | ||
| 268 | static inline bool | ||
| 269 | fence_is_signaled(struct fence *fence) | ||
| 270 | { | ||
| 271 | if (test_bit(FENCE_FLAG_SIGNALED_BIT, &fence->flags)) | ||
| 272 | return true; | ||
| 273 | |||
| 274 | if (fence->ops->signaled && fence->ops->signaled(fence)) { | ||
| 275 | fence_signal(fence); | ||
| 276 | return true; | ||
| 277 | } | ||
| 278 | |||
| 279 | return false; | ||
| 280 | } | ||
| 281 | |||
| 282 | /** | ||
| 283 | * fence_later - return the chronologically later fence | ||
| 284 | * @f1: [in] the first fence from the same context | ||
| 285 | * @f2: [in] the second fence from the same context | ||
| 286 | * | ||
| 287 | * Returns NULL if both fences are signaled, otherwise the fence that would be | ||
| 288 | * signaled last. Both fences must be from the same context, since a seqno is | ||
| 289 | * not re-used across contexts. | ||
| 290 | */ | ||
| 291 | static inline struct fence *fence_later(struct fence *f1, struct fence *f2) | ||
| 292 | { | ||
| 293 | if (WARN_ON(f1->context != f2->context)) | ||
| 294 | return NULL; | ||
| 295 | |||
| 296 | /* | ||
| 297 | * can't check just FENCE_FLAG_SIGNALED_BIT here, it may never have been | ||
| 298 | * set if enable_signaling wasn't called, and enabling that here is | ||
| 299 | * overkill. | ||
| 300 | */ | ||
| 301 | if (f2->seqno - f1->seqno <= INT_MAX) | ||
| 302 | return fence_is_signaled(f2) ? NULL : f2; | ||
| 303 | else | ||
| 304 | return fence_is_signaled(f1) ? NULL : f1; | ||
| 305 | } | ||
| 306 | |||
| 307 | signed long fence_wait_timeout(struct fence *, bool intr, signed long timeout); | ||
| 308 | |||
| 309 | |||
| 310 | /** | ||
| 311 | * fence_wait - sleep until the fence gets signaled | ||
| 312 | * @fence: [in] the fence to wait on | ||
| 313 | * @intr: [in] if true, do an interruptible wait | ||
| 314 | * | ||
| 315 | * This function will return -ERESTARTSYS if interrupted by a signal, | ||
| 316 | * or 0 if the fence was signaled. Other error values may be | ||
| 317 | * returned on custom implementations. | ||
| 318 | * | ||
| 319 | * Performs a synchronous wait on this fence. It is assumed the caller | ||
| 320 | * directly or indirectly holds a reference to the fence, otherwise the | ||
| 321 | * fence might be freed before return, resulting in undefined behavior. | ||
| 322 | */ | ||
| 323 | static inline signed long fence_wait(struct fence *fence, bool intr) | ||
| 324 | { | ||
| 325 | signed long ret; | ||
| 326 | |||
| 327 | /* Since fence_wait_timeout cannot timeout with | ||
| 328 | * MAX_SCHEDULE_TIMEOUT, only valid return values are | ||
| 329 | * -ERESTARTSYS and MAX_SCHEDULE_TIMEOUT. | ||
| 330 | */ | ||
| 331 | ret = fence_wait_timeout(fence, intr, MAX_SCHEDULE_TIMEOUT); | ||
| 332 | |||
| 333 | return ret < 0 ? ret : 0; | ||
| 334 | } | ||
| 335 | |||
| 336 | unsigned fence_context_alloc(unsigned num); | ||
| 337 | |||
| 338 | #define FENCE_TRACE(f, fmt, args...) \ | ||
| 339 | do { \ | ||
| 340 | struct fence *__ff = (f); \ | ||
| 341 | if (config_enabled(CONFIG_FENCE_TRACE)) \ | ||
| 342 | pr_info("f %u#%u: " fmt, \ | ||
| 343 | __ff->context, __ff->seqno, ##args); \ | ||
| 344 | } while (0) | ||
| 345 | |||
| 346 | #define FENCE_WARN(f, fmt, args...) \ | ||
| 347 | do { \ | ||
| 348 | struct fence *__ff = (f); \ | ||
| 349 | pr_warn("f %u#%u: " fmt, __ff->context, __ff->seqno, \ | ||
| 350 | ##args); \ | ||
| 351 | } while (0) | ||
| 352 | |||
| 353 | #define FENCE_ERR(f, fmt, args...) \ | ||
| 354 | do { \ | ||
| 355 | struct fence *__ff = (f); \ | ||
| 356 | pr_err("f %u#%u: " fmt, __ff->context, __ff->seqno, \ | ||
| 357 | ##args); \ | ||
| 358 | } while (0) | ||
| 359 | |||
| 360 | #endif /* __LINUX_FENCE_H */ | ||
diff --git a/include/linux/filter.h b/include/linux/filter.h index a7e3c48d73a7..a5227ab8ccb1 100644 --- a/include/linux/filter.h +++ b/include/linux/filter.h | |||
| @@ -6,6 +6,7 @@ | |||
| 6 | 6 | ||
| 7 | #include <linux/atomic.h> | 7 | #include <linux/atomic.h> |
| 8 | #include <linux/compat.h> | 8 | #include <linux/compat.h> |
| 9 | #include <linux/skbuff.h> | ||
| 9 | #include <linux/workqueue.h> | 10 | #include <linux/workqueue.h> |
| 10 | #include <uapi/linux/filter.h> | 11 | #include <uapi/linux/filter.h> |
| 11 | 12 | ||
| @@ -81,7 +82,7 @@ enum { | |||
| 81 | /* ALU ops on registers, bpf_add|sub|...: dst_reg += src_reg */ | 82 | /* ALU ops on registers, bpf_add|sub|...: dst_reg += src_reg */ |
| 82 | 83 | ||
| 83 | #define BPF_ALU64_REG(OP, DST, SRC) \ | 84 | #define BPF_ALU64_REG(OP, DST, SRC) \ |
| 84 | ((struct sock_filter_int) { \ | 85 | ((struct bpf_insn) { \ |
| 85 | .code = BPF_ALU64 | BPF_OP(OP) | BPF_X, \ | 86 | .code = BPF_ALU64 | BPF_OP(OP) | BPF_X, \ |
| 86 | .dst_reg = DST, \ | 87 | .dst_reg = DST, \ |
| 87 | .src_reg = SRC, \ | 88 | .src_reg = SRC, \ |
| @@ -89,7 +90,7 @@ enum { | |||
| 89 | .imm = 0 }) | 90 | .imm = 0 }) |
| 90 | 91 | ||
| 91 | #define BPF_ALU32_REG(OP, DST, SRC) \ | 92 | #define BPF_ALU32_REG(OP, DST, SRC) \ |
| 92 | ((struct sock_filter_int) { \ | 93 | ((struct bpf_insn) { \ |
| 93 | .code = BPF_ALU | BPF_OP(OP) | BPF_X, \ | 94 | .code = BPF_ALU | BPF_OP(OP) | BPF_X, \ |
| 94 | .dst_reg = DST, \ | 95 | .dst_reg = DST, \ |
| 95 | .src_reg = SRC, \ | 96 | .src_reg = SRC, \ |
| @@ -99,7 +100,7 @@ enum { | |||
| 99 | /* ALU ops on immediates, bpf_add|sub|...: dst_reg += imm32 */ | 100 | /* ALU ops on immediates, bpf_add|sub|...: dst_reg += imm32 */ |
| 100 | 101 | ||
| 101 | #define BPF_ALU64_IMM(OP, DST, IMM) \ | 102 | #define BPF_ALU64_IMM(OP, DST, IMM) \ |
| 102 | ((struct sock_filter_int) { \ | 103 | ((struct bpf_insn) { \ |
| 103 | .code = BPF_ALU64 | BPF_OP(OP) | BPF_K, \ | 104 | .code = BPF_ALU64 | BPF_OP(OP) | BPF_K, \ |
| 104 | .dst_reg = DST, \ | 105 | .dst_reg = DST, \ |
| 105 | .src_reg = 0, \ | 106 | .src_reg = 0, \ |
| @@ -107,7 +108,7 @@ enum { | |||
| 107 | .imm = IMM }) | 108 | .imm = IMM }) |
| 108 | 109 | ||
| 109 | #define BPF_ALU32_IMM(OP, DST, IMM) \ | 110 | #define BPF_ALU32_IMM(OP, DST, IMM) \ |
| 110 | ((struct sock_filter_int) { \ | 111 | ((struct bpf_insn) { \ |
| 111 | .code = BPF_ALU | BPF_OP(OP) | BPF_K, \ | 112 | .code = BPF_ALU | BPF_OP(OP) | BPF_K, \ |
| 112 | .dst_reg = DST, \ | 113 | .dst_reg = DST, \ |
| 113 | .src_reg = 0, \ | 114 | .src_reg = 0, \ |
| @@ -117,7 +118,7 @@ enum { | |||
| 117 | /* Endianess conversion, cpu_to_{l,b}e(), {l,b}e_to_cpu() */ | 118 | /* Endianess conversion, cpu_to_{l,b}e(), {l,b}e_to_cpu() */ |
| 118 | 119 | ||
| 119 | #define BPF_ENDIAN(TYPE, DST, LEN) \ | 120 | #define BPF_ENDIAN(TYPE, DST, LEN) \ |
| 120 | ((struct sock_filter_int) { \ | 121 | ((struct bpf_insn) { \ |
| 121 | .code = BPF_ALU | BPF_END | BPF_SRC(TYPE), \ | 122 | .code = BPF_ALU | BPF_END | BPF_SRC(TYPE), \ |
| 122 | .dst_reg = DST, \ | 123 | .dst_reg = DST, \ |
| 123 | .src_reg = 0, \ | 124 | .src_reg = 0, \ |
| @@ -127,7 +128,7 @@ enum { | |||
| 127 | /* Short form of mov, dst_reg = src_reg */ | 128 | /* Short form of mov, dst_reg = src_reg */ |
| 128 | 129 | ||
| 129 | #define BPF_MOV64_REG(DST, SRC) \ | 130 | #define BPF_MOV64_REG(DST, SRC) \ |
| 130 | ((struct sock_filter_int) { \ | 131 | ((struct bpf_insn) { \ |
| 131 | .code = BPF_ALU64 | BPF_MOV | BPF_X, \ | 132 | .code = BPF_ALU64 | BPF_MOV | BPF_X, \ |
| 132 | .dst_reg = DST, \ | 133 | .dst_reg = DST, \ |
| 133 | .src_reg = SRC, \ | 134 | .src_reg = SRC, \ |
| @@ -135,7 +136,7 @@ enum { | |||
| 135 | .imm = 0 }) | 136 | .imm = 0 }) |
| 136 | 137 | ||
| 137 | #define BPF_MOV32_REG(DST, SRC) \ | 138 | #define BPF_MOV32_REG(DST, SRC) \ |
| 138 | ((struct sock_filter_int) { \ | 139 | ((struct bpf_insn) { \ |
| 139 | .code = BPF_ALU | BPF_MOV | BPF_X, \ | 140 | .code = BPF_ALU | BPF_MOV | BPF_X, \ |
| 140 | .dst_reg = DST, \ | 141 | .dst_reg = DST, \ |
| 141 | .src_reg = SRC, \ | 142 | .src_reg = SRC, \ |
| @@ -145,7 +146,7 @@ enum { | |||
| 145 | /* Short form of mov, dst_reg = imm32 */ | 146 | /* Short form of mov, dst_reg = imm32 */ |
| 146 | 147 | ||
| 147 | #define BPF_MOV64_IMM(DST, IMM) \ | 148 | #define BPF_MOV64_IMM(DST, IMM) \ |
| 148 | ((struct sock_filter_int) { \ | 149 | ((struct bpf_insn) { \ |
| 149 | .code = BPF_ALU64 | BPF_MOV | BPF_K, \ | 150 | .code = BPF_ALU64 | BPF_MOV | BPF_K, \ |
| 150 | .dst_reg = DST, \ | 151 | .dst_reg = DST, \ |
| 151 | .src_reg = 0, \ | 152 | .src_reg = 0, \ |
| @@ -153,7 +154,7 @@ enum { | |||
| 153 | .imm = IMM }) | 154 | .imm = IMM }) |
| 154 | 155 | ||
| 155 | #define BPF_MOV32_IMM(DST, IMM) \ | 156 | #define BPF_MOV32_IMM(DST, IMM) \ |
| 156 | ((struct sock_filter_int) { \ | 157 | ((struct bpf_insn) { \ |
| 157 | .code = BPF_ALU | BPF_MOV | BPF_K, \ | 158 | .code = BPF_ALU | BPF_MOV | BPF_K, \ |
| 158 | .dst_reg = DST, \ | 159 | .dst_reg = DST, \ |
| 159 | .src_reg = 0, \ | 160 | .src_reg = 0, \ |
| @@ -163,7 +164,7 @@ enum { | |||
| 163 | /* Short form of mov based on type, BPF_X: dst_reg = src_reg, BPF_K: dst_reg = imm32 */ | 164 | /* Short form of mov based on type, BPF_X: dst_reg = src_reg, BPF_K: dst_reg = imm32 */ |
| 164 | 165 | ||
| 165 | #define BPF_MOV64_RAW(TYPE, DST, SRC, IMM) \ | 166 | #define BPF_MOV64_RAW(TYPE, DST, SRC, IMM) \ |
| 166 | ((struct sock_filter_int) { \ | 167 | ((struct bpf_insn) { \ |
| 167 | .code = BPF_ALU64 | BPF_MOV | BPF_SRC(TYPE), \ | 168 | .code = BPF_ALU64 | BPF_MOV | BPF_SRC(TYPE), \ |
| 168 | .dst_reg = DST, \ | 169 | .dst_reg = DST, \ |
| 169 | .src_reg = SRC, \ | 170 | .src_reg = SRC, \ |
| @@ -171,7 +172,7 @@ enum { | |||
| 171 | .imm = IMM }) | 172 | .imm = IMM }) |
| 172 | 173 | ||
| 173 | #define BPF_MOV32_RAW(TYPE, DST, SRC, IMM) \ | 174 | #define BPF_MOV32_RAW(TYPE, DST, SRC, IMM) \ |
| 174 | ((struct sock_filter_int) { \ | 175 | ((struct bpf_insn) { \ |
| 175 | .code = BPF_ALU | BPF_MOV | BPF_SRC(TYPE), \ | 176 | .code = BPF_ALU | BPF_MOV | BPF_SRC(TYPE), \ |
| 176 | .dst_reg = DST, \ | 177 | .dst_reg = DST, \ |
| 177 | .src_reg = SRC, \ | 178 | .src_reg = SRC, \ |
| @@ -181,7 +182,7 @@ enum { | |||
| 181 | /* Direct packet access, R0 = *(uint *) (skb->data + imm32) */ | 182 | /* Direct packet access, R0 = *(uint *) (skb->data + imm32) */ |
| 182 | 183 | ||
| 183 | #define BPF_LD_ABS(SIZE, IMM) \ | 184 | #define BPF_LD_ABS(SIZE, IMM) \ |
| 184 | ((struct sock_filter_int) { \ | 185 | ((struct bpf_insn) { \ |
| 185 | .code = BPF_LD | BPF_SIZE(SIZE) | BPF_ABS, \ | 186 | .code = BPF_LD | BPF_SIZE(SIZE) | BPF_ABS, \ |
| 186 | .dst_reg = 0, \ | 187 | .dst_reg = 0, \ |
| 187 | .src_reg = 0, \ | 188 | .src_reg = 0, \ |
| @@ -191,7 +192,7 @@ enum { | |||
| 191 | /* Indirect packet access, R0 = *(uint *) (skb->data + src_reg + imm32) */ | 192 | /* Indirect packet access, R0 = *(uint *) (skb->data + src_reg + imm32) */ |
| 192 | 193 | ||
| 193 | #define BPF_LD_IND(SIZE, SRC, IMM) \ | 194 | #define BPF_LD_IND(SIZE, SRC, IMM) \ |
| 194 | ((struct sock_filter_int) { \ | 195 | ((struct bpf_insn) { \ |
| 195 | .code = BPF_LD | BPF_SIZE(SIZE) | BPF_IND, \ | 196 | .code = BPF_LD | BPF_SIZE(SIZE) | BPF_IND, \ |
| 196 | .dst_reg = 0, \ | 197 | .dst_reg = 0, \ |
| 197 | .src_reg = SRC, \ | 198 | .src_reg = SRC, \ |
| @@ -201,7 +202,7 @@ enum { | |||
| 201 | /* Memory load, dst_reg = *(uint *) (src_reg + off16) */ | 202 | /* Memory load, dst_reg = *(uint *) (src_reg + off16) */ |
| 202 | 203 | ||
| 203 | #define BPF_LDX_MEM(SIZE, DST, SRC, OFF) \ | 204 | #define BPF_LDX_MEM(SIZE, DST, SRC, OFF) \ |
| 204 | ((struct sock_filter_int) { \ | 205 | ((struct bpf_insn) { \ |
| 205 | .code = BPF_LDX | BPF_SIZE(SIZE) | BPF_MEM, \ | 206 | .code = BPF_LDX | BPF_SIZE(SIZE) | BPF_MEM, \ |
| 206 | .dst_reg = DST, \ | 207 | .dst_reg = DST, \ |
| 207 | .src_reg = SRC, \ | 208 | .src_reg = SRC, \ |
| @@ -211,7 +212,7 @@ enum { | |||
| 211 | /* Memory store, *(uint *) (dst_reg + off16) = src_reg */ | 212 | /* Memory store, *(uint *) (dst_reg + off16) = src_reg */ |
| 212 | 213 | ||
| 213 | #define BPF_STX_MEM(SIZE, DST, SRC, OFF) \ | 214 | #define BPF_STX_MEM(SIZE, DST, SRC, OFF) \ |
| 214 | ((struct sock_filter_int) { \ | 215 | ((struct bpf_insn) { \ |
| 215 | .code = BPF_STX | BPF_SIZE(SIZE) | BPF_MEM, \ | 216 | .code = BPF_STX | BPF_SIZE(SIZE) | BPF_MEM, \ |
| 216 | .dst_reg = DST, \ | 217 | .dst_reg = DST, \ |
| 217 | .src_reg = SRC, \ | 218 | .src_reg = SRC, \ |
| @@ -221,7 +222,7 @@ enum { | |||
| 221 | /* Memory store, *(uint *) (dst_reg + off16) = imm32 */ | 222 | /* Memory store, *(uint *) (dst_reg + off16) = imm32 */ |
| 222 | 223 | ||
| 223 | #define BPF_ST_MEM(SIZE, DST, OFF, IMM) \ | 224 | #define BPF_ST_MEM(SIZE, DST, OFF, IMM) \ |
| 224 | ((struct sock_filter_int) { \ | 225 | ((struct bpf_insn) { \ |
| 225 | .code = BPF_ST | BPF_SIZE(SIZE) | BPF_MEM, \ | 226 | .code = BPF_ST | BPF_SIZE(SIZE) | BPF_MEM, \ |
| 226 | .dst_reg = DST, \ | 227 | .dst_reg = DST, \ |
| 227 | .src_reg = 0, \ | 228 | .src_reg = 0, \ |
| @@ -231,7 +232,7 @@ enum { | |||
| 231 | /* Conditional jumps against registers, if (dst_reg 'op' src_reg) goto pc + off16 */ | 232 | /* Conditional jumps against registers, if (dst_reg 'op' src_reg) goto pc + off16 */ |
| 232 | 233 | ||
| 233 | #define BPF_JMP_REG(OP, DST, SRC, OFF) \ | 234 | #define BPF_JMP_REG(OP, DST, SRC, OFF) \ |
| 234 | ((struct sock_filter_int) { \ | 235 | ((struct bpf_insn) { \ |
| 235 | .code = BPF_JMP | BPF_OP(OP) | BPF_X, \ | 236 | .code = BPF_JMP | BPF_OP(OP) | BPF_X, \ |
| 236 | .dst_reg = DST, \ | 237 | .dst_reg = DST, \ |
| 237 | .src_reg = SRC, \ | 238 | .src_reg = SRC, \ |
| @@ -241,7 +242,7 @@ enum { | |||
| 241 | /* Conditional jumps against immediates, if (dst_reg 'op' imm32) goto pc + off16 */ | 242 | /* Conditional jumps against immediates, if (dst_reg 'op' imm32) goto pc + off16 */ |
| 242 | 243 | ||
| 243 | #define BPF_JMP_IMM(OP, DST, IMM, OFF) \ | 244 | #define BPF_JMP_IMM(OP, DST, IMM, OFF) \ |
| 244 | ((struct sock_filter_int) { \ | 245 | ((struct bpf_insn) { \ |
| 245 | .code = BPF_JMP | BPF_OP(OP) | BPF_K, \ | 246 | .code = BPF_JMP | BPF_OP(OP) | BPF_K, \ |
| 246 | .dst_reg = DST, \ | 247 | .dst_reg = DST, \ |
| 247 | .src_reg = 0, \ | 248 | .src_reg = 0, \ |
| @@ -251,7 +252,7 @@ enum { | |||
| 251 | /* Function call */ | 252 | /* Function call */ |
| 252 | 253 | ||
| 253 | #define BPF_EMIT_CALL(FUNC) \ | 254 | #define BPF_EMIT_CALL(FUNC) \ |
| 254 | ((struct sock_filter_int) { \ | 255 | ((struct bpf_insn) { \ |
| 255 | .code = BPF_JMP | BPF_CALL, \ | 256 | .code = BPF_JMP | BPF_CALL, \ |
| 256 | .dst_reg = 0, \ | 257 | .dst_reg = 0, \ |
| 257 | .src_reg = 0, \ | 258 | .src_reg = 0, \ |
| @@ -261,7 +262,7 @@ enum { | |||
| 261 | /* Raw code statement block */ | 262 | /* Raw code statement block */ |
| 262 | 263 | ||
| 263 | #define BPF_RAW_INSN(CODE, DST, SRC, OFF, IMM) \ | 264 | #define BPF_RAW_INSN(CODE, DST, SRC, OFF, IMM) \ |
| 264 | ((struct sock_filter_int) { \ | 265 | ((struct bpf_insn) { \ |
| 265 | .code = CODE, \ | 266 | .code = CODE, \ |
| 266 | .dst_reg = DST, \ | 267 | .dst_reg = DST, \ |
| 267 | .src_reg = SRC, \ | 268 | .src_reg = SRC, \ |
| @@ -271,7 +272,7 @@ enum { | |||
| 271 | /* Program exit */ | 272 | /* Program exit */ |
| 272 | 273 | ||
| 273 | #define BPF_EXIT_INSN() \ | 274 | #define BPF_EXIT_INSN() \ |
| 274 | ((struct sock_filter_int) { \ | 275 | ((struct bpf_insn) { \ |
| 275 | .code = BPF_JMP | BPF_EXIT, \ | 276 | .code = BPF_JMP | BPF_EXIT, \ |
| 276 | .dst_reg = 0, \ | 277 | .dst_reg = 0, \ |
| 277 | .src_reg = 0, \ | 278 | .src_reg = 0, \ |
| @@ -295,9 +296,10 @@ enum { | |||
| 295 | }) | 296 | }) |
| 296 | 297 | ||
| 297 | /* Macro to invoke filter function. */ | 298 | /* Macro to invoke filter function. */ |
| 298 | #define SK_RUN_FILTER(filter, ctx) (*filter->bpf_func)(ctx, filter->insnsi) | 299 | #define SK_RUN_FILTER(filter, ctx) \ |
| 300 | (*filter->prog->bpf_func)(ctx, filter->prog->insnsi) | ||
| 299 | 301 | ||
| 300 | struct sock_filter_int { | 302 | struct bpf_insn { |
| 301 | __u8 code; /* opcode */ | 303 | __u8 code; /* opcode */ |
| 302 | __u8 dst_reg:4; /* dest register */ | 304 | __u8 dst_reg:4; /* dest register */ |
| 303 | __u8 src_reg:4; /* source register */ | 305 | __u8 src_reg:4; /* source register */ |
| @@ -322,54 +324,58 @@ struct sk_buff; | |||
| 322 | struct sock; | 324 | struct sock; |
| 323 | struct seccomp_data; | 325 | struct seccomp_data; |
| 324 | 326 | ||
| 325 | struct sk_filter { | 327 | struct bpf_prog { |
| 326 | atomic_t refcnt; | ||
| 327 | u32 jited:1, /* Is our filter JIT'ed? */ | 328 | u32 jited:1, /* Is our filter JIT'ed? */ |
| 328 | len:31; /* Number of filter blocks */ | 329 | len:31; /* Number of filter blocks */ |
| 329 | struct sock_fprog_kern *orig_prog; /* Original BPF program */ | 330 | struct sock_fprog_kern *orig_prog; /* Original BPF program */ |
| 330 | struct rcu_head rcu; | ||
| 331 | unsigned int (*bpf_func)(const struct sk_buff *skb, | 331 | unsigned int (*bpf_func)(const struct sk_buff *skb, |
| 332 | const struct sock_filter_int *filter); | 332 | const struct bpf_insn *filter); |
| 333 | union { | 333 | union { |
| 334 | struct sock_filter insns[0]; | 334 | struct sock_filter insns[0]; |
| 335 | struct sock_filter_int insnsi[0]; | 335 | struct bpf_insn insnsi[0]; |
| 336 | struct work_struct work; | 336 | struct work_struct work; |
| 337 | }; | 337 | }; |
| 338 | }; | 338 | }; |
| 339 | 339 | ||
| 340 | static inline unsigned int sk_filter_size(unsigned int proglen) | 340 | struct sk_filter { |
| 341 | atomic_t refcnt; | ||
| 342 | struct rcu_head rcu; | ||
| 343 | struct bpf_prog *prog; | ||
| 344 | }; | ||
| 345 | |||
| 346 | #define BPF_PROG_RUN(filter, ctx) (*filter->bpf_func)(ctx, filter->insnsi) | ||
| 347 | |||
| 348 | static inline unsigned int bpf_prog_size(unsigned int proglen) | ||
| 341 | { | 349 | { |
| 342 | return max(sizeof(struct sk_filter), | 350 | return max(sizeof(struct bpf_prog), |
| 343 | offsetof(struct sk_filter, insns[proglen])); | 351 | offsetof(struct bpf_prog, insns[proglen])); |
| 344 | } | 352 | } |
| 345 | 353 | ||
| 346 | #define sk_filter_proglen(fprog) \ | 354 | #define bpf_classic_proglen(fprog) (fprog->len * sizeof(fprog->filter[0])) |
| 347 | (fprog->len * sizeof(fprog->filter[0])) | ||
| 348 | 355 | ||
| 349 | int sk_filter(struct sock *sk, struct sk_buff *skb); | 356 | int sk_filter(struct sock *sk, struct sk_buff *skb); |
| 350 | 357 | ||
| 351 | void sk_filter_select_runtime(struct sk_filter *fp); | 358 | void bpf_prog_select_runtime(struct bpf_prog *fp); |
| 352 | void sk_filter_free(struct sk_filter *fp); | 359 | void bpf_prog_free(struct bpf_prog *fp); |
| 353 | 360 | ||
| 354 | int sk_convert_filter(struct sock_filter *prog, int len, | 361 | int bpf_convert_filter(struct sock_filter *prog, int len, |
| 355 | struct sock_filter_int *new_prog, int *new_len); | 362 | struct bpf_insn *new_prog, int *new_len); |
| 356 | 363 | ||
| 357 | int sk_unattached_filter_create(struct sk_filter **pfp, | 364 | int bpf_prog_create(struct bpf_prog **pfp, struct sock_fprog_kern *fprog); |
| 358 | struct sock_fprog_kern *fprog); | 365 | void bpf_prog_destroy(struct bpf_prog *fp); |
| 359 | void sk_unattached_filter_destroy(struct sk_filter *fp); | ||
| 360 | 366 | ||
| 361 | int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk); | 367 | int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk); |
| 362 | int sk_detach_filter(struct sock *sk); | 368 | int sk_detach_filter(struct sock *sk); |
| 363 | 369 | ||
| 364 | int sk_chk_filter(struct sock_filter *filter, unsigned int flen); | 370 | int bpf_check_classic(const struct sock_filter *filter, unsigned int flen); |
| 365 | int sk_get_filter(struct sock *sk, struct sock_filter __user *filter, | 371 | int sk_get_filter(struct sock *sk, struct sock_filter __user *filter, |
| 366 | unsigned int len); | 372 | unsigned int len); |
| 367 | 373 | ||
| 368 | void sk_filter_charge(struct sock *sk, struct sk_filter *fp); | 374 | bool sk_filter_charge(struct sock *sk, struct sk_filter *fp); |
| 369 | void sk_filter_uncharge(struct sock *sk, struct sk_filter *fp); | 375 | void sk_filter_uncharge(struct sock *sk, struct sk_filter *fp); |
| 370 | 376 | ||
| 371 | u64 __bpf_call_base(u64 r1, u64 r2, u64 r3, u64 r4, u64 r5); | 377 | u64 __bpf_call_base(u64 r1, u64 r2, u64 r3, u64 r4, u64 r5); |
| 372 | void bpf_int_jit_compile(struct sk_filter *fp); | 378 | void bpf_int_jit_compile(struct bpf_prog *fp); |
| 373 | 379 | ||
| 374 | #define BPF_ANC BIT(15) | 380 | #define BPF_ANC BIT(15) |
| 375 | 381 | ||
| @@ -406,13 +412,25 @@ static inline u16 bpf_anc_helper(const struct sock_filter *ftest) | |||
| 406 | } | 412 | } |
| 407 | } | 413 | } |
| 408 | 414 | ||
| 415 | void *bpf_internal_load_pointer_neg_helper(const struct sk_buff *skb, | ||
| 416 | int k, unsigned int size); | ||
| 417 | |||
| 418 | static inline void *bpf_load_pointer(const struct sk_buff *skb, int k, | ||
| 419 | unsigned int size, void *buffer) | ||
| 420 | { | ||
| 421 | if (k >= 0) | ||
| 422 | return skb_header_pointer(skb, k, size, buffer); | ||
| 423 | |||
| 424 | return bpf_internal_load_pointer_neg_helper(skb, k, size); | ||
| 425 | } | ||
| 426 | |||
| 409 | #ifdef CONFIG_BPF_JIT | 427 | #ifdef CONFIG_BPF_JIT |
| 410 | #include <stdarg.h> | 428 | #include <stdarg.h> |
| 411 | #include <linux/linkage.h> | 429 | #include <linux/linkage.h> |
| 412 | #include <linux/printk.h> | 430 | #include <linux/printk.h> |
| 413 | 431 | ||
| 414 | void bpf_jit_compile(struct sk_filter *fp); | 432 | void bpf_jit_compile(struct bpf_prog *fp); |
| 415 | void bpf_jit_free(struct sk_filter *fp); | 433 | void bpf_jit_free(struct bpf_prog *fp); |
| 416 | 434 | ||
| 417 | static inline void bpf_jit_dump(unsigned int flen, unsigned int proglen, | 435 | static inline void bpf_jit_dump(unsigned int flen, unsigned int proglen, |
| 418 | u32 pass, void *image) | 436 | u32 pass, void *image) |
| @@ -426,11 +444,11 @@ static inline void bpf_jit_dump(unsigned int flen, unsigned int proglen, | |||
| 426 | #else | 444 | #else |
| 427 | #include <linux/slab.h> | 445 | #include <linux/slab.h> |
| 428 | 446 | ||
| 429 | static inline void bpf_jit_compile(struct sk_filter *fp) | 447 | static inline void bpf_jit_compile(struct bpf_prog *fp) |
| 430 | { | 448 | { |
| 431 | } | 449 | } |
| 432 | 450 | ||
| 433 | static inline void bpf_jit_free(struct sk_filter *fp) | 451 | static inline void bpf_jit_free(struct bpf_prog *fp) |
| 434 | { | 452 | { |
| 435 | kfree(fp); | 453 | kfree(fp); |
| 436 | } | 454 | } |
diff --git a/include/linux/firmware.h b/include/linux/firmware.h index 59529330efd6..5c41c5e75b5c 100644 --- a/include/linux/firmware.h +++ b/include/linux/firmware.h | |||
| @@ -45,6 +45,8 @@ int request_firmware_nowait( | |||
| 45 | struct module *module, bool uevent, | 45 | struct module *module, bool uevent, |
| 46 | const char *name, struct device *device, gfp_t gfp, void *context, | 46 | const char *name, struct device *device, gfp_t gfp, void *context, |
| 47 | void (*cont)(const struct firmware *fw, void *context)); | 47 | void (*cont)(const struct firmware *fw, void *context)); |
| 48 | int request_firmware_direct(const struct firmware **fw, const char *name, | ||
| 49 | struct device *device); | ||
| 48 | 50 | ||
| 49 | void release_firmware(const struct firmware *fw); | 51 | void release_firmware(const struct firmware *fw); |
| 50 | #else | 52 | #else |
| @@ -66,13 +68,12 @@ static inline void release_firmware(const struct firmware *fw) | |||
| 66 | { | 68 | { |
| 67 | } | 69 | } |
| 68 | 70 | ||
| 69 | #endif | 71 | static inline int request_firmware_direct(const struct firmware **fw, |
| 72 | const char *name, | ||
| 73 | struct device *device) | ||
| 74 | { | ||
| 75 | return -EINVAL; | ||
| 76 | } | ||
| 70 | 77 | ||
| 71 | #ifdef CONFIG_FW_LOADER_USER_HELPER | ||
| 72 | int request_firmware_direct(const struct firmware **fw, const char *name, | ||
| 73 | struct device *device); | ||
| 74 | #else | ||
| 75 | #define request_firmware_direct request_firmware | ||
| 76 | #endif | 78 | #endif |
| 77 | |||
| 78 | #endif | 79 | #endif |
diff --git a/include/linux/fs.h b/include/linux/fs.h index e11d60cc867b..2daccaf4b547 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
| @@ -833,7 +833,7 @@ static inline struct file *get_file(struct file *f) | |||
| 833 | * | 833 | * |
| 834 | * Lockd stuffs a "host" pointer into this. | 834 | * Lockd stuffs a "host" pointer into this. |
| 835 | */ | 835 | */ |
| 836 | typedef struct files_struct *fl_owner_t; | 836 | typedef void *fl_owner_t; |
| 837 | 837 | ||
| 838 | struct file_lock_operations { | 838 | struct file_lock_operations { |
| 839 | void (*fl_copy_lock)(struct file_lock *, struct file_lock *); | 839 | void (*fl_copy_lock)(struct file_lock *, struct file_lock *); |
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h index 404a686a3644..6bb5e3f2a3b4 100644 --- a/include/linux/ftrace.h +++ b/include/linux/ftrace.h | |||
| @@ -33,8 +33,7 @@ | |||
| 33 | * features, then it must call an indirect function that | 33 | * features, then it must call an indirect function that |
| 34 | * does. Or at least does enough to prevent any unwelcomed side effects. | 34 | * does. Or at least does enough to prevent any unwelcomed side effects. |
| 35 | */ | 35 | */ |
| 36 | #if !defined(CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST) || \ | 36 | #if !ARCH_SUPPORTS_FTRACE_OPS |
| 37 | !ARCH_SUPPORTS_FTRACE_OPS | ||
| 38 | # define FTRACE_FORCE_LIST_FUNC 1 | 37 | # define FTRACE_FORCE_LIST_FUNC 1 |
| 39 | #else | 38 | #else |
| 40 | # define FTRACE_FORCE_LIST_FUNC 0 | 39 | # define FTRACE_FORCE_LIST_FUNC 0 |
| @@ -118,17 +117,18 @@ struct ftrace_ops { | |||
| 118 | ftrace_func_t func; | 117 | ftrace_func_t func; |
| 119 | struct ftrace_ops *next; | 118 | struct ftrace_ops *next; |
| 120 | unsigned long flags; | 119 | unsigned long flags; |
| 121 | int __percpu *disabled; | ||
| 122 | void *private; | 120 | void *private; |
| 121 | int __percpu *disabled; | ||
| 123 | #ifdef CONFIG_DYNAMIC_FTRACE | 122 | #ifdef CONFIG_DYNAMIC_FTRACE |
| 123 | int nr_trampolines; | ||
| 124 | struct ftrace_hash *notrace_hash; | 124 | struct ftrace_hash *notrace_hash; |
| 125 | struct ftrace_hash *filter_hash; | 125 | struct ftrace_hash *filter_hash; |
| 126 | struct ftrace_hash *tramp_hash; | ||
| 126 | struct mutex regex_lock; | 127 | struct mutex regex_lock; |
| 128 | unsigned long trampoline; | ||
| 127 | #endif | 129 | #endif |
| 128 | }; | 130 | }; |
| 129 | 131 | ||
| 130 | extern int function_trace_stop; | ||
| 131 | |||
| 132 | /* | 132 | /* |
| 133 | * Type of the current tracing. | 133 | * Type of the current tracing. |
| 134 | */ | 134 | */ |
| @@ -140,32 +140,6 @@ enum ftrace_tracing_type_t { | |||
| 140 | /* Current tracing type, default is FTRACE_TYPE_ENTER */ | 140 | /* Current tracing type, default is FTRACE_TYPE_ENTER */ |
| 141 | extern enum ftrace_tracing_type_t ftrace_tracing_type; | 141 | extern enum ftrace_tracing_type_t ftrace_tracing_type; |
| 142 | 142 | ||
| 143 | /** | ||
| 144 | * ftrace_stop - stop function tracer. | ||
| 145 | * | ||
| 146 | * A quick way to stop the function tracer. Note this an on off switch, | ||
| 147 | * it is not something that is recursive like preempt_disable. | ||
| 148 | * This does not disable the calling of mcount, it only stops the | ||
| 149 | * calling of functions from mcount. | ||
| 150 | */ | ||
| 151 | static inline void ftrace_stop(void) | ||
| 152 | { | ||
| 153 | function_trace_stop = 1; | ||
| 154 | } | ||
| 155 | |||
| 156 | /** | ||
| 157 | * ftrace_start - start the function tracer. | ||
| 158 | * | ||
| 159 | * This function is the inverse of ftrace_stop. This does not enable | ||
| 160 | * the function tracing if the function tracer is disabled. This only | ||
| 161 | * sets the function tracer flag to continue calling the functions | ||
| 162 | * from mcount. | ||
| 163 | */ | ||
| 164 | static inline void ftrace_start(void) | ||
| 165 | { | ||
| 166 | function_trace_stop = 0; | ||
| 167 | } | ||
| 168 | |||
| 169 | /* | 143 | /* |
| 170 | * The ftrace_ops must be a static and should also | 144 | * The ftrace_ops must be a static and should also |
| 171 | * be read_mostly. These functions do modify read_mostly variables | 145 | * be read_mostly. These functions do modify read_mostly variables |
| @@ -242,8 +216,6 @@ static inline int ftrace_nr_registered_ops(void) | |||
| 242 | } | 216 | } |
| 243 | static inline void clear_ftrace_function(void) { } | 217 | static inline void clear_ftrace_function(void) { } |
| 244 | static inline void ftrace_kill(void) { } | 218 | static inline void ftrace_kill(void) { } |
| 245 | static inline void ftrace_stop(void) { } | ||
| 246 | static inline void ftrace_start(void) { } | ||
| 247 | #endif /* CONFIG_FUNCTION_TRACER */ | 219 | #endif /* CONFIG_FUNCTION_TRACER */ |
| 248 | 220 | ||
| 249 | #ifdef CONFIG_STACK_TRACER | 221 | #ifdef CONFIG_STACK_TRACER |
| @@ -317,13 +289,20 @@ extern int ftrace_nr_registered_ops(void); | |||
| 317 | * from tracing that function. | 289 | * from tracing that function. |
| 318 | */ | 290 | */ |
| 319 | enum { | 291 | enum { |
| 320 | FTRACE_FL_ENABLED = (1UL << 29), | 292 | FTRACE_FL_ENABLED = (1UL << 31), |
| 321 | FTRACE_FL_REGS = (1UL << 30), | 293 | FTRACE_FL_REGS = (1UL << 30), |
| 322 | FTRACE_FL_REGS_EN = (1UL << 31) | 294 | FTRACE_FL_REGS_EN = (1UL << 29), |
| 295 | FTRACE_FL_TRAMP = (1UL << 28), | ||
| 296 | FTRACE_FL_TRAMP_EN = (1UL << 27), | ||
| 323 | }; | 297 | }; |
| 324 | 298 | ||
| 325 | #define FTRACE_FL_MASK (0x7UL << 29) | 299 | #define FTRACE_REF_MAX_SHIFT 27 |
| 326 | #define FTRACE_REF_MAX ((1UL << 29) - 1) | 300 | #define FTRACE_FL_BITS 5 |
| 301 | #define FTRACE_FL_MASKED_BITS ((1UL << FTRACE_FL_BITS) - 1) | ||
| 302 | #define FTRACE_FL_MASK (FTRACE_FL_MASKED_BITS << FTRACE_REF_MAX_SHIFT) | ||
| 303 | #define FTRACE_REF_MAX ((1UL << FTRACE_REF_MAX_SHIFT) - 1) | ||
| 304 | |||
| 305 | #define ftrace_rec_count(rec) ((rec)->flags & ~FTRACE_FL_MASK) | ||
| 327 | 306 | ||
| 328 | struct dyn_ftrace { | 307 | struct dyn_ftrace { |
| 329 | unsigned long ip; /* address of mcount call-site */ | 308 | unsigned long ip; /* address of mcount call-site */ |
| @@ -431,6 +410,10 @@ void ftrace_modify_all_code(int command); | |||
| 431 | #define FTRACE_ADDR ((unsigned long)ftrace_caller) | 410 | #define FTRACE_ADDR ((unsigned long)ftrace_caller) |
| 432 | #endif | 411 | #endif |
| 433 | 412 | ||
| 413 | #ifndef FTRACE_GRAPH_ADDR | ||
| 414 | #define FTRACE_GRAPH_ADDR ((unsigned long)ftrace_graph_caller) | ||
| 415 | #endif | ||
| 416 | |||
| 434 | #ifndef FTRACE_REGS_ADDR | 417 | #ifndef FTRACE_REGS_ADDR |
| 435 | #ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS | 418 | #ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS |
| 436 | # define FTRACE_REGS_ADDR ((unsigned long)ftrace_regs_caller) | 419 | # define FTRACE_REGS_ADDR ((unsigned long)ftrace_regs_caller) |
| @@ -439,6 +422,16 @@ void ftrace_modify_all_code(int command); | |||
| 439 | #endif | 422 | #endif |
| 440 | #endif | 423 | #endif |
| 441 | 424 | ||
| 425 | /* | ||
| 426 | * If an arch would like functions that are only traced | ||
| 427 | * by the function graph tracer to jump directly to its own | ||
| 428 | * trampoline, then they can define FTRACE_GRAPH_TRAMP_ADDR | ||
| 429 | * to be that address to jump to. | ||
| 430 | */ | ||
| 431 | #ifndef FTRACE_GRAPH_TRAMP_ADDR | ||
| 432 | #define FTRACE_GRAPH_TRAMP_ADDR ((unsigned long) 0) | ||
| 433 | #endif | ||
| 434 | |||
| 442 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER | 435 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER |
| 443 | extern void ftrace_graph_caller(void); | 436 | extern void ftrace_graph_caller(void); |
| 444 | extern int ftrace_enable_ftrace_graph_caller(void); | 437 | extern int ftrace_enable_ftrace_graph_caller(void); |
| @@ -736,6 +729,7 @@ extern char __irqentry_text_end[]; | |||
| 736 | extern int register_ftrace_graph(trace_func_graph_ret_t retfunc, | 729 | extern int register_ftrace_graph(trace_func_graph_ret_t retfunc, |
| 737 | trace_func_graph_ent_t entryfunc); | 730 | trace_func_graph_ent_t entryfunc); |
| 738 | 731 | ||
| 732 | extern bool ftrace_graph_is_dead(void); | ||
| 739 | extern void ftrace_graph_stop(void); | 733 | extern void ftrace_graph_stop(void); |
| 740 | 734 | ||
| 741 | /* The current handlers in use */ | 735 | /* The current handlers in use */ |
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h index cff3106ffe2c..06c6faa9e5cc 100644 --- a/include/linux/ftrace_event.h +++ b/include/linux/ftrace_event.h | |||
| @@ -272,7 +272,6 @@ struct ftrace_event_call { | |||
| 272 | struct trace_event event; | 272 | struct trace_event event; |
| 273 | const char *print_fmt; | 273 | const char *print_fmt; |
| 274 | struct event_filter *filter; | 274 | struct event_filter *filter; |
| 275 | struct list_head *files; | ||
| 276 | void *mod; | 275 | void *mod; |
| 277 | void *data; | 276 | void *data; |
| 278 | /* | 277 | /* |
| @@ -404,8 +403,6 @@ enum event_trigger_type { | |||
| 404 | ETT_EVENT_ENABLE = (1 << 3), | 403 | ETT_EVENT_ENABLE = (1 << 3), |
| 405 | }; | 404 | }; |
| 406 | 405 | ||
| 407 | extern void destroy_preds(struct ftrace_event_file *file); | ||
| 408 | extern void destroy_call_preds(struct ftrace_event_call *call); | ||
| 409 | extern int filter_match_preds(struct event_filter *filter, void *rec); | 406 | extern int filter_match_preds(struct event_filter *filter, void *rec); |
| 410 | 407 | ||
| 411 | extern int filter_check_discard(struct ftrace_event_file *file, void *rec, | 408 | extern int filter_check_discard(struct ftrace_event_file *file, void *rec, |
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h index e7a8d3fa91d5..a036d058a249 100644 --- a/include/linux/hrtimer.h +++ b/include/linux/hrtimer.h | |||
| @@ -165,6 +165,7 @@ enum hrtimer_base_type { | |||
| 165 | * struct hrtimer_cpu_base - the per cpu clock bases | 165 | * struct hrtimer_cpu_base - the per cpu clock bases |
| 166 | * @lock: lock protecting the base and associated clock bases | 166 | * @lock: lock protecting the base and associated clock bases |
| 167 | * and timers | 167 | * and timers |
| 168 | * @cpu: cpu number | ||
| 168 | * @active_bases: Bitfield to mark bases with active timers | 169 | * @active_bases: Bitfield to mark bases with active timers |
| 169 | * @clock_was_set: Indicates that clock was set from irq context. | 170 | * @clock_was_set: Indicates that clock was set from irq context. |
| 170 | * @expires_next: absolute time of the next event which was scheduled | 171 | * @expires_next: absolute time of the next event which was scheduled |
| @@ -179,6 +180,7 @@ enum hrtimer_base_type { | |||
| 179 | */ | 180 | */ |
| 180 | struct hrtimer_cpu_base { | 181 | struct hrtimer_cpu_base { |
| 181 | raw_spinlock_t lock; | 182 | raw_spinlock_t lock; |
| 183 | unsigned int cpu; | ||
| 182 | unsigned int active_bases; | 184 | unsigned int active_bases; |
| 183 | unsigned int clock_was_set; | 185 | unsigned int clock_was_set; |
| 184 | #ifdef CONFIG_HIGH_RES_TIMERS | 186 | #ifdef CONFIG_HIGH_RES_TIMERS |
| @@ -324,14 +326,6 @@ static inline void timerfd_clock_was_set(void) { } | |||
| 324 | #endif | 326 | #endif |
| 325 | extern void hrtimers_resume(void); | 327 | extern void hrtimers_resume(void); |
| 326 | 328 | ||
| 327 | extern ktime_t ktime_get(void); | ||
| 328 | extern ktime_t ktime_get_real(void); | ||
| 329 | extern ktime_t ktime_get_boottime(void); | ||
| 330 | extern ktime_t ktime_get_monotonic_offset(void); | ||
| 331 | extern ktime_t ktime_get_clocktai(void); | ||
| 332 | extern ktime_t ktime_get_update_offsets(ktime_t *offs_real, ktime_t *offs_boot, | ||
| 333 | ktime_t *offs_tai); | ||
| 334 | |||
| 335 | DECLARE_PER_CPU(struct tick_device, tick_cpu_device); | 329 | DECLARE_PER_CPU(struct tick_device, tick_cpu_device); |
| 336 | 330 | ||
| 337 | 331 | ||
| @@ -452,12 +446,6 @@ extern void hrtimer_run_pending(void); | |||
| 452 | /* Bootup initialization: */ | 446 | /* Bootup initialization: */ |
| 453 | extern void __init hrtimers_init(void); | 447 | extern void __init hrtimers_init(void); |
| 454 | 448 | ||
| 455 | #if BITS_PER_LONG < 64 | ||
| 456 | extern u64 ktime_divns(const ktime_t kt, s64 div); | ||
| 457 | #else /* BITS_PER_LONG < 64 */ | ||
| 458 | # define ktime_divns(kt, div) (u64)((kt).tv64 / (div)) | ||
| 459 | #endif | ||
| 460 | |||
| 461 | /* Show pending timers: */ | 449 | /* Show pending timers: */ |
| 462 | extern void sysrq_timer_list_show(void); | 450 | extern void sysrq_timer_list_show(void); |
| 463 | 451 | ||
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index 255cd5cc0754..a23c096b3080 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h | |||
| @@ -80,6 +80,7 @@ int dequeue_hwpoisoned_huge_page(struct page *page); | |||
| 80 | bool isolate_huge_page(struct page *page, struct list_head *list); | 80 | bool isolate_huge_page(struct page *page, struct list_head *list); |
| 81 | void putback_active_hugepage(struct page *page); | 81 | void putback_active_hugepage(struct page *page); |
| 82 | bool is_hugepage_active(struct page *page); | 82 | bool is_hugepage_active(struct page *page); |
| 83 | void free_huge_page(struct page *page); | ||
| 83 | 84 | ||
| 84 | #ifdef CONFIG_ARCH_WANT_HUGE_PMD_SHARE | 85 | #ifdef CONFIG_ARCH_WANT_HUGE_PMD_SHARE |
| 85 | pte_t *huge_pmd_share(struct mm_struct *mm, unsigned long addr, pud_t *pud); | 86 | pte_t *huge_pmd_share(struct mm_struct *mm, unsigned long addr, pud_t *pud); |
diff --git a/include/linux/hw_random.h b/include/linux/hw_random.h index b4b0eef5fddf..914bb08cd738 100644 --- a/include/linux/hw_random.h +++ b/include/linux/hw_random.h | |||
| @@ -29,6 +29,8 @@ | |||
| 29 | * @read: New API. drivers can fill up to max bytes of data | 29 | * @read: New API. drivers can fill up to max bytes of data |
| 30 | * into the buffer. The buffer is aligned for any type. | 30 | * into the buffer. The buffer is aligned for any type. |
| 31 | * @priv: Private data, for use by the RNG driver. | 31 | * @priv: Private data, for use by the RNG driver. |
| 32 | * @quality: Estimation of true entropy in RNG's bitstream | ||
| 33 | * (per mill). | ||
| 32 | */ | 34 | */ |
| 33 | struct hwrng { | 35 | struct hwrng { |
| 34 | const char *name; | 36 | const char *name; |
| @@ -38,6 +40,7 @@ struct hwrng { | |||
| 38 | int (*data_read)(struct hwrng *rng, u32 *data); | 40 | int (*data_read)(struct hwrng *rng, u32 *data); |
| 39 | int (*read)(struct hwrng *rng, void *data, size_t max, bool wait); | 41 | int (*read)(struct hwrng *rng, void *data, size_t max, bool wait); |
| 40 | unsigned long priv; | 42 | unsigned long priv; |
| 43 | unsigned short quality; | ||
| 41 | 44 | ||
| 42 | /* internal. */ | 45 | /* internal. */ |
| 43 | struct list_head list; | 46 | struct list_head list; |
| @@ -47,5 +50,7 @@ struct hwrng { | |||
| 47 | extern int hwrng_register(struct hwrng *rng); | 50 | extern int hwrng_register(struct hwrng *rng); |
| 48 | /** Unregister a Hardware Random Number Generator driver. */ | 51 | /** Unregister a Hardware Random Number Generator driver. */ |
| 49 | extern void hwrng_unregister(struct hwrng *rng); | 52 | extern void hwrng_unregister(struct hwrng *rng); |
| 53 | /** Feed random bits into the pool. */ | ||
| 54 | extern void add_hwgenerator_randomness(const char *buffer, size_t count, size_t entropy); | ||
| 50 | 55 | ||
| 51 | #endif /* LINUX_HWRANDOM_H_ */ | 56 | #endif /* LINUX_HWRANDOM_H_ */ |
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h index 6bff13f74050..63ab3873c5ed 100644 --- a/include/linux/ieee80211.h +++ b/include/linux/ieee80211.h | |||
| @@ -1001,6 +1001,26 @@ struct ieee80211_vendor_ie { | |||
| 1001 | u8 oui_type; | 1001 | u8 oui_type; |
| 1002 | } __packed; | 1002 | } __packed; |
| 1003 | 1003 | ||
| 1004 | struct ieee80211_wmm_ac_param { | ||
| 1005 | u8 aci_aifsn; /* AIFSN, ACM, ACI */ | ||
| 1006 | u8 cw; /* ECWmin, ECWmax (CW = 2^ECW - 1) */ | ||
| 1007 | __le16 txop_limit; | ||
| 1008 | } __packed; | ||
| 1009 | |||
| 1010 | struct ieee80211_wmm_param_ie { | ||
| 1011 | u8 element_id; /* Element ID: 221 (0xdd); */ | ||
| 1012 | u8 len; /* Length: 24 */ | ||
| 1013 | /* required fields for WMM version 1 */ | ||
| 1014 | u8 oui[3]; /* 00:50:f2 */ | ||
| 1015 | u8 oui_type; /* 2 */ | ||
| 1016 | u8 oui_subtype; /* 1 */ | ||
| 1017 | u8 version; /* 1 for WMM version 1.0 */ | ||
| 1018 | u8 qos_info; /* AP/STA specific QoS info */ | ||
| 1019 | u8 reserved; /* 0 */ | ||
| 1020 | /* AC_BE, AC_BK, AC_VI, AC_VO */ | ||
| 1021 | struct ieee80211_wmm_ac_param ac[4]; | ||
| 1022 | } __packed; | ||
| 1023 | |||
| 1004 | /* Control frames */ | 1024 | /* Control frames */ |
| 1005 | struct ieee80211_rts { | 1025 | struct ieee80211_rts { |
| 1006 | __le16 frame_control; | 1026 | __le16 frame_control; |
| @@ -1621,6 +1641,9 @@ enum ieee80211_reasoncode { | |||
| 1621 | WLAN_REASON_INVALID_RSN_IE_CAP = 22, | 1641 | WLAN_REASON_INVALID_RSN_IE_CAP = 22, |
| 1622 | WLAN_REASON_IEEE8021X_FAILED = 23, | 1642 | WLAN_REASON_IEEE8021X_FAILED = 23, |
| 1623 | WLAN_REASON_CIPHER_SUITE_REJECTED = 24, | 1643 | WLAN_REASON_CIPHER_SUITE_REJECTED = 24, |
| 1644 | /* TDLS (802.11z) */ | ||
| 1645 | WLAN_REASON_TDLS_TEARDOWN_UNREACHABLE = 25, | ||
| 1646 | WLAN_REASON_TDLS_TEARDOWN_UNSPECIFIED = 26, | ||
| 1624 | /* 802.11e */ | 1647 | /* 802.11e */ |
| 1625 | WLAN_REASON_DISASSOC_UNSPECIFIED_QOS = 32, | 1648 | WLAN_REASON_DISASSOC_UNSPECIFIED_QOS = 32, |
| 1626 | WLAN_REASON_DISASSOC_QAP_NO_BANDWIDTH = 33, | 1649 | WLAN_REASON_DISASSOC_QAP_NO_BANDWIDTH = 33, |
diff --git a/include/linux/if_bridge.h b/include/linux/if_bridge.h index fd22789d7b2e..808dcb8cc04f 100644 --- a/include/linux/if_bridge.h +++ b/include/linux/if_bridge.h | |||
| @@ -36,8 +36,28 @@ extern void brioctl_set(int (*ioctl_hook)(struct net *, unsigned int, void __use | |||
| 36 | 36 | ||
| 37 | typedef int br_should_route_hook_t(struct sk_buff *skb); | 37 | typedef int br_should_route_hook_t(struct sk_buff *skb); |
| 38 | extern br_should_route_hook_t __rcu *br_should_route_hook; | 38 | extern br_should_route_hook_t __rcu *br_should_route_hook; |
| 39 | |||
| 40 | #if IS_ENABLED(CONFIG_BRIDGE) && IS_ENABLED(CONFIG_BRIDGE_IGMP_SNOOPING) | ||
| 39 | int br_multicast_list_adjacent(struct net_device *dev, | 41 | int br_multicast_list_adjacent(struct net_device *dev, |
| 40 | struct list_head *br_ip_list); | 42 | struct list_head *br_ip_list); |
| 43 | bool br_multicast_has_querier_anywhere(struct net_device *dev, int proto); | ||
| 41 | bool br_multicast_has_querier_adjacent(struct net_device *dev, int proto); | 44 | bool br_multicast_has_querier_adjacent(struct net_device *dev, int proto); |
| 45 | #else | ||
| 46 | static inline int br_multicast_list_adjacent(struct net_device *dev, | ||
| 47 | struct list_head *br_ip_list) | ||
| 48 | { | ||
| 49 | return 0; | ||
| 50 | } | ||
| 51 | static inline bool br_multicast_has_querier_anywhere(struct net_device *dev, | ||
| 52 | int proto) | ||
| 53 | { | ||
| 54 | return false; | ||
| 55 | } | ||
| 56 | static inline bool br_multicast_has_querier_adjacent(struct net_device *dev, | ||
| 57 | int proto) | ||
| 58 | { | ||
| 59 | return false; | ||
| 60 | } | ||
| 61 | #endif | ||
| 42 | 62 | ||
| 43 | #endif | 63 | #endif |
diff --git a/include/linux/iio/accel/kxcjk_1013.h b/include/linux/iio/accel/kxcjk_1013.h new file mode 100644 index 000000000000..fd1d540ea62d --- /dev/null +++ b/include/linux/iio/accel/kxcjk_1013.h | |||
| @@ -0,0 +1,22 @@ | |||
| 1 | /* | ||
| 2 | * KXCJK-1013 3-axis accelerometer Interface | ||
| 3 | * Copyright (c) 2014, Intel Corporation. | ||
| 4 | * | ||
| 5 | * This program is free software; you can redistribute it and/or modify it | ||
| 6 | * under the terms and conditions of the GNU General Public License, | ||
| 7 | * version 2, as published by the Free Software Foundation. | ||
| 8 | * | ||
| 9 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
| 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
| 12 | * more details. | ||
| 13 | */ | ||
| 14 | |||
| 15 | #ifndef __IIO_KXCJK_1013_H__ | ||
| 16 | #define __IIO_KXCJK_1013_H__ | ||
| 17 | |||
| 18 | struct kxcjk_1013_platform_data { | ||
| 19 | bool active_high_intr; | ||
| 20 | }; | ||
| 21 | |||
| 22 | #endif | ||
diff --git a/include/linux/iio/common/st_sensors.h b/include/linux/iio/common/st_sensors.h index 96f51f0e0096..d8257ab60bac 100644 --- a/include/linux/iio/common/st_sensors.h +++ b/include/linux/iio/common/st_sensors.h | |||
| @@ -47,6 +47,7 @@ | |||
| 47 | .type = device_type, \ | 47 | .type = device_type, \ |
| 48 | .modified = mod, \ | 48 | .modified = mod, \ |
| 49 | .info_mask_separate = mask, \ | 49 | .info_mask_separate = mask, \ |
| 50 | .info_mask_shared_by_all = BIT(IIO_CHAN_INFO_SAMP_FREQ), \ | ||
| 50 | .scan_index = index, \ | 51 | .scan_index = index, \ |
| 51 | .channel2 = ch2, \ | 52 | .channel2 = ch2, \ |
| 52 | .address = addr, \ | 53 | .address = addr, \ |
| @@ -59,11 +60,6 @@ | |||
| 59 | }, \ | 60 | }, \ |
| 60 | } | 61 | } |
| 61 | 62 | ||
| 62 | #define ST_SENSOR_DEV_ATTR_SAMP_FREQ() \ | ||
| 63 | IIO_DEV_ATTR_SAMP_FREQ(S_IWUSR | S_IRUGO, \ | ||
| 64 | st_sensors_sysfs_get_sampling_frequency, \ | ||
| 65 | st_sensors_sysfs_set_sampling_frequency) | ||
| 66 | |||
| 67 | #define ST_SENSORS_DEV_ATTR_SAMP_FREQ_AVAIL() \ | 63 | #define ST_SENSORS_DEV_ATTR_SAMP_FREQ_AVAIL() \ |
| 68 | IIO_DEV_ATTR_SAMP_FREQ_AVAIL( \ | 64 | IIO_DEV_ATTR_SAMP_FREQ_AVAIL( \ |
| 69 | st_sensors_sysfs_sampling_frequency_avail) | 65 | st_sensors_sysfs_sampling_frequency_avail) |
| @@ -285,12 +281,6 @@ int st_sensors_read_info_raw(struct iio_dev *indio_dev, | |||
| 285 | int st_sensors_check_device_support(struct iio_dev *indio_dev, | 281 | int st_sensors_check_device_support(struct iio_dev *indio_dev, |
| 286 | int num_sensors_list, const struct st_sensors *sensors); | 282 | int num_sensors_list, const struct st_sensors *sensors); |
| 287 | 283 | ||
| 288 | ssize_t st_sensors_sysfs_get_sampling_frequency(struct device *dev, | ||
| 289 | struct device_attribute *attr, char *buf); | ||
| 290 | |||
| 291 | ssize_t st_sensors_sysfs_set_sampling_frequency(struct device *dev, | ||
| 292 | struct device_attribute *attr, const char *buf, size_t size); | ||
| 293 | |||
| 294 | ssize_t st_sensors_sysfs_sampling_frequency_avail(struct device *dev, | 284 | ssize_t st_sensors_sysfs_sampling_frequency_avail(struct device *dev, |
| 295 | struct device_attribute *attr, char *buf); | 285 | struct device_attribute *attr, char *buf); |
| 296 | 286 | ||
diff --git a/include/linux/iio/common/st_sensors_i2c.h b/include/linux/iio/common/st_sensors_i2c.h index 67d845385ae2..1796af093368 100644 --- a/include/linux/iio/common/st_sensors_i2c.h +++ b/include/linux/iio/common/st_sensors_i2c.h | |||
| @@ -13,8 +13,19 @@ | |||
| 13 | 13 | ||
| 14 | #include <linux/i2c.h> | 14 | #include <linux/i2c.h> |
| 15 | #include <linux/iio/common/st_sensors.h> | 15 | #include <linux/iio/common/st_sensors.h> |
| 16 | #include <linux/of.h> | ||
| 16 | 17 | ||
| 17 | void st_sensors_i2c_configure(struct iio_dev *indio_dev, | 18 | void st_sensors_i2c_configure(struct iio_dev *indio_dev, |
| 18 | struct i2c_client *client, struct st_sensor_data *sdata); | 19 | struct i2c_client *client, struct st_sensor_data *sdata); |
| 19 | 20 | ||
| 21 | #ifdef CONFIG_OF | ||
| 22 | void st_sensors_of_i2c_probe(struct i2c_client *client, | ||
| 23 | const struct of_device_id *match); | ||
| 24 | #else | ||
| 25 | static inline void st_sensors_of_i2c_probe(struct i2c_client *client, | ||
| 26 | const struct of_device_id *match) | ||
| 27 | { | ||
| 28 | } | ||
| 29 | #endif | ||
| 30 | |||
| 20 | #endif /* ST_SENSORS_I2C_H */ | 31 | #endif /* ST_SENSORS_I2C_H */ |
diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h index ccde91725f98..15dc6bc2bdd2 100644 --- a/include/linux/iio/iio.h +++ b/include/linux/iio/iio.h | |||
| @@ -277,14 +277,7 @@ static inline bool iio_channel_has_info(const struct iio_chan_spec *chan, | |||
| 277 | **/ | 277 | **/ |
| 278 | static inline s64 iio_get_time_ns(void) | 278 | static inline s64 iio_get_time_ns(void) |
| 279 | { | 279 | { |
| 280 | struct timespec ts; | 280 | return ktime_get_real_ns(); |
| 281 | /* | ||
| 282 | * calls getnstimeofday. | ||
| 283 | * If hrtimers then up to ns accurate, if not microsecond. | ||
| 284 | */ | ||
| 285 | ktime_get_real_ts(&ts); | ||
| 286 | |||
| 287 | return timespec_to_ns(&ts); | ||
| 288 | } | 281 | } |
| 289 | 282 | ||
| 290 | /* Device operating modes */ | 283 | /* Device operating modes */ |
diff --git a/include/linux/iio/imu/adis.h b/include/linux/iio/imu/adis.h index b665dc7f017b..fa2d01ef8f55 100644 --- a/include/linux/iio/imu/adis.h +++ b/include/linux/iio/imu/adis.h | |||
| @@ -157,13 +157,14 @@ int adis_single_conversion(struct iio_dev *indio_dev, | |||
| 157 | const struct iio_chan_spec *chan, unsigned int error_mask, | 157 | const struct iio_chan_spec *chan, unsigned int error_mask, |
| 158 | int *val); | 158 | int *val); |
| 159 | 159 | ||
| 160 | #define ADIS_VOLTAGE_CHAN(addr, si, chan, name, bits) { \ | 160 | #define ADIS_VOLTAGE_CHAN(addr, si, chan, name, info_all, bits) { \ |
| 161 | .type = IIO_VOLTAGE, \ | 161 | .type = IIO_VOLTAGE, \ |
| 162 | .indexed = 1, \ | 162 | .indexed = 1, \ |
| 163 | .channel = (chan), \ | 163 | .channel = (chan), \ |
| 164 | .extend_name = name, \ | 164 | .extend_name = name, \ |
| 165 | .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \ | 165 | .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \ |
| 166 | BIT(IIO_CHAN_INFO_SCALE), \ | 166 | BIT(IIO_CHAN_INFO_SCALE), \ |
| 167 | .info_mask_shared_by_all = info_all, \ | ||
| 167 | .address = (addr), \ | 168 | .address = (addr), \ |
| 168 | .scan_index = (si), \ | 169 | .scan_index = (si), \ |
| 169 | .scan_type = { \ | 170 | .scan_type = { \ |
| @@ -174,19 +175,20 @@ int adis_single_conversion(struct iio_dev *indio_dev, | |||
| 174 | }, \ | 175 | }, \ |
| 175 | } | 176 | } |
| 176 | 177 | ||
| 177 | #define ADIS_SUPPLY_CHAN(addr, si, bits) \ | 178 | #define ADIS_SUPPLY_CHAN(addr, si, info_all, bits) \ |
| 178 | ADIS_VOLTAGE_CHAN(addr, si, 0, "supply", bits) | 179 | ADIS_VOLTAGE_CHAN(addr, si, 0, "supply", info_all, bits) |
| 179 | 180 | ||
| 180 | #define ADIS_AUX_ADC_CHAN(addr, si, bits) \ | 181 | #define ADIS_AUX_ADC_CHAN(addr, si, info_all, bits) \ |
| 181 | ADIS_VOLTAGE_CHAN(addr, si, 1, NULL, bits) | 182 | ADIS_VOLTAGE_CHAN(addr, si, 1, NULL, info_all, bits) |
| 182 | 183 | ||
| 183 | #define ADIS_TEMP_CHAN(addr, si, bits) { \ | 184 | #define ADIS_TEMP_CHAN(addr, si, info_all, bits) { \ |
| 184 | .type = IIO_TEMP, \ | 185 | .type = IIO_TEMP, \ |
| 185 | .indexed = 1, \ | 186 | .indexed = 1, \ |
| 186 | .channel = 0, \ | 187 | .channel = 0, \ |
| 187 | .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \ | 188 | .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \ |
| 188 | BIT(IIO_CHAN_INFO_SCALE) | \ | 189 | BIT(IIO_CHAN_INFO_SCALE) | \ |
| 189 | BIT(IIO_CHAN_INFO_OFFSET), \ | 190 | BIT(IIO_CHAN_INFO_OFFSET), \ |
| 191 | .info_mask_shared_by_all = info_all, \ | ||
| 190 | .address = (addr), \ | 192 | .address = (addr), \ |
| 191 | .scan_index = (si), \ | 193 | .scan_index = (si), \ |
| 192 | .scan_type = { \ | 194 | .scan_type = { \ |
| @@ -197,13 +199,14 @@ int adis_single_conversion(struct iio_dev *indio_dev, | |||
| 197 | }, \ | 199 | }, \ |
| 198 | } | 200 | } |
| 199 | 201 | ||
| 200 | #define ADIS_MOD_CHAN(_type, mod, addr, si, info_sep, bits) { \ | 202 | #define ADIS_MOD_CHAN(_type, mod, addr, si, info_sep, info_all, bits) { \ |
| 201 | .type = (_type), \ | 203 | .type = (_type), \ |
| 202 | .modified = 1, \ | 204 | .modified = 1, \ |
| 203 | .channel2 = IIO_MOD_ ## mod, \ | 205 | .channel2 = IIO_MOD_ ## mod, \ |
| 204 | .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \ | 206 | .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \ |
| 205 | info_sep, \ | 207 | info_sep, \ |
| 206 | .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \ | 208 | .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \ |
| 209 | .info_mask_shared_by_all = info_all, \ | ||
| 207 | .address = (addr), \ | 210 | .address = (addr), \ |
| 208 | .scan_index = (si), \ | 211 | .scan_index = (si), \ |
| 209 | .scan_type = { \ | 212 | .scan_type = { \ |
| @@ -214,17 +217,17 @@ int adis_single_conversion(struct iio_dev *indio_dev, | |||
| 214 | }, \ | 217 | }, \ |
| 215 | } | 218 | } |
| 216 | 219 | ||
| 217 | #define ADIS_ACCEL_CHAN(mod, addr, si, info_sep, bits) \ | 220 | #define ADIS_ACCEL_CHAN(mod, addr, si, info_sep, info_all, bits) \ |
| 218 | ADIS_MOD_CHAN(IIO_ACCEL, mod, addr, si, info_sep, bits) | 221 | ADIS_MOD_CHAN(IIO_ACCEL, mod, addr, si, info_sep, info_all, bits) |
| 219 | 222 | ||
| 220 | #define ADIS_GYRO_CHAN(mod, addr, si, info_sep, bits) \ | 223 | #define ADIS_GYRO_CHAN(mod, addr, si, info_sep, info_all, bits) \ |
| 221 | ADIS_MOD_CHAN(IIO_ANGL_VEL, mod, addr, si, info_sep, bits) | 224 | ADIS_MOD_CHAN(IIO_ANGL_VEL, mod, addr, si, info_sep, info_all, bits) |
| 222 | 225 | ||
| 223 | #define ADIS_INCLI_CHAN(mod, addr, si, info_sep, bits) \ | 226 | #define ADIS_INCLI_CHAN(mod, addr, si, info_sep, info_all, bits) \ |
| 224 | ADIS_MOD_CHAN(IIO_INCLI, mod, addr, si, info_sep, bits) | 227 | ADIS_MOD_CHAN(IIO_INCLI, mod, addr, si, info_sep, info_all, bits) |
| 225 | 228 | ||
| 226 | #define ADIS_ROT_CHAN(mod, addr, si, info_sep, bits) \ | 229 | #define ADIS_ROT_CHAN(mod, addr, si, info_sep, info_all, bits) \ |
| 227 | ADIS_MOD_CHAN(IIO_ROT, mod, addr, si, info_sep, bits) | 230 | ADIS_MOD_CHAN(IIO_ROT, mod, addr, si, info_sep, info_all, bits) |
| 228 | 231 | ||
| 229 | #ifdef CONFIG_IIO_ADIS_LIB_BUFFER | 232 | #ifdef CONFIG_IIO_ADIS_LIB_BUFFER |
| 230 | 233 | ||
diff --git a/include/linux/iio/trigger.h b/include/linux/iio/trigger.h index 369cf2cd5144..4b79ffe7b188 100644 --- a/include/linux/iio/trigger.h +++ b/include/linux/iio/trigger.h | |||
| @@ -129,12 +129,11 @@ void iio_trigger_unregister(struct iio_trigger *trig_info); | |||
| 129 | /** | 129 | /** |
| 130 | * iio_trigger_poll() - called on a trigger occurring | 130 | * iio_trigger_poll() - called on a trigger occurring |
| 131 | * @trig: trigger which occurred | 131 | * @trig: trigger which occurred |
| 132 | * @time: timestamp when trigger occurred | ||
| 133 | * | 132 | * |
| 134 | * Typically called in relevant hardware interrupt handler. | 133 | * Typically called in relevant hardware interrupt handler. |
| 135 | **/ | 134 | **/ |
| 136 | void iio_trigger_poll(struct iio_trigger *trig, s64 time); | 135 | void iio_trigger_poll(struct iio_trigger *trig); |
| 137 | void iio_trigger_poll_chained(struct iio_trigger *trig, s64 time); | 136 | void iio_trigger_poll_chained(struct iio_trigger *trig); |
| 138 | 137 | ||
| 139 | irqreturn_t iio_trigger_generic_data_rdy_poll(int irq, void *private); | 138 | irqreturn_t iio_trigger_generic_data_rdy_poll(int irq, void *private); |
| 140 | 139 | ||
diff --git a/include/linux/iio/types.h b/include/linux/iio/types.h index d480631eabc2..4a2af8adf874 100644 --- a/include/linux/iio/types.h +++ b/include/linux/iio/types.h | |||
| @@ -56,6 +56,10 @@ enum iio_modifier { | |||
| 56 | IIO_MOD_QUATERNION, | 56 | IIO_MOD_QUATERNION, |
| 57 | IIO_MOD_TEMP_AMBIENT, | 57 | IIO_MOD_TEMP_AMBIENT, |
| 58 | IIO_MOD_TEMP_OBJECT, | 58 | IIO_MOD_TEMP_OBJECT, |
| 59 | IIO_MOD_NORTH_MAGN, | ||
| 60 | IIO_MOD_NORTH_TRUE, | ||
| 61 | IIO_MOD_NORTH_MAGN_TILT_COMP, | ||
| 62 | IIO_MOD_NORTH_TRUE_TILT_COMP | ||
| 59 | }; | 63 | }; |
| 60 | 64 | ||
| 61 | enum iio_event_type { | 65 | enum iio_event_type { |
| @@ -70,6 +74,7 @@ enum iio_event_info { | |||
| 70 | IIO_EV_INFO_ENABLE, | 74 | IIO_EV_INFO_ENABLE, |
| 71 | IIO_EV_INFO_VALUE, | 75 | IIO_EV_INFO_VALUE, |
| 72 | IIO_EV_INFO_HYSTERESIS, | 76 | IIO_EV_INFO_HYSTERESIS, |
| 77 | IIO_EV_INFO_PERIOD, | ||
| 73 | }; | 78 | }; |
| 74 | 79 | ||
| 75 | enum iio_event_direction { | 80 | enum iio_event_direction { |
diff --git a/include/linux/ima.h b/include/linux/ima.h index 1b7f268cddce..7cf5e9b32550 100644 --- a/include/linux/ima.h +++ b/include/linux/ima.h | |||
| @@ -19,6 +19,7 @@ extern int ima_file_check(struct file *file, int mask); | |||
| 19 | extern void ima_file_free(struct file *file); | 19 | extern void ima_file_free(struct file *file); |
| 20 | extern int ima_file_mmap(struct file *file, unsigned long prot); | 20 | extern int ima_file_mmap(struct file *file, unsigned long prot); |
| 21 | extern int ima_module_check(struct file *file); | 21 | extern int ima_module_check(struct file *file); |
| 22 | extern int ima_fw_from_file(struct file *file, char *buf, size_t size); | ||
| 22 | 23 | ||
| 23 | #else | 24 | #else |
| 24 | static inline int ima_bprm_check(struct linux_binprm *bprm) | 25 | static inline int ima_bprm_check(struct linux_binprm *bprm) |
| @@ -46,6 +47,11 @@ static inline int ima_module_check(struct file *file) | |||
| 46 | return 0; | 47 | return 0; |
| 47 | } | 48 | } |
| 48 | 49 | ||
| 50 | static inline int ima_fw_from_file(struct file *file, char *buf, size_t size) | ||
| 51 | { | ||
| 52 | return 0; | ||
| 53 | } | ||
| 54 | |||
| 49 | #endif /* CONFIG_IMA */ | 55 | #endif /* CONFIG_IMA */ |
| 50 | 56 | ||
| 51 | #ifdef CONFIG_IMA_APPRAISE | 57 | #ifdef CONFIG_IMA_APPRAISE |
diff --git a/include/linux/init_task.h b/include/linux/init_task.h index 6df7f9fe0d01..2bb4c4f3531a 100644 --- a/include/linux/init_task.h +++ b/include/linux/init_task.h | |||
| @@ -102,12 +102,6 @@ extern struct group_info init_groups; | |||
| 102 | #define INIT_IDS | 102 | #define INIT_IDS |
| 103 | #endif | 103 | #endif |
| 104 | 104 | ||
| 105 | #ifdef CONFIG_RCU_BOOST | ||
| 106 | #define INIT_TASK_RCU_BOOST() \ | ||
| 107 | .rcu_boost_mutex = NULL, | ||
| 108 | #else | ||
| 109 | #define INIT_TASK_RCU_BOOST() | ||
| 110 | #endif | ||
| 111 | #ifdef CONFIG_TREE_PREEMPT_RCU | 105 | #ifdef CONFIG_TREE_PREEMPT_RCU |
| 112 | #define INIT_TASK_RCU_TREE_PREEMPT() \ | 106 | #define INIT_TASK_RCU_TREE_PREEMPT() \ |
| 113 | .rcu_blocked_node = NULL, | 107 | .rcu_blocked_node = NULL, |
| @@ -119,8 +113,7 @@ extern struct group_info init_groups; | |||
| 119 | .rcu_read_lock_nesting = 0, \ | 113 | .rcu_read_lock_nesting = 0, \ |
| 120 | .rcu_read_unlock_special = 0, \ | 114 | .rcu_read_unlock_special = 0, \ |
| 121 | .rcu_node_entry = LIST_HEAD_INIT(tsk.rcu_node_entry), \ | 115 | .rcu_node_entry = LIST_HEAD_INIT(tsk.rcu_node_entry), \ |
| 122 | INIT_TASK_RCU_TREE_PREEMPT() \ | 116 | INIT_TASK_RCU_TREE_PREEMPT() |
| 123 | INIT_TASK_RCU_BOOST() | ||
| 124 | #else | 117 | #else |
| 125 | #define INIT_TASK_RCU_PREEMPT(tsk) | 118 | #define INIT_TASK_RCU_PREEMPT(tsk) |
| 126 | #endif | 119 | #endif |
diff --git a/include/linux/intel-iommu.h b/include/linux/intel-iommu.h index 0a2da5188217..a65208a8fe18 100644 --- a/include/linux/intel-iommu.h +++ b/include/linux/intel-iommu.h | |||
| @@ -336,6 +336,7 @@ struct intel_iommu { | |||
| 336 | #ifdef CONFIG_IRQ_REMAP | 336 | #ifdef CONFIG_IRQ_REMAP |
| 337 | struct ir_table *ir_table; /* Interrupt remapping info */ | 337 | struct ir_table *ir_table; /* Interrupt remapping info */ |
| 338 | #endif | 338 | #endif |
| 339 | struct device *iommu_dev; /* IOMMU-sysfs device */ | ||
| 339 | int node; | 340 | int node; |
| 340 | }; | 341 | }; |
| 341 | 342 | ||
| @@ -365,4 +366,6 @@ extern int qi_submit_sync(struct qi_desc *desc, struct intel_iommu *iommu); | |||
| 365 | 366 | ||
| 366 | extern int dmar_ir_support(void); | 367 | extern int dmar_ir_support(void); |
| 367 | 368 | ||
| 369 | extern const struct attribute_group *intel_iommu_groups[]; | ||
| 370 | |||
| 368 | #endif | 371 | #endif |
diff --git a/include/linux/io.h b/include/linux/io.h index b76e6e545806..d5fc9b8d8b03 100644 --- a/include/linux/io.h +++ b/include/linux/io.h | |||
| @@ -58,6 +58,8 @@ static inline void devm_ioport_unmap(struct device *dev, void __iomem *addr) | |||
| 58 | } | 58 | } |
| 59 | #endif | 59 | #endif |
| 60 | 60 | ||
| 61 | #define IOMEM_ERR_PTR(err) (__force void __iomem *)ERR_PTR(err) | ||
| 62 | |||
| 61 | void __iomem *devm_ioremap(struct device *dev, resource_size_t offset, | 63 | void __iomem *devm_ioremap(struct device *dev, resource_size_t offset, |
| 62 | unsigned long size); | 64 | unsigned long size); |
| 63 | void __iomem *devm_ioremap_nocache(struct device *dev, resource_size_t offset, | 65 | void __iomem *devm_ioremap_nocache(struct device *dev, resource_size_t offset, |
diff --git a/include/linux/iommu.h b/include/linux/iommu.h index b96a5b2136e4..20f9a527922a 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h | |||
| @@ -50,7 +50,7 @@ struct iommu_domain_geometry { | |||
| 50 | }; | 50 | }; |
| 51 | 51 | ||
| 52 | struct iommu_domain { | 52 | struct iommu_domain { |
| 53 | struct iommu_ops *ops; | 53 | const struct iommu_ops *ops; |
| 54 | void *priv; | 54 | void *priv; |
| 55 | iommu_fault_handler_t handler; | 55 | iommu_fault_handler_t handler; |
| 56 | void *handler_token; | 56 | void *handler_token; |
| @@ -140,7 +140,7 @@ struct iommu_ops { | |||
| 140 | #define IOMMU_GROUP_NOTIFY_UNBIND_DRIVER 5 /* Pre Driver unbind */ | 140 | #define IOMMU_GROUP_NOTIFY_UNBIND_DRIVER 5 /* Pre Driver unbind */ |
| 141 | #define IOMMU_GROUP_NOTIFY_UNBOUND_DRIVER 6 /* Post Driver unbind */ | 141 | #define IOMMU_GROUP_NOTIFY_UNBOUND_DRIVER 6 /* Post Driver unbind */ |
| 142 | 142 | ||
| 143 | extern int bus_set_iommu(struct bus_type *bus, struct iommu_ops *ops); | 143 | extern int bus_set_iommu(struct bus_type *bus, const struct iommu_ops *ops); |
| 144 | extern bool iommu_present(struct bus_type *bus); | 144 | extern bool iommu_present(struct bus_type *bus); |
| 145 | extern struct iommu_domain *iommu_domain_alloc(struct bus_type *bus); | 145 | extern struct iommu_domain *iommu_domain_alloc(struct bus_type *bus); |
| 146 | extern struct iommu_group *iommu_group_get_by_id(int id); | 146 | extern struct iommu_group *iommu_group_get_by_id(int id); |
| @@ -181,11 +181,18 @@ extern int iommu_group_register_notifier(struct iommu_group *group, | |||
| 181 | extern int iommu_group_unregister_notifier(struct iommu_group *group, | 181 | extern int iommu_group_unregister_notifier(struct iommu_group *group, |
| 182 | struct notifier_block *nb); | 182 | struct notifier_block *nb); |
| 183 | extern int iommu_group_id(struct iommu_group *group); | 183 | extern int iommu_group_id(struct iommu_group *group); |
| 184 | extern struct iommu_group *iommu_group_get_for_dev(struct device *dev); | ||
| 184 | 185 | ||
| 185 | extern int iommu_domain_get_attr(struct iommu_domain *domain, enum iommu_attr, | 186 | extern int iommu_domain_get_attr(struct iommu_domain *domain, enum iommu_attr, |
| 186 | void *data); | 187 | void *data); |
| 187 | extern int iommu_domain_set_attr(struct iommu_domain *domain, enum iommu_attr, | 188 | extern int iommu_domain_set_attr(struct iommu_domain *domain, enum iommu_attr, |
| 188 | void *data); | 189 | void *data); |
| 190 | struct device *iommu_device_create(struct device *parent, void *drvdata, | ||
| 191 | const struct attribute_group **groups, | ||
| 192 | const char *fmt, ...); | ||
| 193 | void iommu_device_destroy(struct device *dev); | ||
| 194 | int iommu_device_link(struct device *dev, struct device *link); | ||
| 195 | void iommu_device_unlink(struct device *dev, struct device *link); | ||
| 189 | 196 | ||
| 190 | /* Window handling function prototypes */ | 197 | /* Window handling function prototypes */ |
| 191 | extern int iommu_domain_window_enable(struct iommu_domain *domain, u32 wnd_nr, | 198 | extern int iommu_domain_window_enable(struct iommu_domain *domain, u32 wnd_nr, |
| @@ -396,6 +403,27 @@ static inline int iommu_domain_set_attr(struct iommu_domain *domain, | |||
| 396 | return -EINVAL; | 403 | return -EINVAL; |
| 397 | } | 404 | } |
| 398 | 405 | ||
| 406 | static inline struct device *iommu_device_create(struct device *parent, | ||
| 407 | void *drvdata, | ||
| 408 | const struct attribute_group **groups, | ||
| 409 | const char *fmt, ...) | ||
| 410 | { | ||
| 411 | return ERR_PTR(-ENODEV); | ||
| 412 | } | ||
| 413 | |||
| 414 | static inline void iommu_device_destroy(struct device *dev) | ||
| 415 | { | ||
| 416 | } | ||
| 417 | |||
| 418 | static inline int iommu_device_link(struct device *dev, struct device *link) | ||
| 419 | { | ||
| 420 | return -EINVAL; | ||
| 421 | } | ||
| 422 | |||
| 423 | static inline void iommu_device_unlink(struct device *dev, struct device *link) | ||
| 424 | { | ||
| 425 | } | ||
| 426 | |||
| 399 | #endif /* CONFIG_IOMMU_API */ | 427 | #endif /* CONFIG_IOMMU_API */ |
| 400 | 428 | ||
| 401 | #endif /* __LINUX_IOMMU_H */ | 429 | #endif /* __LINUX_IOMMU_H */ |
diff --git a/include/linux/iova.h b/include/linux/iova.h index 3277f4711349..19e81d5ccb6d 100644 --- a/include/linux/iova.h +++ b/include/linux/iova.h | |||
| @@ -34,6 +34,11 @@ struct iova_domain { | |||
| 34 | unsigned long dma_32bit_pfn; | 34 | unsigned long dma_32bit_pfn; |
| 35 | }; | 35 | }; |
| 36 | 36 | ||
| 37 | static inline unsigned long iova_size(struct iova *iova) | ||
| 38 | { | ||
| 39 | return iova->pfn_hi - iova->pfn_lo + 1; | ||
| 40 | } | ||
| 41 | |||
| 37 | struct iova *alloc_iova_mem(void); | 42 | struct iova *alloc_iova_mem(void); |
| 38 | void free_iova_mem(struct iova *iova); | 43 | void free_iova_mem(struct iova *iova); |
| 39 | void free_iova(struct iova_domain *iovad, unsigned long pfn); | 44 | void free_iova(struct iova_domain *iovad, unsigned long pfn); |
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h index 2faef339d8f2..ff560537dd61 100644 --- a/include/linux/ipv6.h +++ b/include/linux/ipv6.h | |||
| @@ -39,6 +39,7 @@ struct ipv6_devconf { | |||
| 39 | #endif | 39 | #endif |
| 40 | __s32 proxy_ndp; | 40 | __s32 proxy_ndp; |
| 41 | __s32 accept_source_route; | 41 | __s32 accept_source_route; |
| 42 | __s32 accept_ra_from_local; | ||
| 42 | #ifdef CONFIG_IPV6_OPTIMISTIC_DAD | 43 | #ifdef CONFIG_IPV6_OPTIMISTIC_DAD |
| 43 | __s32 optimistic_dad; | 44 | __s32 optimistic_dad; |
| 44 | #endif | 45 | #endif |
| @@ -193,12 +194,13 @@ struct ipv6_pinfo { | |||
| 193 | sndflow:1, | 194 | sndflow:1, |
| 194 | repflow:1, | 195 | repflow:1, |
| 195 | pmtudisc:3, | 196 | pmtudisc:3, |
| 196 | ipv6only:1, | 197 | padding:1, /* 1 bit hole */ |
| 197 | srcprefs:3, /* 001: prefer temporary address | 198 | srcprefs:3, /* 001: prefer temporary address |
| 198 | * 010: prefer public address | 199 | * 010: prefer public address |
| 199 | * 100: prefer care-of address | 200 | * 100: prefer care-of address |
| 200 | */ | 201 | */ |
| 201 | dontfrag:1; | 202 | dontfrag:1, |
| 203 | autoflowlabel:1; | ||
| 202 | __u8 min_hopcount; | 204 | __u8 min_hopcount; |
| 203 | __u8 tclass; | 205 | __u8 tclass; |
| 204 | __be32 rcv_flowinfo; | 206 | __be32 rcv_flowinfo; |
| @@ -256,16 +258,6 @@ static inline struct ipv6_pinfo * inet6_sk(const struct sock *__sk) | |||
| 256 | return inet_sk(__sk)->pinet6; | 258 | return inet_sk(__sk)->pinet6; |
| 257 | } | 259 | } |
| 258 | 260 | ||
| 259 | static inline struct request_sock *inet6_reqsk_alloc(struct request_sock_ops *ops) | ||
| 260 | { | ||
| 261 | struct request_sock *req = reqsk_alloc(ops); | ||
| 262 | |||
| 263 | if (req) | ||
| 264 | inet_rsk(req)->pktopts = NULL; | ||
| 265 | |||
| 266 | return req; | ||
| 267 | } | ||
| 268 | |||
| 269 | static inline struct raw6_sock *raw6_sk(const struct sock *sk) | 261 | static inline struct raw6_sock *raw6_sk(const struct sock *sk) |
| 270 | { | 262 | { |
| 271 | return (struct raw6_sock *)sk; | 263 | return (struct raw6_sock *)sk; |
| @@ -282,8 +274,8 @@ static inline void inet_sk_copy_descendant(struct sock *sk_to, | |||
| 282 | __inet_sk_copy_descendant(sk_to, sk_from, ancestor_size); | 274 | __inet_sk_copy_descendant(sk_to, sk_from, ancestor_size); |
| 283 | } | 275 | } |
| 284 | 276 | ||
| 285 | #define __ipv6_only_sock(sk) (inet6_sk(sk)->ipv6only) | 277 | #define __ipv6_only_sock(sk) (sk->sk_ipv6only) |
| 286 | #define ipv6_only_sock(sk) ((sk)->sk_family == PF_INET6 && __ipv6_only_sock(sk)) | 278 | #define ipv6_only_sock(sk) (__ipv6_only_sock(sk)) |
| 287 | #define ipv6_sk_rxinfo(sk) ((sk)->sk_family == PF_INET6 && \ | 279 | #define ipv6_sk_rxinfo(sk) ((sk)->sk_family == PF_INET6 && \ |
| 288 | inet6_sk(sk)->rxopt.bits.rxinfo) | 280 | inet6_sk(sk)->rxopt.bits.rxinfo) |
| 289 | 281 | ||
| @@ -296,8 +288,8 @@ static inline const struct in6_addr *inet6_rcv_saddr(const struct sock *sk) | |||
| 296 | 288 | ||
| 297 | static inline int inet_v6_ipv6only(const struct sock *sk) | 289 | static inline int inet_v6_ipv6only(const struct sock *sk) |
| 298 | { | 290 | { |
| 299 | return likely(sk->sk_state != TCP_TIME_WAIT) ? | 291 | /* ipv6only field is at same position for timewait and other sockets */ |
| 300 | ipv6_only_sock(sk) : inet_twsk(sk)->tw_ipv6only; | 292 | return ipv6_only_sock(sk); |
| 301 | } | 293 | } |
| 302 | #else | 294 | #else |
| 303 | #define __ipv6_only_sock(sk) 0 | 295 | #define __ipv6_only_sock(sk) 0 |
diff --git a/include/linux/irq.h b/include/linux/irq.h index 0d998d8b01d8..62af59242ddc 100644 --- a/include/linux/irq.h +++ b/include/linux/irq.h | |||
| @@ -771,6 +771,8 @@ void irq_gc_eoi(struct irq_data *d); | |||
| 771 | int irq_gc_set_wake(struct irq_data *d, unsigned int on); | 771 | int irq_gc_set_wake(struct irq_data *d, unsigned int on); |
| 772 | 772 | ||
| 773 | /* Setup functions for irq_chip_generic */ | 773 | /* Setup functions for irq_chip_generic */ |
| 774 | int irq_map_generic_chip(struct irq_domain *d, unsigned int virq, | ||
| 775 | irq_hw_number_t hw_irq); | ||
| 774 | struct irq_chip_generic * | 776 | struct irq_chip_generic * |
| 775 | irq_alloc_generic_chip(const char *name, int nr_ct, unsigned int irq_base, | 777 | irq_alloc_generic_chip(const char *name, int nr_ct, unsigned int irq_base, |
| 776 | void __iomem *reg_base, irq_flow_handler_t handler); | 778 | void __iomem *reg_base, irq_flow_handler_t handler); |
diff --git a/include/linux/irq_work.h b/include/linux/irq_work.h index 19ae05d4b8ec..bf9422c3aefe 100644 --- a/include/linux/irq_work.h +++ b/include/linux/irq_work.h | |||
| @@ -33,6 +33,11 @@ void init_irq_work(struct irq_work *work, void (*func)(struct irq_work *)) | |||
| 33 | #define DEFINE_IRQ_WORK(name, _f) struct irq_work name = { .func = (_f), } | 33 | #define DEFINE_IRQ_WORK(name, _f) struct irq_work name = { .func = (_f), } |
| 34 | 34 | ||
| 35 | bool irq_work_queue(struct irq_work *work); | 35 | bool irq_work_queue(struct irq_work *work); |
| 36 | |||
| 37 | #ifdef CONFIG_SMP | ||
| 38 | bool irq_work_queue_on(struct irq_work *work, int cpu); | ||
| 39 | #endif | ||
| 40 | |||
| 36 | void irq_work_run(void); | 41 | void irq_work_run(void); |
| 37 | void irq_work_sync(struct irq_work *work); | 42 | void irq_work_sync(struct irq_work *work); |
| 38 | 43 | ||
diff --git a/include/linux/irqchip/arm-gic-v3.h b/include/linux/irqchip/arm-gic-v3.h new file mode 100644 index 000000000000..03a4ea37ba86 --- /dev/null +++ b/include/linux/irqchip/arm-gic-v3.h | |||
| @@ -0,0 +1,200 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2013, 2014 ARM Limited, All Rights Reserved. | ||
| 3 | * Author: Marc Zyngier <marc.zyngier@arm.com> | ||
| 4 | * | ||
| 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 version 2 as | ||
| 8 | * published by the Free Software Foundation. | ||
| 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, see <http://www.gnu.org/licenses/>. | ||
| 17 | */ | ||
| 18 | #ifndef __LINUX_IRQCHIP_ARM_GIC_V3_H | ||
| 19 | #define __LINUX_IRQCHIP_ARM_GIC_V3_H | ||
| 20 | |||
| 21 | #include <asm/sysreg.h> | ||
| 22 | |||
| 23 | /* | ||
| 24 | * Distributor registers. We assume we're running non-secure, with ARE | ||
| 25 | * being set. Secure-only and non-ARE registers are not described. | ||
| 26 | */ | ||
| 27 | #define GICD_CTLR 0x0000 | ||
| 28 | #define GICD_TYPER 0x0004 | ||
| 29 | #define GICD_IIDR 0x0008 | ||
| 30 | #define GICD_STATUSR 0x0010 | ||
| 31 | #define GICD_SETSPI_NSR 0x0040 | ||
| 32 | #define GICD_CLRSPI_NSR 0x0048 | ||
| 33 | #define GICD_SETSPI_SR 0x0050 | ||
| 34 | #define GICD_CLRSPI_SR 0x0058 | ||
| 35 | #define GICD_SEIR 0x0068 | ||
| 36 | #define GICD_ISENABLER 0x0100 | ||
| 37 | #define GICD_ICENABLER 0x0180 | ||
| 38 | #define GICD_ISPENDR 0x0200 | ||
| 39 | #define GICD_ICPENDR 0x0280 | ||
| 40 | #define GICD_ISACTIVER 0x0300 | ||
| 41 | #define GICD_ICACTIVER 0x0380 | ||
| 42 | #define GICD_IPRIORITYR 0x0400 | ||
| 43 | #define GICD_ICFGR 0x0C00 | ||
| 44 | #define GICD_IROUTER 0x6000 | ||
| 45 | #define GICD_PIDR2 0xFFE8 | ||
| 46 | |||
| 47 | #define GICD_CTLR_RWP (1U << 31) | ||
| 48 | #define GICD_CTLR_ARE_NS (1U << 4) | ||
| 49 | #define GICD_CTLR_ENABLE_G1A (1U << 1) | ||
| 50 | #define GICD_CTLR_ENABLE_G1 (1U << 0) | ||
| 51 | |||
| 52 | #define GICD_IROUTER_SPI_MODE_ONE (0U << 31) | ||
| 53 | #define GICD_IROUTER_SPI_MODE_ANY (1U << 31) | ||
| 54 | |||
| 55 | #define GIC_PIDR2_ARCH_MASK 0xf0 | ||
| 56 | #define GIC_PIDR2_ARCH_GICv3 0x30 | ||
| 57 | #define GIC_PIDR2_ARCH_GICv4 0x40 | ||
| 58 | |||
| 59 | /* | ||
| 60 | * Re-Distributor registers, offsets from RD_base | ||
| 61 | */ | ||
| 62 | #define GICR_CTLR GICD_CTLR | ||
| 63 | #define GICR_IIDR 0x0004 | ||
| 64 | #define GICR_TYPER 0x0008 | ||
| 65 | #define GICR_STATUSR GICD_STATUSR | ||
| 66 | #define GICR_WAKER 0x0014 | ||
| 67 | #define GICR_SETLPIR 0x0040 | ||
| 68 | #define GICR_CLRLPIR 0x0048 | ||
| 69 | #define GICR_SEIR GICD_SEIR | ||
| 70 | #define GICR_PROPBASER 0x0070 | ||
| 71 | #define GICR_PENDBASER 0x0078 | ||
| 72 | #define GICR_INVLPIR 0x00A0 | ||
| 73 | #define GICR_INVALLR 0x00B0 | ||
| 74 | #define GICR_SYNCR 0x00C0 | ||
| 75 | #define GICR_MOVLPIR 0x0100 | ||
| 76 | #define GICR_MOVALLR 0x0110 | ||
| 77 | #define GICR_PIDR2 GICD_PIDR2 | ||
| 78 | |||
| 79 | #define GICR_WAKER_ProcessorSleep (1U << 1) | ||
| 80 | #define GICR_WAKER_ChildrenAsleep (1U << 2) | ||
| 81 | |||
| 82 | /* | ||
| 83 | * Re-Distributor registers, offsets from SGI_base | ||
| 84 | */ | ||
| 85 | #define GICR_ISENABLER0 GICD_ISENABLER | ||
| 86 | #define GICR_ICENABLER0 GICD_ICENABLER | ||
| 87 | #define GICR_ISPENDR0 GICD_ISPENDR | ||
| 88 | #define GICR_ICPENDR0 GICD_ICPENDR | ||
| 89 | #define GICR_ISACTIVER0 GICD_ISACTIVER | ||
| 90 | #define GICR_ICACTIVER0 GICD_ICACTIVER | ||
| 91 | #define GICR_IPRIORITYR0 GICD_IPRIORITYR | ||
| 92 | #define GICR_ICFGR0 GICD_ICFGR | ||
| 93 | |||
| 94 | #define GICR_TYPER_VLPIS (1U << 1) | ||
| 95 | #define GICR_TYPER_LAST (1U << 4) | ||
| 96 | |||
| 97 | /* | ||
| 98 | * CPU interface registers | ||
| 99 | */ | ||
| 100 | #define ICC_CTLR_EL1_EOImode_drop_dir (0U << 1) | ||
| 101 | #define ICC_CTLR_EL1_EOImode_drop (1U << 1) | ||
| 102 | #define ICC_SRE_EL1_SRE (1U << 0) | ||
| 103 | |||
| 104 | /* | ||
| 105 | * Hypervisor interface registers (SRE only) | ||
| 106 | */ | ||
| 107 | #define ICH_LR_VIRTUAL_ID_MASK ((1UL << 32) - 1) | ||
| 108 | |||
| 109 | #define ICH_LR_EOI (1UL << 41) | ||
| 110 | #define ICH_LR_GROUP (1UL << 60) | ||
| 111 | #define ICH_LR_STATE (3UL << 62) | ||
| 112 | #define ICH_LR_PENDING_BIT (1UL << 62) | ||
| 113 | #define ICH_LR_ACTIVE_BIT (1UL << 63) | ||
| 114 | |||
| 115 | #define ICH_MISR_EOI (1 << 0) | ||
| 116 | #define ICH_MISR_U (1 << 1) | ||
| 117 | |||
| 118 | #define ICH_HCR_EN (1 << 0) | ||
| 119 | #define ICH_HCR_UIE (1 << 1) | ||
| 120 | |||
| 121 | #define ICH_VMCR_CTLR_SHIFT 0 | ||
| 122 | #define ICH_VMCR_CTLR_MASK (0x21f << ICH_VMCR_CTLR_SHIFT) | ||
| 123 | #define ICH_VMCR_BPR1_SHIFT 18 | ||
| 124 | #define ICH_VMCR_BPR1_MASK (7 << ICH_VMCR_BPR1_SHIFT) | ||
| 125 | #define ICH_VMCR_BPR0_SHIFT 21 | ||
| 126 | #define ICH_VMCR_BPR0_MASK (7 << ICH_VMCR_BPR0_SHIFT) | ||
| 127 | #define ICH_VMCR_PMR_SHIFT 24 | ||
| 128 | #define ICH_VMCR_PMR_MASK (0xffUL << ICH_VMCR_PMR_SHIFT) | ||
| 129 | |||
| 130 | #define ICC_EOIR1_EL1 sys_reg(3, 0, 12, 12, 1) | ||
| 131 | #define ICC_IAR1_EL1 sys_reg(3, 0, 12, 12, 0) | ||
| 132 | #define ICC_SGI1R_EL1 sys_reg(3, 0, 12, 11, 5) | ||
| 133 | #define ICC_PMR_EL1 sys_reg(3, 0, 4, 6, 0) | ||
| 134 | #define ICC_CTLR_EL1 sys_reg(3, 0, 12, 12, 4) | ||
| 135 | #define ICC_SRE_EL1 sys_reg(3, 0, 12, 12, 5) | ||
| 136 | #define ICC_GRPEN1_EL1 sys_reg(3, 0, 12, 12, 7) | ||
| 137 | |||
| 138 | #define ICC_IAR1_EL1_SPURIOUS 0x3ff | ||
| 139 | |||
| 140 | #define ICC_SRE_EL2 sys_reg(3, 4, 12, 9, 5) | ||
| 141 | |||
| 142 | #define ICC_SRE_EL2_SRE (1 << 0) | ||
| 143 | #define ICC_SRE_EL2_ENABLE (1 << 3) | ||
| 144 | |||
| 145 | /* | ||
| 146 | * System register definitions | ||
| 147 | */ | ||
| 148 | #define ICH_VSEIR_EL2 sys_reg(3, 4, 12, 9, 4) | ||
| 149 | #define ICH_HCR_EL2 sys_reg(3, 4, 12, 11, 0) | ||
| 150 | #define ICH_VTR_EL2 sys_reg(3, 4, 12, 11, 1) | ||
| 151 | #define ICH_MISR_EL2 sys_reg(3, 4, 12, 11, 2) | ||
| 152 | #define ICH_EISR_EL2 sys_reg(3, 4, 12, 11, 3) | ||
| 153 | #define ICH_ELSR_EL2 sys_reg(3, 4, 12, 11, 5) | ||
| 154 | #define ICH_VMCR_EL2 sys_reg(3, 4, 12, 11, 7) | ||
| 155 | |||
| 156 | #define __LR0_EL2(x) sys_reg(3, 4, 12, 12, x) | ||
| 157 | #define __LR8_EL2(x) sys_reg(3, 4, 12, 13, x) | ||
| 158 | |||
| 159 | #define ICH_LR0_EL2 __LR0_EL2(0) | ||
| 160 | #define ICH_LR1_EL2 __LR0_EL2(1) | ||
| 161 | #define ICH_LR2_EL2 __LR0_EL2(2) | ||
| 162 | #define ICH_LR3_EL2 __LR0_EL2(3) | ||
| 163 | #define ICH_LR4_EL2 __LR0_EL2(4) | ||
| 164 | #define ICH_LR5_EL2 __LR0_EL2(5) | ||
| 165 | #define ICH_LR6_EL2 __LR0_EL2(6) | ||
| 166 | #define ICH_LR7_EL2 __LR0_EL2(7) | ||
| 167 | #define ICH_LR8_EL2 __LR8_EL2(0) | ||
| 168 | #define ICH_LR9_EL2 __LR8_EL2(1) | ||
| 169 | #define ICH_LR10_EL2 __LR8_EL2(2) | ||
| 170 | #define ICH_LR11_EL2 __LR8_EL2(3) | ||
| 171 | #define ICH_LR12_EL2 __LR8_EL2(4) | ||
| 172 | #define ICH_LR13_EL2 __LR8_EL2(5) | ||
| 173 | #define ICH_LR14_EL2 __LR8_EL2(6) | ||
| 174 | #define ICH_LR15_EL2 __LR8_EL2(7) | ||
| 175 | |||
| 176 | #define __AP0Rx_EL2(x) sys_reg(3, 4, 12, 8, x) | ||
| 177 | #define ICH_AP0R0_EL2 __AP0Rx_EL2(0) | ||
| 178 | #define ICH_AP0R1_EL2 __AP0Rx_EL2(1) | ||
| 179 | #define ICH_AP0R2_EL2 __AP0Rx_EL2(2) | ||
| 180 | #define ICH_AP0R3_EL2 __AP0Rx_EL2(3) | ||
| 181 | |||
| 182 | #define __AP1Rx_EL2(x) sys_reg(3, 4, 12, 9, x) | ||
| 183 | #define ICH_AP1R0_EL2 __AP1Rx_EL2(0) | ||
| 184 | #define ICH_AP1R1_EL2 __AP1Rx_EL2(1) | ||
| 185 | #define ICH_AP1R2_EL2 __AP1Rx_EL2(2) | ||
| 186 | #define ICH_AP1R3_EL2 __AP1Rx_EL2(3) | ||
| 187 | |||
| 188 | #ifndef __ASSEMBLY__ | ||
| 189 | |||
| 190 | #include <linux/stringify.h> | ||
| 191 | |||
| 192 | static inline void gic_write_eoir(u64 irq) | ||
| 193 | { | ||
| 194 | asm volatile("msr_s " __stringify(ICC_EOIR1_EL1) ", %0" : : "r" (irq)); | ||
| 195 | isb(); | ||
| 196 | } | ||
| 197 | |||
| 198 | #endif | ||
| 199 | |||
| 200 | #endif | ||
diff --git a/include/linux/irqchip/spear-shirq.h b/include/linux/irqchip/spear-shirq.h deleted file mode 100644 index c8be16d213a3..000000000000 --- a/include/linux/irqchip/spear-shirq.h +++ /dev/null | |||
| @@ -1,64 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * SPEAr platform shared irq layer header file | ||
| 3 | * | ||
| 4 | * Copyright (C) 2009-2012 ST Microelectronics | ||
| 5 | * Viresh Kumar <viresh.linux@gmail.com> | ||
| 6 | * | ||
| 7 | * This file is licensed under the terms of the GNU General Public | ||
| 8 | * License version 2. This program is licensed "as is" without any | ||
| 9 | * warranty of any kind, whether express or implied. | ||
| 10 | */ | ||
| 11 | |||
| 12 | #ifndef __SPEAR_SHIRQ_H | ||
| 13 | #define __SPEAR_SHIRQ_H | ||
| 14 | |||
| 15 | #include <linux/irq.h> | ||
| 16 | #include <linux/types.h> | ||
| 17 | |||
| 18 | /* | ||
| 19 | * struct shirq_regs: shared irq register configuration | ||
| 20 | * | ||
| 21 | * enb_reg: enable register offset | ||
| 22 | * reset_to_enb: val 1 indicates, we need to clear bit for enabling interrupt | ||
| 23 | * status_reg: status register offset | ||
| 24 | * status_reg_mask: status register valid mask | ||
| 25 | * clear_reg: clear register offset | ||
| 26 | * reset_to_clear: val 1 indicates, we need to clear bit for clearing interrupt | ||
| 27 | */ | ||
| 28 | struct shirq_regs { | ||
| 29 | u32 enb_reg; | ||
| 30 | u32 reset_to_enb; | ||
| 31 | u32 status_reg; | ||
| 32 | u32 clear_reg; | ||
| 33 | u32 reset_to_clear; | ||
| 34 | }; | ||
| 35 | |||
| 36 | /* | ||
| 37 | * struct spear_shirq: shared irq structure | ||
| 38 | * | ||
| 39 | * irq: hardware irq number | ||
| 40 | * irq_base: base irq in linux domain | ||
| 41 | * irq_nr: no. of shared interrupts in a particular block | ||
| 42 | * irq_bit_off: starting bit offset in the status register | ||
| 43 | * invalid_irq: irq group is currently disabled | ||
| 44 | * base: base address of shared irq register | ||
| 45 | * regs: register configuration for shared irq block | ||
| 46 | */ | ||
| 47 | struct spear_shirq { | ||
| 48 | u32 irq; | ||
| 49 | u32 irq_base; | ||
| 50 | u32 irq_nr; | ||
| 51 | u32 irq_bit_off; | ||
| 52 | int invalid_irq; | ||
| 53 | void __iomem *base; | ||
| 54 | struct shirq_regs regs; | ||
| 55 | }; | ||
| 56 | |||
| 57 | int __init spear300_shirq_of_init(struct device_node *np, | ||
| 58 | struct device_node *parent); | ||
| 59 | int __init spear310_shirq_of_init(struct device_node *np, | ||
| 60 | struct device_node *parent); | ||
| 61 | int __init spear320_shirq_of_init(struct device_node *np, | ||
| 62 | struct device_node *parent); | ||
| 63 | |||
| 64 | #endif /* __SPEAR_SHIRQ_H */ | ||
diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h index c983ed18c332..b0f9d16e48f6 100644 --- a/include/linux/irqdomain.h +++ b/include/linux/irqdomain.h | |||
| @@ -172,6 +172,8 @@ extern int irq_domain_associate(struct irq_domain *domain, unsigned int irq, | |||
| 172 | extern void irq_domain_associate_many(struct irq_domain *domain, | 172 | extern void irq_domain_associate_many(struct irq_domain *domain, |
| 173 | unsigned int irq_base, | 173 | unsigned int irq_base, |
| 174 | irq_hw_number_t hwirq_base, int count); | 174 | irq_hw_number_t hwirq_base, int count); |
| 175 | extern void irq_domain_disassociate(struct irq_domain *domain, | ||
| 176 | unsigned int irq); | ||
| 175 | 177 | ||
| 176 | extern unsigned int irq_create_mapping(struct irq_domain *host, | 178 | extern unsigned int irq_create_mapping(struct irq_domain *host, |
| 177 | irq_hw_number_t hwirq); | 179 | irq_hw_number_t hwirq); |
diff --git a/include/linux/isdn_ppp.h b/include/linux/isdn_ppp.h index 8e10f57f109f..a0070c6dfaf8 100644 --- a/include/linux/isdn_ppp.h +++ b/include/linux/isdn_ppp.h | |||
| @@ -180,8 +180,8 @@ struct ippp_struct { | |||
| 180 | struct slcompress *slcomp; | 180 | struct slcompress *slcomp; |
| 181 | #endif | 181 | #endif |
| 182 | #ifdef CONFIG_IPPP_FILTER | 182 | #ifdef CONFIG_IPPP_FILTER |
| 183 | struct sk_filter *pass_filter; /* filter for packets to pass */ | 183 | struct bpf_prog *pass_filter; /* filter for packets to pass */ |
| 184 | struct sk_filter *active_filter; /* filter for pkts to reset idle */ | 184 | struct bpf_prog *active_filter; /* filter for pkts to reset idle */ |
| 185 | #endif | 185 | #endif |
| 186 | unsigned long debug; | 186 | unsigned long debug; |
| 187 | struct isdn_ppp_compressor *compressor,*decompressor; | 187 | struct isdn_ppp_compressor *compressor,*decompressor; |
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 4c52907a6d8b..a9e2268ecccb 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h | |||
| @@ -501,7 +501,7 @@ static inline char * __deprecated pack_hex_byte(char *buf, u8 byte) | |||
| 501 | extern int hex_to_bin(char ch); | 501 | extern int hex_to_bin(char ch); |
| 502 | extern int __must_check hex2bin(u8 *dst, const char *src, size_t count); | 502 | extern int __must_check hex2bin(u8 *dst, const char *src, size_t count); |
| 503 | 503 | ||
| 504 | int mac_pton(const char *s, u8 *mac); | 504 | bool mac_pton(const char *s, u8 *mac); |
| 505 | 505 | ||
| 506 | /* | 506 | /* |
| 507 | * General tracing related utility functions - trace_printk(), | 507 | * General tracing related utility functions - trace_printk(), |
diff --git a/include/linux/key-type.h b/include/linux/key-type.h index a74c3a84dfdd..44792ee649de 100644 --- a/include/linux/key-type.h +++ b/include/linux/key-type.h | |||
| @@ -41,10 +41,11 @@ struct key_construction { | |||
| 41 | struct key_preparsed_payload { | 41 | struct key_preparsed_payload { |
| 42 | char *description; /* Proposed key description (or NULL) */ | 42 | char *description; /* Proposed key description (or NULL) */ |
| 43 | void *type_data[2]; /* Private key-type data */ | 43 | void *type_data[2]; /* Private key-type data */ |
| 44 | void *payload; /* Proposed payload */ | 44 | void *payload[2]; /* Proposed payload */ |
| 45 | const void *data; /* Raw data */ | 45 | const void *data; /* Raw data */ |
| 46 | size_t datalen; /* Raw datalen */ | 46 | size_t datalen; /* Raw datalen */ |
| 47 | size_t quotalen; /* Quota length for proposed payload */ | 47 | size_t quotalen; /* Quota length for proposed payload */ |
| 48 | time_t expiry; /* Expiry time of key */ | ||
| 48 | bool trusted; /* True if key is trusted */ | 49 | bool trusted; /* True if key is trusted */ |
| 49 | }; | 50 | }; |
| 50 | 51 | ||
| @@ -159,5 +160,7 @@ static inline int key_negate_and_link(struct key *key, | |||
| 159 | return key_reject_and_link(key, timeout, ENOKEY, keyring, instkey); | 160 | return key_reject_and_link(key, timeout, ENOKEY, keyring, instkey); |
| 160 | } | 161 | } |
| 161 | 162 | ||
| 163 | extern int generic_key_instantiate(struct key *key, struct key_preparsed_payload *prep); | ||
| 164 | |||
| 162 | #endif /* CONFIG_KEYS */ | 165 | #endif /* CONFIG_KEYS */ |
| 163 | #endif /* _LINUX_KEY_TYPE_H */ | 166 | #endif /* _LINUX_KEY_TYPE_H */ |
diff --git a/include/linux/key.h b/include/linux/key.h index 017b0826642f..e1d4715f3222 100644 --- a/include/linux/key.h +++ b/include/linux/key.h | |||
| @@ -170,6 +170,8 @@ struct key { | |||
| 170 | #define KEY_FLAG_INVALIDATED 7 /* set if key has been invalidated */ | 170 | #define KEY_FLAG_INVALIDATED 7 /* set if key has been invalidated */ |
| 171 | #define KEY_FLAG_TRUSTED 8 /* set if key is trusted */ | 171 | #define KEY_FLAG_TRUSTED 8 /* set if key is trusted */ |
| 172 | #define KEY_FLAG_TRUSTED_ONLY 9 /* set if keyring only accepts links to trusted keys */ | 172 | #define KEY_FLAG_TRUSTED_ONLY 9 /* set if keyring only accepts links to trusted keys */ |
| 173 | #define KEY_FLAG_BUILTIN 10 /* set if key is builtin */ | ||
| 174 | #define KEY_FLAG_ROOT_CAN_INVAL 11 /* set if key can be invalidated by root without permission */ | ||
| 173 | 175 | ||
| 174 | /* the key type and key description string | 176 | /* the key type and key description string |
| 175 | * - the desc is used to match a key against search criteria | 177 | * - the desc is used to match a key against search criteria |
diff --git a/include/linux/kthread.h b/include/linux/kthread.h index 7dcef3317689..13d55206ccf6 100644 --- a/include/linux/kthread.h +++ b/include/linux/kthread.h | |||
| @@ -73,7 +73,6 @@ struct kthread_worker { | |||
| 73 | struct kthread_work { | 73 | struct kthread_work { |
| 74 | struct list_head node; | 74 | struct list_head node; |
| 75 | kthread_work_func_t func; | 75 | kthread_work_func_t func; |
| 76 | wait_queue_head_t done; | ||
| 77 | struct kthread_worker *worker; | 76 | struct kthread_worker *worker; |
| 78 | }; | 77 | }; |
| 79 | 78 | ||
| @@ -85,7 +84,6 @@ struct kthread_work { | |||
| 85 | #define KTHREAD_WORK_INIT(work, fn) { \ | 84 | #define KTHREAD_WORK_INIT(work, fn) { \ |
| 86 | .node = LIST_HEAD_INIT((work).node), \ | 85 | .node = LIST_HEAD_INIT((work).node), \ |
| 87 | .func = (fn), \ | 86 | .func = (fn), \ |
| 88 | .done = __WAIT_QUEUE_HEAD_INITIALIZER((work).done), \ | ||
| 89 | } | 87 | } |
| 90 | 88 | ||
| 91 | #define DEFINE_KTHREAD_WORKER(worker) \ | 89 | #define DEFINE_KTHREAD_WORKER(worker) \ |
| @@ -95,22 +93,16 @@ struct kthread_work { | |||
| 95 | struct kthread_work work = KTHREAD_WORK_INIT(work, fn) | 93 | struct kthread_work work = KTHREAD_WORK_INIT(work, fn) |
| 96 | 94 | ||
| 97 | /* | 95 | /* |
| 98 | * kthread_worker.lock and kthread_work.done need their own lockdep class | 96 | * kthread_worker.lock needs its own lockdep class key when defined on |
| 99 | * keys if they are defined on stack with lockdep enabled. Use the | 97 | * stack with lockdep enabled. Use the following macros in such cases. |
| 100 | * following macros when defining them on stack. | ||
| 101 | */ | 98 | */ |
| 102 | #ifdef CONFIG_LOCKDEP | 99 | #ifdef CONFIG_LOCKDEP |
| 103 | # define KTHREAD_WORKER_INIT_ONSTACK(worker) \ | 100 | # define KTHREAD_WORKER_INIT_ONSTACK(worker) \ |
| 104 | ({ init_kthread_worker(&worker); worker; }) | 101 | ({ init_kthread_worker(&worker); worker; }) |
| 105 | # define DEFINE_KTHREAD_WORKER_ONSTACK(worker) \ | 102 | # define DEFINE_KTHREAD_WORKER_ONSTACK(worker) \ |
| 106 | struct kthread_worker worker = KTHREAD_WORKER_INIT_ONSTACK(worker) | 103 | struct kthread_worker worker = KTHREAD_WORKER_INIT_ONSTACK(worker) |
| 107 | # define KTHREAD_WORK_INIT_ONSTACK(work, fn) \ | ||
| 108 | ({ init_kthread_work((&work), fn); work; }) | ||
| 109 | # define DEFINE_KTHREAD_WORK_ONSTACK(work, fn) \ | ||
| 110 | struct kthread_work work = KTHREAD_WORK_INIT_ONSTACK(work, fn) | ||
| 111 | #else | 104 | #else |
| 112 | # define DEFINE_KTHREAD_WORKER_ONSTACK(worker) DEFINE_KTHREAD_WORKER(worker) | 105 | # define DEFINE_KTHREAD_WORKER_ONSTACK(worker) DEFINE_KTHREAD_WORKER(worker) |
| 113 | # define DEFINE_KTHREAD_WORK_ONSTACK(work, fn) DEFINE_KTHREAD_WORK(work, fn) | ||
| 114 | #endif | 106 | #endif |
| 115 | 107 | ||
| 116 | extern void __init_kthread_worker(struct kthread_worker *worker, | 108 | extern void __init_kthread_worker(struct kthread_worker *worker, |
| @@ -127,7 +119,6 @@ extern void __init_kthread_worker(struct kthread_worker *worker, | |||
| 127 | memset((work), 0, sizeof(struct kthread_work)); \ | 119 | memset((work), 0, sizeof(struct kthread_work)); \ |
| 128 | INIT_LIST_HEAD(&(work)->node); \ | 120 | INIT_LIST_HEAD(&(work)->node); \ |
| 129 | (work)->func = (fn); \ | 121 | (work)->func = (fn); \ |
| 130 | init_waitqueue_head(&(work)->done); \ | ||
| 131 | } while (0) | 122 | } while (0) |
| 132 | 123 | ||
| 133 | int kthread_worker_fn(void *worker_ptr); | 124 | int kthread_worker_fn(void *worker_ptr); |
diff --git a/include/linux/ktime.h b/include/linux/ktime.h index de9e46e6bcc9..c9d645ad98ff 100644 --- a/include/linux/ktime.h +++ b/include/linux/ktime.h | |||
| @@ -27,43 +27,19 @@ | |||
| 27 | /* | 27 | /* |
| 28 | * ktime_t: | 28 | * ktime_t: |
| 29 | * | 29 | * |
| 30 | * On 64-bit CPUs a single 64-bit variable is used to store the hrtimers | 30 | * A single 64-bit variable is used to store the hrtimers |
| 31 | * internal representation of time values in scalar nanoseconds. The | 31 | * internal representation of time values in scalar nanoseconds. The |
| 32 | * design plays out best on 64-bit CPUs, where most conversions are | 32 | * design plays out best on 64-bit CPUs, where most conversions are |
| 33 | * NOPs and most arithmetic ktime_t operations are plain arithmetic | 33 | * NOPs and most arithmetic ktime_t operations are plain arithmetic |
| 34 | * operations. | 34 | * operations. |
| 35 | * | 35 | * |
| 36 | * On 32-bit CPUs an optimized representation of the timespec structure | ||
| 37 | * is used to avoid expensive conversions from and to timespecs. The | ||
| 38 | * endian-aware order of the tv struct members is chosen to allow | ||
| 39 | * mathematical operations on the tv64 member of the union too, which | ||
| 40 | * for certain operations produces better code. | ||
| 41 | * | ||
| 42 | * For architectures with efficient support for 64/32-bit conversions the | ||
| 43 | * plain scalar nanosecond based representation can be selected by the | ||
| 44 | * config switch CONFIG_KTIME_SCALAR. | ||
| 45 | */ | 36 | */ |
| 46 | union ktime { | 37 | union ktime { |
| 47 | s64 tv64; | 38 | s64 tv64; |
| 48 | #if BITS_PER_LONG != 64 && !defined(CONFIG_KTIME_SCALAR) | ||
| 49 | struct { | ||
| 50 | # ifdef __BIG_ENDIAN | ||
| 51 | s32 sec, nsec; | ||
| 52 | # else | ||
| 53 | s32 nsec, sec; | ||
| 54 | # endif | ||
| 55 | } tv; | ||
| 56 | #endif | ||
| 57 | }; | 39 | }; |
| 58 | 40 | ||
| 59 | typedef union ktime ktime_t; /* Kill this */ | 41 | typedef union ktime ktime_t; /* Kill this */ |
| 60 | 42 | ||
| 61 | /* | ||
| 62 | * ktime_t definitions when using the 64-bit scalar representation: | ||
| 63 | */ | ||
| 64 | |||
| 65 | #if (BITS_PER_LONG == 64) || defined(CONFIG_KTIME_SCALAR) | ||
| 66 | |||
| 67 | /** | 43 | /** |
| 68 | * ktime_set - Set a ktime_t variable from a seconds/nanoseconds value | 44 | * ktime_set - Set a ktime_t variable from a seconds/nanoseconds value |
| 69 | * @secs: seconds to set | 45 | * @secs: seconds to set |
| @@ -71,13 +47,12 @@ typedef union ktime ktime_t; /* Kill this */ | |||
| 71 | * | 47 | * |
| 72 | * Return: The ktime_t representation of the value. | 48 | * Return: The ktime_t representation of the value. |
| 73 | */ | 49 | */ |
| 74 | static inline ktime_t ktime_set(const long secs, const unsigned long nsecs) | 50 | static inline ktime_t ktime_set(const s64 secs, const unsigned long nsecs) |
| 75 | { | 51 | { |
| 76 | #if (BITS_PER_LONG == 64) | ||
| 77 | if (unlikely(secs >= KTIME_SEC_MAX)) | 52 | if (unlikely(secs >= KTIME_SEC_MAX)) |
| 78 | return (ktime_t){ .tv64 = KTIME_MAX }; | 53 | return (ktime_t){ .tv64 = KTIME_MAX }; |
| 79 | #endif | 54 | |
| 80 | return (ktime_t) { .tv64 = (s64)secs * NSEC_PER_SEC + (s64)nsecs }; | 55 | return (ktime_t) { .tv64 = secs * NSEC_PER_SEC + (s64)nsecs }; |
| 81 | } | 56 | } |
| 82 | 57 | ||
| 83 | /* Subtract two ktime_t variables. rem = lhs -rhs: */ | 58 | /* Subtract two ktime_t variables. rem = lhs -rhs: */ |
| @@ -108,6 +83,12 @@ static inline ktime_t timespec_to_ktime(struct timespec ts) | |||
| 108 | return ktime_set(ts.tv_sec, ts.tv_nsec); | 83 | return ktime_set(ts.tv_sec, ts.tv_nsec); |
| 109 | } | 84 | } |
| 110 | 85 | ||
| 86 | /* convert a timespec64 to ktime_t format: */ | ||
| 87 | static inline ktime_t timespec64_to_ktime(struct timespec64 ts) | ||
| 88 | { | ||
| 89 | return ktime_set(ts.tv_sec, ts.tv_nsec); | ||
| 90 | } | ||
| 91 | |||
| 111 | /* convert a timeval to ktime_t format: */ | 92 | /* convert a timeval to ktime_t format: */ |
| 112 | static inline ktime_t timeval_to_ktime(struct timeval tv) | 93 | static inline ktime_t timeval_to_ktime(struct timeval tv) |
| 113 | { | 94 | { |
| @@ -117,159 +98,15 @@ static inline ktime_t timeval_to_ktime(struct timeval tv) | |||
| 117 | /* Map the ktime_t to timespec conversion to ns_to_timespec function */ | 98 | /* Map the ktime_t to timespec conversion to ns_to_timespec function */ |
| 118 | #define ktime_to_timespec(kt) ns_to_timespec((kt).tv64) | 99 | #define ktime_to_timespec(kt) ns_to_timespec((kt).tv64) |
| 119 | 100 | ||
| 101 | /* Map the ktime_t to timespec conversion to ns_to_timespec function */ | ||
| 102 | #define ktime_to_timespec64(kt) ns_to_timespec64((kt).tv64) | ||
| 103 | |||
| 120 | /* Map the ktime_t to timeval conversion to ns_to_timeval function */ | 104 | /* Map the ktime_t to timeval conversion to ns_to_timeval function */ |
| 121 | #define ktime_to_timeval(kt) ns_to_timeval((kt).tv64) | 105 | #define ktime_to_timeval(kt) ns_to_timeval((kt).tv64) |
| 122 | 106 | ||
| 123 | /* Convert ktime_t to nanoseconds - NOP in the scalar storage format: */ | 107 | /* Convert ktime_t to nanoseconds - NOP in the scalar storage format: */ |
| 124 | #define ktime_to_ns(kt) ((kt).tv64) | 108 | #define ktime_to_ns(kt) ((kt).tv64) |
| 125 | 109 | ||
| 126 | #else /* !((BITS_PER_LONG == 64) || defined(CONFIG_KTIME_SCALAR)) */ | ||
| 127 | |||
| 128 | /* | ||
| 129 | * Helper macros/inlines to get the ktime_t math right in the timespec | ||
| 130 | * representation. The macros are sometimes ugly - their actual use is | ||
| 131 | * pretty okay-ish, given the circumstances. We do all this for | ||
| 132 | * performance reasons. The pure scalar nsec_t based code was nice and | ||
| 133 | * simple, but created too many 64-bit / 32-bit conversions and divisions. | ||
| 134 | * | ||
| 135 | * Be especially aware that negative values are represented in a way | ||
| 136 | * that the tv.sec field is negative and the tv.nsec field is greater | ||
| 137 | * or equal to zero but less than nanoseconds per second. This is the | ||
| 138 | * same representation which is used by timespecs. | ||
| 139 | * | ||
| 140 | * tv.sec < 0 and 0 >= tv.nsec < NSEC_PER_SEC | ||
| 141 | */ | ||
| 142 | |||
| 143 | /* Set a ktime_t variable to a value in sec/nsec representation: */ | ||
| 144 | static inline ktime_t ktime_set(const long secs, const unsigned long nsecs) | ||
| 145 | { | ||
| 146 | return (ktime_t) { .tv = { .sec = secs, .nsec = nsecs } }; | ||
| 147 | } | ||
| 148 | |||
| 149 | /** | ||
| 150 | * ktime_sub - subtract two ktime_t variables | ||
| 151 | * @lhs: minuend | ||
| 152 | * @rhs: subtrahend | ||
| 153 | * | ||
| 154 | * Return: The remainder of the subtraction. | ||
| 155 | */ | ||
| 156 | static inline ktime_t ktime_sub(const ktime_t lhs, const ktime_t rhs) | ||
| 157 | { | ||
| 158 | ktime_t res; | ||
| 159 | |||
| 160 | res.tv64 = lhs.tv64 - rhs.tv64; | ||
| 161 | if (res.tv.nsec < 0) | ||
| 162 | res.tv.nsec += NSEC_PER_SEC; | ||
| 163 | |||
| 164 | return res; | ||
| 165 | } | ||
| 166 | |||
| 167 | /** | ||
| 168 | * ktime_add - add two ktime_t variables | ||
| 169 | * @add1: addend1 | ||
| 170 | * @add2: addend2 | ||
| 171 | * | ||
| 172 | * Return: The sum of @add1 and @add2. | ||
| 173 | */ | ||
| 174 | static inline ktime_t ktime_add(const ktime_t add1, const ktime_t add2) | ||
| 175 | { | ||
| 176 | ktime_t res; | ||
| 177 | |||
| 178 | res.tv64 = add1.tv64 + add2.tv64; | ||
| 179 | /* | ||
| 180 | * performance trick: the (u32) -NSEC gives 0x00000000Fxxxxxxx | ||
| 181 | * so we subtract NSEC_PER_SEC and add 1 to the upper 32 bit. | ||
| 182 | * | ||
| 183 | * it's equivalent to: | ||
| 184 | * tv.nsec -= NSEC_PER_SEC | ||
| 185 | * tv.sec ++; | ||
| 186 | */ | ||
| 187 | if (res.tv.nsec >= NSEC_PER_SEC) | ||
| 188 | res.tv64 += (u32)-NSEC_PER_SEC; | ||
| 189 | |||
| 190 | return res; | ||
| 191 | } | ||
| 192 | |||
| 193 | /** | ||
| 194 | * ktime_add_ns - Add a scalar nanoseconds value to a ktime_t variable | ||
| 195 | * @kt: addend | ||
| 196 | * @nsec: the scalar nsec value to add | ||
| 197 | * | ||
| 198 | * Return: The sum of @kt and @nsec in ktime_t format. | ||
| 199 | */ | ||
| 200 | extern ktime_t ktime_add_ns(const ktime_t kt, u64 nsec); | ||
| 201 | |||
| 202 | /** | ||
| 203 | * ktime_sub_ns - Subtract a scalar nanoseconds value from a ktime_t variable | ||
| 204 | * @kt: minuend | ||
| 205 | * @nsec: the scalar nsec value to subtract | ||
| 206 | * | ||
| 207 | * Return: The subtraction of @nsec from @kt in ktime_t format. | ||
| 208 | */ | ||
| 209 | extern ktime_t ktime_sub_ns(const ktime_t kt, u64 nsec); | ||
| 210 | |||
| 211 | /** | ||
| 212 | * timespec_to_ktime - convert a timespec to ktime_t format | ||
| 213 | * @ts: the timespec variable to convert | ||
| 214 | * | ||
| 215 | * Return: A ktime_t variable with the converted timespec value. | ||
| 216 | */ | ||
| 217 | static inline ktime_t timespec_to_ktime(const struct timespec ts) | ||
| 218 | { | ||
| 219 | return (ktime_t) { .tv = { .sec = (s32)ts.tv_sec, | ||
| 220 | .nsec = (s32)ts.tv_nsec } }; | ||
| 221 | } | ||
| 222 | |||
| 223 | /** | ||
| 224 | * timeval_to_ktime - convert a timeval to ktime_t format | ||
| 225 | * @tv: the timeval variable to convert | ||
| 226 | * | ||
| 227 | * Return: A ktime_t variable with the converted timeval value. | ||
| 228 | */ | ||
| 229 | static inline ktime_t timeval_to_ktime(const struct timeval tv) | ||
| 230 | { | ||
| 231 | return (ktime_t) { .tv = { .sec = (s32)tv.tv_sec, | ||
| 232 | .nsec = (s32)(tv.tv_usec * | ||
| 233 | NSEC_PER_USEC) } }; | ||
| 234 | } | ||
| 235 | |||
| 236 | /** | ||
| 237 | * ktime_to_timespec - convert a ktime_t variable to timespec format | ||
| 238 | * @kt: the ktime_t variable to convert | ||
| 239 | * | ||
| 240 | * Return: The timespec representation of the ktime value. | ||
| 241 | */ | ||
| 242 | static inline struct timespec ktime_to_timespec(const ktime_t kt) | ||
| 243 | { | ||
| 244 | return (struct timespec) { .tv_sec = (time_t) kt.tv.sec, | ||
| 245 | .tv_nsec = (long) kt.tv.nsec }; | ||
| 246 | } | ||
| 247 | |||
| 248 | /** | ||
| 249 | * ktime_to_timeval - convert a ktime_t variable to timeval format | ||
| 250 | * @kt: the ktime_t variable to convert | ||
| 251 | * | ||
| 252 | * Return: The timeval representation of the ktime value. | ||
| 253 | */ | ||
| 254 | static inline struct timeval ktime_to_timeval(const ktime_t kt) | ||
| 255 | { | ||
| 256 | return (struct timeval) { | ||
| 257 | .tv_sec = (time_t) kt.tv.sec, | ||
| 258 | .tv_usec = (suseconds_t) (kt.tv.nsec / NSEC_PER_USEC) }; | ||
| 259 | } | ||
| 260 | |||
| 261 | /** | ||
| 262 | * ktime_to_ns - convert a ktime_t variable to scalar nanoseconds | ||
| 263 | * @kt: the ktime_t variable to convert | ||
| 264 | * | ||
| 265 | * Return: The scalar nanoseconds representation of @kt. | ||
| 266 | */ | ||
| 267 | static inline s64 ktime_to_ns(const ktime_t kt) | ||
| 268 | { | ||
| 269 | return (s64) kt.tv.sec * NSEC_PER_SEC + kt.tv.nsec; | ||
| 270 | } | ||
| 271 | |||
| 272 | #endif /* !((BITS_PER_LONG == 64) || defined(CONFIG_KTIME_SCALAR)) */ | ||
| 273 | 110 | ||
| 274 | /** | 111 | /** |
| 275 | * ktime_equal - Compares two ktime_t variables to see if they are equal | 112 | * ktime_equal - Compares two ktime_t variables to see if they are equal |
| @@ -328,16 +165,20 @@ static inline bool ktime_before(const ktime_t cmp1, const ktime_t cmp2) | |||
| 328 | return ktime_compare(cmp1, cmp2) < 0; | 165 | return ktime_compare(cmp1, cmp2) < 0; |
| 329 | } | 166 | } |
| 330 | 167 | ||
| 168 | #if BITS_PER_LONG < 64 | ||
| 169 | extern u64 ktime_divns(const ktime_t kt, s64 div); | ||
| 170 | #else /* BITS_PER_LONG < 64 */ | ||
| 171 | # define ktime_divns(kt, div) (u64)((kt).tv64 / (div)) | ||
| 172 | #endif | ||
| 173 | |||
| 331 | static inline s64 ktime_to_us(const ktime_t kt) | 174 | static inline s64 ktime_to_us(const ktime_t kt) |
| 332 | { | 175 | { |
| 333 | struct timeval tv = ktime_to_timeval(kt); | 176 | return ktime_divns(kt, NSEC_PER_USEC); |
| 334 | return (s64) tv.tv_sec * USEC_PER_SEC + tv.tv_usec; | ||
| 335 | } | 177 | } |
| 336 | 178 | ||
| 337 | static inline s64 ktime_to_ms(const ktime_t kt) | 179 | static inline s64 ktime_to_ms(const ktime_t kt) |
| 338 | { | 180 | { |
| 339 | struct timeval tv = ktime_to_timeval(kt); | 181 | return ktime_divns(kt, NSEC_PER_MSEC); |
| 340 | return (s64) tv.tv_sec * MSEC_PER_SEC + tv.tv_usec / USEC_PER_MSEC; | ||
| 341 | } | 182 | } |
| 342 | 183 | ||
| 343 | static inline s64 ktime_us_delta(const ktime_t later, const ktime_t earlier) | 184 | static inline s64 ktime_us_delta(const ktime_t later, const ktime_t earlier) |
| @@ -381,6 +222,25 @@ static inline __must_check bool ktime_to_timespec_cond(const ktime_t kt, | |||
| 381 | } | 222 | } |
| 382 | } | 223 | } |
| 383 | 224 | ||
| 225 | /** | ||
| 226 | * ktime_to_timespec64_cond - convert a ktime_t variable to timespec64 | ||
| 227 | * format only if the variable contains data | ||
| 228 | * @kt: the ktime_t variable to convert | ||
| 229 | * @ts: the timespec variable to store the result in | ||
| 230 | * | ||
| 231 | * Return: %true if there was a successful conversion, %false if kt was 0. | ||
| 232 | */ | ||
| 233 | static inline __must_check bool ktime_to_timespec64_cond(const ktime_t kt, | ||
| 234 | struct timespec64 *ts) | ||
| 235 | { | ||
| 236 | if (kt.tv64) { | ||
| 237 | *ts = ktime_to_timespec64(kt); | ||
| 238 | return true; | ||
| 239 | } else { | ||
| 240 | return false; | ||
| 241 | } | ||
| 242 | } | ||
| 243 | |||
| 384 | /* | 244 | /* |
| 385 | * The resolution of the clocks. The resolution value is returned in | 245 | * The resolution of the clocks. The resolution value is returned in |
| 386 | * the clock_getres() system call to give application programmers an | 246 | * the clock_getres() system call to give application programmers an |
| @@ -390,12 +250,6 @@ static inline __must_check bool ktime_to_timespec_cond(const ktime_t kt, | |||
| 390 | #define LOW_RES_NSEC TICK_NSEC | 250 | #define LOW_RES_NSEC TICK_NSEC |
| 391 | #define KTIME_LOW_RES (ktime_t){ .tv64 = LOW_RES_NSEC } | 251 | #define KTIME_LOW_RES (ktime_t){ .tv64 = LOW_RES_NSEC } |
| 392 | 252 | ||
| 393 | /* Get the monotonic time in timespec format: */ | ||
| 394 | extern void ktime_get_ts(struct timespec *ts); | ||
| 395 | |||
| 396 | /* Get the real (wall-) time in timespec format: */ | ||
| 397 | #define ktime_get_real_ts(ts) getnstimeofday(ts) | ||
| 398 | |||
| 399 | static inline ktime_t ns_to_ktime(u64 ns) | 253 | static inline ktime_t ns_to_ktime(u64 ns) |
| 400 | { | 254 | { |
| 401 | static const ktime_t ktime_zero = { .tv64 = 0 }; | 255 | static const ktime_t ktime_zero = { .tv64 = 0 }; |
| @@ -410,4 +264,6 @@ static inline ktime_t ms_to_ktime(u64 ms) | |||
| 410 | return ktime_add_ms(ktime_zero, ms); | 264 | return ktime_add_ms(ktime_zero, ms); |
| 411 | } | 265 | } |
| 412 | 266 | ||
| 267 | # include <linux/timekeeping.h> | ||
| 268 | |||
| 413 | #endif | 269 | #endif |
diff --git a/include/linux/libata.h b/include/linux/libata.h index 5ab4e3a76721..92abb497ab14 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
| @@ -593,6 +593,7 @@ struct ata_host { | |||
| 593 | struct device *dev; | 593 | struct device *dev; |
| 594 | void __iomem * const *iomap; | 594 | void __iomem * const *iomap; |
| 595 | unsigned int n_ports; | 595 | unsigned int n_ports; |
| 596 | unsigned int n_tags; /* nr of NCQ tags */ | ||
| 596 | void *private_data; | 597 | void *private_data; |
| 597 | struct ata_port_operations *ops; | 598 | struct ata_port_operations *ops; |
| 598 | unsigned long flags; | 599 | unsigned long flags; |
diff --git a/include/linux/mfd/arizona/core.h b/include/linux/mfd/arizona/core.h index 6d9371f88875..a614b33d0a39 100644 --- a/include/linux/mfd/arizona/core.h +++ b/include/linux/mfd/arizona/core.h | |||
| @@ -110,6 +110,12 @@ struct arizona { | |||
| 110 | int clk32k_ref; | 110 | int clk32k_ref; |
| 111 | 111 | ||
| 112 | struct snd_soc_dapm_context *dapm; | 112 | struct snd_soc_dapm_context *dapm; |
| 113 | |||
| 114 | int tdm_width[ARIZONA_MAX_AIF]; | ||
| 115 | int tdm_slots[ARIZONA_MAX_AIF]; | ||
| 116 | |||
| 117 | uint16_t dac_comp_coeff; | ||
| 118 | uint8_t dac_comp_enabled; | ||
| 113 | }; | 119 | }; |
| 114 | 120 | ||
| 115 | int arizona_clk32k_enable(struct arizona *arizona); | 121 | int arizona_clk32k_enable(struct arizona *arizona); |
diff --git a/include/linux/mfd/arizona/pdata.h b/include/linux/mfd/arizona/pdata.h index 12a5c135c746..4578c72c9b86 100644 --- a/include/linux/mfd/arizona/pdata.h +++ b/include/linux/mfd/arizona/pdata.h | |||
| @@ -127,6 +127,9 @@ struct arizona_pdata { | |||
| 127 | /** Internal pull on GPIO5 is disabled when used for jack detection */ | 127 | /** Internal pull on GPIO5 is disabled when used for jack detection */ |
| 128 | bool jd_gpio5_nopull; | 128 | bool jd_gpio5_nopull; |
| 129 | 129 | ||
| 130 | /** set to true if jackdet contact opens on insert */ | ||
| 131 | bool jd_invert; | ||
| 132 | |||
| 130 | /** Use the headphone detect circuit to identify the accessory */ | 133 | /** Use the headphone detect circuit to identify the accessory */ |
| 131 | bool hpdet_acc_id; | 134 | bool hpdet_acc_id; |
| 132 | 135 | ||
diff --git a/include/linux/mfd/max77693-private.h b/include/linux/mfd/max77693-private.h index 3e050b933dd0..c466ff3e16b8 100644 --- a/include/linux/mfd/max77693-private.h +++ b/include/linux/mfd/max77693-private.h | |||
| @@ -262,6 +262,41 @@ enum max77693_irq_source { | |||
| 262 | MAX77693_IRQ_GROUP_NR, | 262 | MAX77693_IRQ_GROUP_NR, |
| 263 | }; | 263 | }; |
| 264 | 264 | ||
| 265 | #define LED_IRQ_FLED2_OPEN BIT(0) | ||
| 266 | #define LED_IRQ_FLED2_SHORT BIT(1) | ||
| 267 | #define LED_IRQ_FLED1_OPEN BIT(2) | ||
| 268 | #define LED_IRQ_FLED1_SHORT BIT(3) | ||
| 269 | #define LED_IRQ_MAX_FLASH BIT(4) | ||
| 270 | |||
| 271 | #define TOPSYS_IRQ_T120C_INT BIT(0) | ||
| 272 | #define TOPSYS_IRQ_T140C_INT BIT(1) | ||
| 273 | #define TOPSYS_IRQ_LOWSYS_INT BIT(3) | ||
| 274 | |||
| 275 | #define CHG_IRQ_BYP_I BIT(0) | ||
| 276 | #define CHG_IRQ_THM_I BIT(2) | ||
| 277 | #define CHG_IRQ_BAT_I BIT(3) | ||
| 278 | #define CHG_IRQ_CHG_I BIT(4) | ||
| 279 | #define CHG_IRQ_CHGIN_I BIT(6) | ||
| 280 | |||
| 281 | #define MUIC_IRQ_INT1_ADC BIT(0) | ||
| 282 | #define MUIC_IRQ_INT1_ADC_LOW BIT(1) | ||
| 283 | #define MUIC_IRQ_INT1_ADC_ERR BIT(2) | ||
| 284 | #define MUIC_IRQ_INT1_ADC1K BIT(3) | ||
| 285 | |||
| 286 | #define MUIC_IRQ_INT2_CHGTYP BIT(0) | ||
| 287 | #define MUIC_IRQ_INT2_CHGDETREUN BIT(1) | ||
| 288 | #define MUIC_IRQ_INT2_DCDTMR BIT(2) | ||
| 289 | #define MUIC_IRQ_INT2_DXOVP BIT(3) | ||
| 290 | #define MUIC_IRQ_INT2_VBVOLT BIT(4) | ||
| 291 | #define MUIC_IRQ_INT2_VIDRM BIT(5) | ||
| 292 | |||
| 293 | #define MUIC_IRQ_INT3_EOC BIT(0) | ||
| 294 | #define MUIC_IRQ_INT3_CGMBC BIT(1) | ||
| 295 | #define MUIC_IRQ_INT3_OVP BIT(2) | ||
| 296 | #define MUIC_IRQ_INT3_MBCCHG_ERR BIT(3) | ||
| 297 | #define MUIC_IRQ_INT3_CHG_ENABLED BIT(4) | ||
| 298 | #define MUIC_IRQ_INT3_BAT_DET BIT(5) | ||
| 299 | |||
| 265 | enum max77693_irq { | 300 | enum max77693_irq { |
| 266 | /* PMIC - FLASH */ | 301 | /* PMIC - FLASH */ |
| 267 | MAX77693_LED_IRQ_FLED2_OPEN, | 302 | MAX77693_LED_IRQ_FLED2_OPEN, |
| @@ -282,6 +317,10 @@ enum max77693_irq { | |||
| 282 | MAX77693_CHG_IRQ_CHG_I, | 317 | MAX77693_CHG_IRQ_CHG_I, |
| 283 | MAX77693_CHG_IRQ_CHGIN_I, | 318 | MAX77693_CHG_IRQ_CHGIN_I, |
| 284 | 319 | ||
| 320 | MAX77693_IRQ_NR, | ||
| 321 | }; | ||
| 322 | |||
| 323 | enum max77693_irq_muic { | ||
| 285 | /* MUIC INT1 */ | 324 | /* MUIC INT1 */ |
| 286 | MAX77693_MUIC_IRQ_INT1_ADC, | 325 | MAX77693_MUIC_IRQ_INT1_ADC, |
| 287 | MAX77693_MUIC_IRQ_INT1_ADC_LOW, | 326 | MAX77693_MUIC_IRQ_INT1_ADC_LOW, |
| @@ -304,7 +343,7 @@ enum max77693_irq { | |||
| 304 | MAX77693_MUIC_IRQ_INT3_CHG_ENABLED, | 343 | MAX77693_MUIC_IRQ_INT3_CHG_ENABLED, |
| 305 | MAX77693_MUIC_IRQ_INT3_BAT_DET, | 344 | MAX77693_MUIC_IRQ_INT3_BAT_DET, |
| 306 | 345 | ||
| 307 | MAX77693_IRQ_NR, | 346 | MAX77693_MUIC_IRQ_NR, |
| 308 | }; | 347 | }; |
| 309 | 348 | ||
| 310 | struct max77693_dev { | 349 | struct max77693_dev { |
| @@ -319,7 +358,10 @@ struct max77693_dev { | |||
| 319 | struct regmap *regmap_muic; | 358 | struct regmap *regmap_muic; |
| 320 | struct regmap *regmap_haptic; | 359 | struct regmap *regmap_haptic; |
| 321 | 360 | ||
| 322 | struct irq_domain *irq_domain; | 361 | struct regmap_irq_chip_data *irq_data_led; |
| 362 | struct regmap_irq_chip_data *irq_data_topsys; | ||
| 363 | struct regmap_irq_chip_data *irq_data_charger; | ||
| 364 | struct regmap_irq_chip_data *irq_data_muic; | ||
| 323 | 365 | ||
| 324 | int irq; | 366 | int irq; |
| 325 | int irq_gpio; | 367 | int irq_gpio; |
| @@ -332,14 +374,6 @@ enum max77693_types { | |||
| 332 | TYPE_MAX77693, | 374 | TYPE_MAX77693, |
| 333 | }; | 375 | }; |
| 334 | 376 | ||
| 335 | extern int max77693_read_reg(struct regmap *map, u8 reg, u8 *dest); | ||
| 336 | extern int max77693_bulk_read(struct regmap *map, u8 reg, int count, | ||
| 337 | u8 *buf); | ||
| 338 | extern int max77693_write_reg(struct regmap *map, u8 reg, u8 value); | ||
| 339 | extern int max77693_bulk_write(struct regmap *map, u8 reg, int count, | ||
| 340 | u8 *buf); | ||
| 341 | extern int max77693_update_reg(struct regmap *map, u8 reg, u8 val, u8 mask); | ||
| 342 | |||
| 343 | extern int max77693_irq_init(struct max77693_dev *max77686); | 377 | extern int max77693_irq_init(struct max77693_dev *max77686); |
| 344 | extern void max77693_irq_exit(struct max77693_dev *max77686); | 378 | extern void max77693_irq_exit(struct max77693_dev *max77686); |
| 345 | extern int max77693_irq_resume(struct max77693_dev *max77686); | 379 | extern int max77693_irq_resume(struct max77693_dev *max77686); |
diff --git a/include/linux/mfd/palmas.h b/include/linux/mfd/palmas.h index 3420e09e2e20..fb0390a1a498 100644 --- a/include/linux/mfd/palmas.h +++ b/include/linux/mfd/palmas.h | |||
| @@ -30,6 +30,8 @@ | |||
| 30 | #define PALMAS_CHIP_ID 0xC035 | 30 | #define PALMAS_CHIP_ID 0xC035 |
| 31 | #define PALMAS_CHIP_CHARGER_ID 0xC036 | 31 | #define PALMAS_CHIP_CHARGER_ID 0xC036 |
| 32 | 32 | ||
| 33 | #define TPS65917_RESERVED -1 | ||
| 34 | |||
| 33 | #define is_palmas(a) (((a) == PALMAS_CHIP_OLD_ID) || \ | 35 | #define is_palmas(a) (((a) == PALMAS_CHIP_OLD_ID) || \ |
| 34 | ((a) == PALMAS_CHIP_ID)) | 36 | ((a) == PALMAS_CHIP_ID)) |
| 35 | #define is_palmas_charger(a) ((a) == PALMAS_CHIP_CHARGER_ID) | 37 | #define is_palmas_charger(a) ((a) == PALMAS_CHIP_CHARGER_ID) |
| @@ -51,6 +53,8 @@ struct palmas_pmic; | |||
| 51 | struct palmas_gpadc; | 53 | struct palmas_gpadc; |
| 52 | struct palmas_resource; | 54 | struct palmas_resource; |
| 53 | struct palmas_usb; | 55 | struct palmas_usb; |
| 56 | struct palmas_pmic_driver_data; | ||
| 57 | struct palmas_pmic_platform_data; | ||
| 54 | 58 | ||
| 55 | enum palmas_usb_state { | 59 | enum palmas_usb_state { |
| 56 | PALMAS_USB_STATE_DISCONNECT, | 60 | PALMAS_USB_STATE_DISCONNECT, |
| @@ -74,6 +78,8 @@ struct palmas { | |||
| 74 | struct mutex irq_lock; | 78 | struct mutex irq_lock; |
| 75 | struct regmap_irq_chip_data *irq_data; | 79 | struct regmap_irq_chip_data *irq_data; |
| 76 | 80 | ||
| 81 | struct palmas_pmic_driver_data *pmic_ddata; | ||
| 82 | |||
| 77 | /* Child Devices */ | 83 | /* Child Devices */ |
| 78 | struct palmas_pmic *pmic; | 84 | struct palmas_pmic *pmic; |
| 79 | struct palmas_gpadc *gpadc; | 85 | struct palmas_gpadc *gpadc; |
| @@ -86,6 +92,46 @@ struct palmas { | |||
| 86 | u8 pwm_muxed; | 92 | u8 pwm_muxed; |
| 87 | }; | 93 | }; |
| 88 | 94 | ||
| 95 | #define PALMAS_EXT_REQ (PALMAS_EXT_CONTROL_ENABLE1 | \ | ||
| 96 | PALMAS_EXT_CONTROL_ENABLE2 | \ | ||
| 97 | PALMAS_EXT_CONTROL_NSLEEP) | ||
| 98 | |||
| 99 | struct palmas_sleep_requestor_info { | ||
| 100 | int id; | ||
| 101 | int reg_offset; | ||
| 102 | int bit_pos; | ||
| 103 | }; | ||
| 104 | |||
| 105 | struct palmas_regs_info { | ||
| 106 | char *name; | ||
| 107 | char *sname; | ||
| 108 | u8 vsel_addr; | ||
| 109 | u8 ctrl_addr; | ||
| 110 | u8 tstep_addr; | ||
| 111 | int sleep_id; | ||
| 112 | }; | ||
| 113 | |||
| 114 | struct palmas_pmic_driver_data { | ||
| 115 | int smps_start; | ||
| 116 | int smps_end; | ||
| 117 | int ldo_begin; | ||
| 118 | int ldo_end; | ||
| 119 | int max_reg; | ||
| 120 | struct palmas_regs_info *palmas_regs_info; | ||
| 121 | struct of_regulator_match *palmas_matches; | ||
| 122 | struct palmas_sleep_requestor_info *sleep_req_info; | ||
| 123 | int (*smps_register)(struct palmas_pmic *pmic, | ||
| 124 | struct palmas_pmic_driver_data *ddata, | ||
| 125 | struct palmas_pmic_platform_data *pdata, | ||
| 126 | const char *pdev_name, | ||
| 127 | struct regulator_config config); | ||
| 128 | int (*ldo_register)(struct palmas_pmic *pmic, | ||
| 129 | struct palmas_pmic_driver_data *ddata, | ||
| 130 | struct palmas_pmic_platform_data *pdata, | ||
| 131 | const char *pdev_name, | ||
| 132 | struct regulator_config config); | ||
| 133 | }; | ||
| 134 | |||
| 89 | struct palmas_gpadc_platform_data { | 135 | struct palmas_gpadc_platform_data { |
| 90 | /* Channel 3 current source is only enabled during conversion */ | 136 | /* Channel 3 current source is only enabled during conversion */ |
| 91 | int ch3_current; | 137 | int ch3_current; |
| @@ -184,6 +230,27 @@ enum palmas_regulators { | |||
| 184 | PALMAS_NUM_REGS, | 230 | PALMAS_NUM_REGS, |
| 185 | }; | 231 | }; |
| 186 | 232 | ||
| 233 | enum tps65917_regulators { | ||
| 234 | /* SMPS regulators */ | ||
| 235 | TPS65917_REG_SMPS1, | ||
| 236 | TPS65917_REG_SMPS2, | ||
| 237 | TPS65917_REG_SMPS3, | ||
| 238 | TPS65917_REG_SMPS4, | ||
| 239 | TPS65917_REG_SMPS5, | ||
| 240 | /* LDO regulators */ | ||
| 241 | TPS65917_REG_LDO1, | ||
| 242 | TPS65917_REG_LDO2, | ||
| 243 | TPS65917_REG_LDO3, | ||
| 244 | TPS65917_REG_LDO4, | ||
| 245 | TPS65917_REG_LDO5, | ||
| 246 | TPS65917_REG_REGEN1, | ||
| 247 | TPS65917_REG_REGEN2, | ||
| 248 | TPS65917_REG_REGEN3, | ||
| 249 | |||
| 250 | /* Total number of regulators */ | ||
| 251 | TPS65917_NUM_REGS, | ||
| 252 | }; | ||
| 253 | |||
| 187 | /* External controll signal name */ | 254 | /* External controll signal name */ |
| 188 | enum { | 255 | enum { |
| 189 | PALMAS_EXT_CONTROL_ENABLE1 = 0x1, | 256 | PALMAS_EXT_CONTROL_ENABLE1 = 0x1, |
| @@ -228,6 +295,24 @@ enum palmas_external_requestor_id { | |||
| 228 | PALMAS_EXTERNAL_REQSTR_ID_MAX, | 295 | PALMAS_EXTERNAL_REQSTR_ID_MAX, |
| 229 | }; | 296 | }; |
| 230 | 297 | ||
| 298 | enum tps65917_external_requestor_id { | ||
| 299 | TPS65917_EXTERNAL_REQSTR_ID_REGEN1, | ||
| 300 | TPS65917_EXTERNAL_REQSTR_ID_REGEN2, | ||
| 301 | TPS65917_EXTERNAL_REQSTR_ID_REGEN3, | ||
| 302 | TPS65917_EXTERNAL_REQSTR_ID_SMPS1, | ||
| 303 | TPS65917_EXTERNAL_REQSTR_ID_SMPS2, | ||
| 304 | TPS65917_EXTERNAL_REQSTR_ID_SMPS3, | ||
| 305 | TPS65917_EXTERNAL_REQSTR_ID_SMPS4, | ||
| 306 | TPS65917_EXTERNAL_REQSTR_ID_SMPS5, | ||
| 307 | TPS65917_EXTERNAL_REQSTR_ID_LDO1, | ||
| 308 | TPS65917_EXTERNAL_REQSTR_ID_LDO2, | ||
| 309 | TPS65917_EXTERNAL_REQSTR_ID_LDO3, | ||
| 310 | TPS65917_EXTERNAL_REQSTR_ID_LDO4, | ||
| 311 | TPS65917_EXTERNAL_REQSTR_ID_LDO5, | ||
| 312 | /* Last entry */ | ||
| 313 | TPS65917_EXTERNAL_REQSTR_ID_MAX, | ||
| 314 | }; | ||
| 315 | |||
| 231 | struct palmas_pmic_platform_data { | 316 | struct palmas_pmic_platform_data { |
| 232 | /* An array of pointers to regulator init data indexed by regulator | 317 | /* An array of pointers to regulator init data indexed by regulator |
| 233 | * ID | 318 | * ID |
| @@ -349,6 +434,48 @@ struct palmas_gpadc_result { | |||
| 349 | 434 | ||
| 350 | #define PALMAS_MAX_CHANNELS 16 | 435 | #define PALMAS_MAX_CHANNELS 16 |
| 351 | 436 | ||
| 437 | /* Define the tps65917 IRQ numbers */ | ||
| 438 | enum tps65917_irqs { | ||
| 439 | /* INT1 registers */ | ||
| 440 | TPS65917_RESERVED1, | ||
| 441 | TPS65917_PWRON_IRQ, | ||
| 442 | TPS65917_LONG_PRESS_KEY_IRQ, | ||
| 443 | TPS65917_RESERVED2, | ||
| 444 | TPS65917_PWRDOWN_IRQ, | ||
| 445 | TPS65917_HOTDIE_IRQ, | ||
| 446 | TPS65917_VSYS_MON_IRQ, | ||
| 447 | TPS65917_RESERVED3, | ||
| 448 | /* INT2 registers */ | ||
| 449 | TPS65917_RESERVED4, | ||
| 450 | TPS65917_OTP_ERROR_IRQ, | ||
| 451 | TPS65917_WDT_IRQ, | ||
| 452 | TPS65917_RESERVED5, | ||
| 453 | TPS65917_RESET_IN_IRQ, | ||
| 454 | TPS65917_FSD_IRQ, | ||
| 455 | TPS65917_SHORT_IRQ, | ||
| 456 | TPS65917_RESERVED6, | ||
| 457 | /* INT3 registers */ | ||
| 458 | TPS65917_GPADC_AUTO_0_IRQ, | ||
| 459 | TPS65917_GPADC_AUTO_1_IRQ, | ||
| 460 | TPS65917_GPADC_EOC_SW_IRQ, | ||
| 461 | TPS65917_RESREVED6, | ||
| 462 | TPS65917_RESERVED7, | ||
| 463 | TPS65917_RESERVED8, | ||
| 464 | TPS65917_RESERVED9, | ||
| 465 | TPS65917_VBUS_IRQ, | ||
| 466 | /* INT4 registers */ | ||
| 467 | TPS65917_GPIO_0_IRQ, | ||
| 468 | TPS65917_GPIO_1_IRQ, | ||
| 469 | TPS65917_GPIO_2_IRQ, | ||
| 470 | TPS65917_GPIO_3_IRQ, | ||
| 471 | TPS65917_GPIO_4_IRQ, | ||
| 472 | TPS65917_GPIO_5_IRQ, | ||
| 473 | TPS65917_GPIO_6_IRQ, | ||
| 474 | TPS65917_RESERVED10, | ||
| 475 | /* Total Number IRQs */ | ||
| 476 | TPS65917_NUM_IRQ, | ||
| 477 | }; | ||
| 478 | |||
| 352 | /* Define the palmas IRQ numbers */ | 479 | /* Define the palmas IRQ numbers */ |
| 353 | enum palmas_irqs { | 480 | enum palmas_irqs { |
| 354 | /* INT1 registers */ | 481 | /* INT1 registers */ |
| @@ -400,6 +527,7 @@ struct palmas_pmic { | |||
| 400 | 527 | ||
| 401 | int smps123; | 528 | int smps123; |
| 402 | int smps457; | 529 | int smps457; |
| 530 | int smps12; | ||
| 403 | 531 | ||
| 404 | int range[PALMAS_REG_SMPS10_OUT1]; | 532 | int range[PALMAS_REG_SMPS10_OUT1]; |
| 405 | unsigned int ramp_delay[PALMAS_REG_SMPS10_OUT1]; | 533 | unsigned int ramp_delay[PALMAS_REG_SMPS10_OUT1]; |
| @@ -2871,6 +2999,715 @@ enum usb_irq_events { | |||
| 2871 | #define PALMAS_GPADC_TRIM15 0x0E | 2999 | #define PALMAS_GPADC_TRIM15 0x0E |
| 2872 | #define PALMAS_GPADC_TRIM16 0x0F | 3000 | #define PALMAS_GPADC_TRIM16 0x0F |
| 2873 | 3001 | ||
| 3002 | /* TPS65917 Interrupt registers */ | ||
| 3003 | |||
| 3004 | /* Registers for function INTERRUPT */ | ||
| 3005 | #define TPS65917_INT1_STATUS 0x00 | ||
| 3006 | #define TPS65917_INT1_MASK 0x01 | ||
| 3007 | #define TPS65917_INT1_LINE_STATE 0x02 | ||
| 3008 | #define TPS65917_INT2_STATUS 0x05 | ||
| 3009 | #define TPS65917_INT2_MASK 0x06 | ||
| 3010 | #define TPS65917_INT2_LINE_STATE 0x07 | ||
| 3011 | #define TPS65917_INT3_STATUS 0x0A | ||
| 3012 | #define TPS65917_INT3_MASK 0x0B | ||
| 3013 | #define TPS65917_INT3_LINE_STATE 0x0C | ||
| 3014 | #define TPS65917_INT4_STATUS 0x0F | ||
| 3015 | #define TPS65917_INT4_MASK 0x10 | ||
| 3016 | #define TPS65917_INT4_LINE_STATE 0x11 | ||
| 3017 | #define TPS65917_INT4_EDGE_DETECT1 0x12 | ||
| 3018 | #define TPS65917_INT4_EDGE_DETECT2 0x13 | ||
| 3019 | #define TPS65917_INT_CTRL 0x14 | ||
| 3020 | |||
| 3021 | /* Bit definitions for INT1_STATUS */ | ||
| 3022 | #define TPS65917_INT1_STATUS_VSYS_MON 0x40 | ||
| 3023 | #define TPS65917_INT1_STATUS_VSYS_MON_SHIFT 0x06 | ||
| 3024 | #define TPS65917_INT1_STATUS_HOTDIE 0x20 | ||
| 3025 | #define TPS65917_INT1_STATUS_HOTDIE_SHIFT 0x05 | ||
| 3026 | #define TPS65917_INT1_STATUS_PWRDOWN 0x10 | ||
| 3027 | #define TPS65917_INT1_STATUS_PWRDOWN_SHIFT 0x04 | ||
| 3028 | #define TPS65917_INT1_STATUS_LONG_PRESS_KEY 0x04 | ||
| 3029 | #define TPS65917_INT1_STATUS_LONG_PRESS_KEY_SHIFT 0x02 | ||
| 3030 | #define TPS65917_INT1_STATUS_PWRON 0x02 | ||
| 3031 | #define TPS65917_INT1_STATUS_PWRON_SHIFT 0x01 | ||
| 3032 | |||
| 3033 | /* Bit definitions for INT1_MASK */ | ||
| 3034 | #define TPS65917_INT1_MASK_VSYS_MON 0x40 | ||
| 3035 | #define TPS65917_INT1_MASK_VSYS_MON_SHIFT 0x06 | ||
| 3036 | #define TPS65917_INT1_MASK_HOTDIE 0x20 | ||
| 3037 | #define TPS65917_INT1_MASK_HOTDIE_SHIFT 0x05 | ||
| 3038 | #define TPS65917_INT1_MASK_PWRDOWN 0x10 | ||
| 3039 | #define TPS65917_INT1_MASK_PWRDOWN_SHIFT 0x04 | ||
| 3040 | #define TPS65917_INT1_MASK_LONG_PRESS_KEY 0x04 | ||
| 3041 | #define TPS65917_INT1_MASK_LONG_PRESS_KEY_SHIFT 0x02 | ||
| 3042 | #define TPS65917_INT1_MASK_PWRON 0x02 | ||
| 3043 | #define TPS65917_INT1_MASK_PWRON_SHIFT 0x01 | ||
| 3044 | |||
| 3045 | /* Bit definitions for INT1_LINE_STATE */ | ||
| 3046 | #define TPS65917_INT1_LINE_STATE_VSYS_MON 0x40 | ||
| 3047 | #define TPS65917_INT1_LINE_STATE_VSYS_MON_SHIFT 0x06 | ||
| 3048 | #define TPS65917_INT1_LINE_STATE_HOTDIE 0x20 | ||
| 3049 | #define TPS65917_INT1_LINE_STATE_HOTDIE_SHIFT 0x05 | ||
| 3050 | #define TPS65917_INT1_LINE_STATE_PWRDOWN 0x10 | ||
| 3051 | #define TPS65917_INT1_LINE_STATE_PWRDOWN_SHIFT 0x04 | ||
| 3052 | #define TPS65917_INT1_LINE_STATE_LONG_PRESS_KEY 0x04 | ||
| 3053 | #define TPS65917_INT1_LINE_STATE_LONG_PRESS_KEY_SHIFT 0x02 | ||
| 3054 | #define TPS65917_INT1_LINE_STATE_PWRON 0x02 | ||
| 3055 | #define TPS65917_INT1_LINE_STATE_PWRON_SHIFT 0x01 | ||
| 3056 | |||
| 3057 | /* Bit definitions for INT2_STATUS */ | ||
| 3058 | #define TPS65917_INT2_STATUS_SHORT 0x40 | ||
| 3059 | #define TPS65917_INT2_STATUS_SHORT_SHIFT 0x06 | ||
| 3060 | #define TPS65917_INT2_STATUS_FSD 0x20 | ||
| 3061 | #define TPS65917_INT2_STATUS_FSD_SHIFT 0x05 | ||
| 3062 | #define TPS65917_INT2_STATUS_RESET_IN 0x10 | ||
| 3063 | #define TPS65917_INT2_STATUS_RESET_IN_SHIFT 0x04 | ||
| 3064 | #define TPS65917_INT2_STATUS_WDT 0x04 | ||
| 3065 | #define TPS65917_INT2_STATUS_WDT_SHIFT 0x02 | ||
| 3066 | #define TPS65917_INT2_STATUS_OTP_ERROR 0x02 | ||
| 3067 | #define TPS65917_INT2_STATUS_OTP_ERROR_SHIFT 0x01 | ||
| 3068 | |||
| 3069 | /* Bit definitions for INT2_MASK */ | ||
| 3070 | #define TPS65917_INT2_MASK_SHORT 0x40 | ||
| 3071 | #define TPS65917_INT2_MASK_SHORT_SHIFT 0x06 | ||
| 3072 | #define TPS65917_INT2_MASK_FSD 0x20 | ||
| 3073 | #define TPS65917_INT2_MASK_FSD_SHIFT 0x05 | ||
| 3074 | #define TPS65917_INT2_MASK_RESET_IN 0x10 | ||
| 3075 | #define TPS65917_INT2_MASK_RESET_IN_SHIFT 0x04 | ||
| 3076 | #define TPS65917_INT2_MASK_WDT 0x04 | ||
| 3077 | #define TPS65917_INT2_MASK_WDT_SHIFT 0x02 | ||
| 3078 | #define TPS65917_INT2_MASK_OTP_ERROR_TIMER 0x02 | ||
| 3079 | #define TPS65917_INT2_MASK_OTP_ERROR_SHIFT 0x01 | ||
| 3080 | |||
| 3081 | /* Bit definitions for INT2_LINE_STATE */ | ||
| 3082 | #define TPS65917_INT2_LINE_STATE_SHORT 0x40 | ||
| 3083 | #define TPS65917_INT2_LINE_STATE_SHORT_SHIFT 0x06 | ||
| 3084 | #define TPS65917_INT2_LINE_STATE_FSD 0x20 | ||
| 3085 | #define TPS65917_INT2_LINE_STATE_FSD_SHIFT 0x05 | ||
| 3086 | #define TPS65917_INT2_LINE_STATE_RESET_IN 0x10 | ||
| 3087 | #define TPS65917_INT2_LINE_STATE_RESET_IN_SHIFT 0x04 | ||
| 3088 | #define TPS65917_INT2_LINE_STATE_WDT 0x04 | ||
| 3089 | #define TPS65917_INT2_LINE_STATE_WDT_SHIFT 0x02 | ||
| 3090 | #define TPS65917_INT2_LINE_STATE_OTP_ERROR 0x02 | ||
| 3091 | #define TPS65917_INT2_LINE_STATE_OTP_ERROR_SHIFT 0x01 | ||
| 3092 | |||
| 3093 | /* Bit definitions for INT3_STATUS */ | ||
| 3094 | #define TPS65917_INT3_STATUS_VBUS 0x80 | ||
| 3095 | #define TPS65917_INT3_STATUS_VBUS_SHIFT 0x07 | ||
| 3096 | #define TPS65917_INT3_STATUS_GPADC_EOC_SW 0x04 | ||
| 3097 | #define TPS65917_INT3_STATUS_GPADC_EOC_SW_SHIFT 0x02 | ||
| 3098 | #define TPS65917_INT3_STATUS_GPADC_AUTO_1 0x02 | ||
| 3099 | #define TPS65917_INT3_STATUS_GPADC_AUTO_1_SHIFT 0x01 | ||
| 3100 | #define TPS65917_INT3_STATUS_GPADC_AUTO_0 0x01 | ||
| 3101 | #define TPS65917_INT3_STATUS_GPADC_AUTO_0_SHIFT 0x00 | ||
| 3102 | |||
| 3103 | /* Bit definitions for INT3_MASK */ | ||
| 3104 | #define TPS65917_INT3_MASK_VBUS 0x80 | ||
| 3105 | #define TPS65917_INT3_MASK_VBUS_SHIFT 0x07 | ||
| 3106 | #define TPS65917_INT3_MASK_GPADC_EOC_SW 0x04 | ||
| 3107 | #define TPS65917_INT3_MASK_GPADC_EOC_SW_SHIFT 0x02 | ||
| 3108 | #define TPS65917_INT3_MASK_GPADC_AUTO_1 0x02 | ||
| 3109 | #define TPS65917_INT3_MASK_GPADC_AUTO_1_SHIFT 0x01 | ||
| 3110 | #define TPS65917_INT3_MASK_GPADC_AUTO_0 0x01 | ||
| 3111 | #define TPS65917_INT3_MASK_GPADC_AUTO_0_SHIFT 0x00 | ||
| 3112 | |||
| 3113 | /* Bit definitions for INT3_LINE_STATE */ | ||
| 3114 | #define TPS65917_INT3_LINE_STATE_VBUS 0x80 | ||
| 3115 | #define TPS65917_INT3_LINE_STATE_VBUS_SHIFT 0x07 | ||
| 3116 | #define TPS65917_INT3_LINE_STATE_GPADC_EOC_SW 0x04 | ||
| 3117 | #define TPS65917_INT3_LINE_STATE_GPADC_EOC_SW_SHIFT 0x02 | ||
| 3118 | #define TPS65917_INT3_LINE_STATE_GPADC_AUTO_1 0x02 | ||
| 3119 | #define TPS65917_INT3_LINE_STATE_GPADC_AUTO_1_SHIFT 0x01 | ||
| 3120 | #define TPS65917_INT3_LINE_STATE_GPADC_AUTO_0 0x01 | ||
| 3121 | #define TPS65917_INT3_LINE_STATE_GPADC_AUTO_0_SHIFT 0x00 | ||
| 3122 | |||
| 3123 | /* Bit definitions for INT4_STATUS */ | ||
| 3124 | #define TPS65917_INT4_STATUS_GPIO_6 0x40 | ||
| 3125 | #define TPS65917_INT4_STATUS_GPIO_6_SHIFT 0x06 | ||
| 3126 | #define TPS65917_INT4_STATUS_GPIO_5 0x20 | ||
| 3127 | #define TPS65917_INT4_STATUS_GPIO_5_SHIFT 0x05 | ||
| 3128 | #define TPS65917_INT4_STATUS_GPIO_4 0x10 | ||
| 3129 | #define TPS65917_INT4_STATUS_GPIO_4_SHIFT 0x04 | ||
| 3130 | #define TPS65917_INT4_STATUS_GPIO_3 0x08 | ||
| 3131 | #define TPS65917_INT4_STATUS_GPIO_3_SHIFT 0x03 | ||
| 3132 | #define TPS65917_INT4_STATUS_GPIO_2 0x04 | ||
| 3133 | #define TPS65917_INT4_STATUS_GPIO_2_SHIFT 0x02 | ||
| 3134 | #define TPS65917_INT4_STATUS_GPIO_1 0x02 | ||
| 3135 | #define TPS65917_INT4_STATUS_GPIO_1_SHIFT 0x01 | ||
| 3136 | #define TPS65917_INT4_STATUS_GPIO_0 0x01 | ||
| 3137 | #define TPS65917_INT4_STATUS_GPIO_0_SHIFT 0x00 | ||
| 3138 | |||
| 3139 | /* Bit definitions for INT4_MASK */ | ||
| 3140 | #define TPS65917_INT4_MASK_GPIO_6 0x40 | ||
| 3141 | #define TPS65917_INT4_MASK_GPIO_6_SHIFT 0x06 | ||
| 3142 | #define TPS65917_INT4_MASK_GPIO_5 0x20 | ||
| 3143 | #define TPS65917_INT4_MASK_GPIO_5_SHIFT 0x05 | ||
| 3144 | #define TPS65917_INT4_MASK_GPIO_4 0x10 | ||
| 3145 | #define TPS65917_INT4_MASK_GPIO_4_SHIFT 0x04 | ||
| 3146 | #define TPS65917_INT4_MASK_GPIO_3 0x08 | ||
| 3147 | #define TPS65917_INT4_MASK_GPIO_3_SHIFT 0x03 | ||
| 3148 | #define TPS65917_INT4_MASK_GPIO_2 0x04 | ||
| 3149 | #define TPS65917_INT4_MASK_GPIO_2_SHIFT 0x02 | ||
| 3150 | #define TPS65917_INT4_MASK_GPIO_1 0x02 | ||
| 3151 | #define TPS65917_INT4_MASK_GPIO_1_SHIFT 0x01 | ||
| 3152 | #define TPS65917_INT4_MASK_GPIO_0 0x01 | ||
| 3153 | #define TPS65917_INT4_MASK_GPIO_0_SHIFT 0x00 | ||
| 3154 | |||
| 3155 | /* Bit definitions for INT4_LINE_STATE */ | ||
| 3156 | #define TPS65917_INT4_LINE_STATE_GPIO_6 0x40 | ||
| 3157 | #define TPS65917_INT4_LINE_STATE_GPIO_6_SHIFT 0x06 | ||
| 3158 | #define TPS65917_INT4_LINE_STATE_GPIO_5 0x20 | ||
| 3159 | #define TPS65917_INT4_LINE_STATE_GPIO_5_SHIFT 0x05 | ||
| 3160 | #define TPS65917_INT4_LINE_STATE_GPIO_4 0x10 | ||
| 3161 | #define TPS65917_INT4_LINE_STATE_GPIO_4_SHIFT 0x04 | ||
| 3162 | #define TPS65917_INT4_LINE_STATE_GPIO_3 0x08 | ||
| 3163 | #define TPS65917_INT4_LINE_STATE_GPIO_3_SHIFT 0x03 | ||
| 3164 | #define TPS65917_INT4_LINE_STATE_GPIO_2 0x04 | ||
| 3165 | #define TPS65917_INT4_LINE_STATE_GPIO_2_SHIFT 0x02 | ||
| 3166 | #define TPS65917_INT4_LINE_STATE_GPIO_1 0x02 | ||
| 3167 | #define TPS65917_INT4_LINE_STATE_GPIO_1_SHIFT 0x01 | ||
| 3168 | #define TPS65917_INT4_LINE_STATE_GPIO_0 0x01 | ||
| 3169 | #define TPS65917_INT4_LINE_STATE_GPIO_0_SHIFT 0x00 | ||
| 3170 | |||
| 3171 | /* Bit definitions for INT4_EDGE_DETECT1 */ | ||
| 3172 | #define TPS65917_INT4_EDGE_DETECT1_GPIO_3_RISING 0x80 | ||
| 3173 | #define TPS65917_INT4_EDGE_DETECT1_GPIO_3_RISING_SHIFT 0x07 | ||
| 3174 | #define TPS65917_INT4_EDGE_DETECT1_GPIO_3_FALLING 0x40 | ||
| 3175 | #define TPS65917_INT4_EDGE_DETECT1_GPIO_3_FALLING_SHIFT 0x06 | ||
| 3176 | #define TPS65917_INT4_EDGE_DETECT1_GPIO_2_RISING 0x20 | ||
| 3177 | #define TPS65917_INT4_EDGE_DETECT1_GPIO_2_RISING_SHIFT 0x05 | ||
| 3178 | #define TPS65917_INT4_EDGE_DETECT1_GPIO_2_FALLING 0x10 | ||
| 3179 | #define TPS65917_INT4_EDGE_DETECT1_GPIO_2_FALLING_SHIFT 0x04 | ||
| 3180 | #define TPS65917_INT4_EDGE_DETECT1_GPIO_1_RISING 0x08 | ||
| 3181 | #define TPS65917_INT4_EDGE_DETECT1_GPIO_1_RISING_SHIFT 0x03 | ||
| 3182 | #define TPS65917_INT4_EDGE_DETECT1_GPIO_1_FALLING 0x04 | ||
| 3183 | #define TPS65917_INT4_EDGE_DETECT1_GPIO_1_FALLING_SHIFT 0x02 | ||
| 3184 | #define TPS65917_INT4_EDGE_DETECT1_GPIO_0_RISING 0x02 | ||
| 3185 | #define TPS65917_INT4_EDGE_DETECT1_GPIO_0_RISING_SHIFT 0x01 | ||
| 3186 | #define TPS65917_INT4_EDGE_DETECT1_GPIO_0_FALLING 0x01 | ||
| 3187 | #define TPS65917_INT4_EDGE_DETECT1_GPIO_0_FALLING_SHIFT 0x00 | ||
| 3188 | |||
| 3189 | /* Bit definitions for INT4_EDGE_DETECT2 */ | ||
| 3190 | #define TPS65917_INT4_EDGE_DETECT2_GPIO_6_RISING 0x20 | ||
| 3191 | #define TPS65917_INT4_EDGE_DETECT2_GPIO_6_RISING_SHIFT 0x05 | ||
| 3192 | #define TPS65917_INT4_EDGE_DETECT2_GPIO_6_FALLING 0x10 | ||
| 3193 | #define TPS65917_INT4_EDGE_DETECT2_GPIO_6_FALLING_SHIFT 0x04 | ||
| 3194 | #define TPS65917_INT4_EDGE_DETECT2_GPIO_5_RISING 0x08 | ||
| 3195 | #define TPS65917_INT4_EDGE_DETECT2_GPIO_5_RISING_SHIFT 0x03 | ||
| 3196 | #define TPS65917_INT4_EDGE_DETECT2_GPIO_5_FALLING 0x04 | ||
| 3197 | #define TPS65917_INT4_EDGE_DETECT2_GPIO_5_FALLING_SHIFT 0x02 | ||
| 3198 | #define TPS65917_INT4_EDGE_DETECT2_GPIO_4_RISING 0x02 | ||
| 3199 | #define TPS65917_INT4_EDGE_DETECT2_GPIO_4_RISING_SHIFT 0x01 | ||
| 3200 | #define TPS65917_INT4_EDGE_DETECT2_GPIO_4_FALLING 0x01 | ||
| 3201 | #define TPS65917_INT4_EDGE_DETECT2_GPIO_4_FALLING_SHIFT 0x00 | ||
| 3202 | |||
| 3203 | /* Bit definitions for INT_CTRL */ | ||
| 3204 | #define TPS65917_INT_CTRL_INT_PENDING 0x04 | ||
| 3205 | #define TPS65917_INT_CTRL_INT_PENDING_SHIFT 0x02 | ||
| 3206 | #define TPS65917_INT_CTRL_INT_CLEAR 0x01 | ||
| 3207 | #define TPS65917_INT_CTRL_INT_CLEAR_SHIFT 0x00 | ||
| 3208 | |||
| 3209 | /* TPS65917 SMPS Registers */ | ||
| 3210 | |||
| 3211 | /* Registers for function SMPS */ | ||
| 3212 | #define TPS65917_SMPS1_CTRL 0x00 | ||
| 3213 | #define TPS65917_SMPS1_FORCE 0x02 | ||
| 3214 | #define TPS65917_SMPS1_VOLTAGE 0x03 | ||
| 3215 | #define TPS65917_SMPS2_CTRL 0x04 | ||
| 3216 | #define TPS65917_SMPS2_FORCE 0x06 | ||
| 3217 | #define TPS65917_SMPS2_VOLTAGE 0x07 | ||
| 3218 | #define TPS65917_SMPS3_CTRL 0x0C | ||
| 3219 | #define TPS65917_SMPS3_FORCE 0x0E | ||
| 3220 | #define TPS65917_SMPS3_VOLTAGE 0x0F | ||
| 3221 | #define TPS65917_SMPS4_CTRL 0x10 | ||
| 3222 | #define TPS65917_SMPS4_VOLTAGE 0x13 | ||
| 3223 | #define TPS65917_SMPS5_CTRL 0x18 | ||
| 3224 | #define TPS65917_SMPS5_VOLTAGE 0x1B | ||
| 3225 | #define TPS65917_SMPS_CTRL 0x24 | ||
| 3226 | #define TPS65917_SMPS_PD_CTRL 0x25 | ||
| 3227 | #define TPS65917_SMPS_THERMAL_EN 0x27 | ||
| 3228 | #define TPS65917_SMPS_THERMAL_STATUS 0x28 | ||
| 3229 | #define TPS65917_SMPS_SHORT_STATUS 0x29 | ||
| 3230 | #define TPS65917_SMPS_NEGATIVE_CURRENT_LIMIT_EN 0x2A | ||
| 3231 | #define TPS65917_SMPS_POWERGOOD_MASK1 0x2B | ||
| 3232 | #define TPS65917_SMPS_POWERGOOD_MASK2 0x2C | ||
| 3233 | |||
| 3234 | /* Bit definitions for SMPS1_CTRL */ | ||
| 3235 | #define TPS65917_SMPS1_CTRL_WR_S 0x80 | ||
| 3236 | #define TPS65917_SMPS1_CTRL_WR_S_SHIFT 0x07 | ||
| 3237 | #define TPS65917_SMPS1_CTRL_ROOF_FLOOR_EN 0x40 | ||
| 3238 | #define TPS65917_SMPS1_CTRL_ROOF_FLOOR_EN_SHIFT 0x06 | ||
| 3239 | #define TPS65917_SMPS1_CTRL_STATUS_MASK 0x30 | ||
| 3240 | #define TPS65917_SMPS1_CTRL_STATUS_SHIFT 0x04 | ||
| 3241 | #define TPS65917_SMPS1_CTRL_MODE_SLEEP_MASK 0x0C | ||
| 3242 | #define TPS65917_SMPS1_CTRL_MODE_SLEEP_SHIFT 0x02 | ||
| 3243 | #define TPS65917_SMPS1_CTRL_MODE_ACTIVE_MASK 0x03 | ||
| 3244 | #define TPS65917_SMPS1_CTRL_MODE_ACTIVE_SHIFT 0x00 | ||
| 3245 | |||
| 3246 | /* Bit definitions for SMPS1_FORCE */ | ||
| 3247 | #define TPS65917_SMPS1_FORCE_CMD 0x80 | ||
| 3248 | #define TPS65917_SMPS1_FORCE_CMD_SHIFT 0x07 | ||
| 3249 | #define TPS65917_SMPS1_FORCE_VSEL_MASK 0x7F | ||
| 3250 | #define TPS65917_SMPS1_FORCE_VSEL_SHIFT 0x00 | ||
| 3251 | |||
| 3252 | /* Bit definitions for SMPS1_VOLTAGE */ | ||
| 3253 | #define TPS65917_SMPS1_VOLTAGE_RANGE 0x80 | ||
| 3254 | #define TPS65917_SMPS1_VOLTAGE_RANGE_SHIFT 0x07 | ||
| 3255 | #define TPS65917_SMPS1_VOLTAGE_VSEL_MASK 0x7F | ||
| 3256 | #define TPS65917_SMPS1_VOLTAGE_VSEL_SHIFT 0x00 | ||
| 3257 | |||
| 3258 | /* Bit definitions for SMPS2_CTRL */ | ||
| 3259 | #define TPS65917_SMPS2_CTRL_WR_S 0x80 | ||
| 3260 | #define TPS65917_SMPS2_CTRL_WR_S_SHIFT 0x07 | ||
| 3261 | #define TPS65917_SMPS2_CTRL_ROOF_FLOOR_EN 0x40 | ||
| 3262 | #define TPS65917_SMPS2_CTRL_ROOF_FLOOR_EN_SHIFT 0x06 | ||
| 3263 | #define TPS65917_SMPS2_CTRL_STATUS_MASK 0x30 | ||
| 3264 | #define TPS65917_SMPS2_CTRL_STATUS_SHIFT 0x04 | ||
| 3265 | #define TPS65917_SMPS2_CTRL_MODE_SLEEP_MASK 0x0C | ||
| 3266 | #define TPS65917_SMPS2_CTRL_MODE_SLEEP_SHIFT 0x02 | ||
| 3267 | #define TPS65917_SMPS2_CTRL_MODE_ACTIVE_MASK 0x03 | ||
| 3268 | #define TPS65917_SMPS2_CTRL_MODE_ACTIVE_SHIFT 0x00 | ||
| 3269 | |||
| 3270 | /* Bit definitions for SMPS2_FORCE */ | ||
| 3271 | #define TPS65917_SMPS2_FORCE_CMD 0x80 | ||
| 3272 | #define TPS65917_SMPS2_FORCE_CMD_SHIFT 0x07 | ||
| 3273 | #define TPS65917_SMPS2_FORCE_VSEL_MASK 0x7F | ||
| 3274 | #define TPS65917_SMPS2_FORCE_VSEL_SHIFT 0x00 | ||
| 3275 | |||
| 3276 | /* Bit definitions for SMPS2_VOLTAGE */ | ||
| 3277 | #define TPS65917_SMPS2_VOLTAGE_RANGE 0x80 | ||
| 3278 | #define TPS65917_SMPS2_VOLTAGE_RANGE_SHIFT 0x07 | ||
| 3279 | #define TPS65917_SMPS2_VOLTAGE_VSEL_MASK 0x7F | ||
| 3280 | #define TPS65917_SMPS2_VOLTAGE_VSEL_SHIFT 0x00 | ||
| 3281 | |||
| 3282 | /* Bit definitions for SMPS3_CTRL */ | ||
| 3283 | #define TPS65917_SMPS3_CTRL_WR_S 0x80 | ||
| 3284 | #define TPS65917_SMPS3_CTRL_WR_S_SHIFT 0x07 | ||
| 3285 | #define TPS65917_SMPS3_CTRL_ROOF_FLOOR_EN 0x40 | ||
| 3286 | #define TPS65917_SMPS3_CTRL_ROOF_FLOOR_EN_SHIFT 0x06 | ||
| 3287 | #define TPS65917_SMPS3_CTRL_STATUS_MASK 0x30 | ||
| 3288 | #define TPS65917_SMPS3_CTRL_STATUS_SHIFT 0x04 | ||
| 3289 | #define TPS65917_SMPS3_CTRL_MODE_SLEEP_MASK 0x0C | ||
| 3290 | #define TPS65917_SMPS3_CTRL_MODE_SLEEP_SHIFT 0x02 | ||
| 3291 | #define TPS65917_SMPS3_CTRL_MODE_ACTIVE_MASK 0x03 | ||
| 3292 | #define TPS65917_SMPS3_CTRL_MODE_ACTIVE_SHIFT 0x00 | ||
| 3293 | |||
| 3294 | /* Bit definitions for SMPS3_FORCE */ | ||
| 3295 | #define TPS65917_SMPS3_FORCE_CMD 0x80 | ||
| 3296 | #define TPS65917_SMPS3_FORCE_CMD_SHIFT 0x07 | ||
| 3297 | #define TPS65917_SMPS3_FORCE_VSEL_MASK 0x7F | ||
| 3298 | #define TPS65917_SMPS3_FORCE_VSEL_SHIFT 0x00 | ||
| 3299 | |||
| 3300 | /* Bit definitions for SMPS3_VOLTAGE */ | ||
| 3301 | #define TPS65917_SMPS3_VOLTAGE_RANGE 0x80 | ||
| 3302 | #define TPS65917_SMPS3_VOLTAGE_RANGE_SHIFT 0x07 | ||
| 3303 | #define TPS65917_SMPS3_VOLTAGE_VSEL_MASK 0x7F | ||
| 3304 | #define TPS65917_SMPS3_VOLTAGE_VSEL_SHIFT 0x00 | ||
| 3305 | |||
| 3306 | /* Bit definitions for SMPS4_CTRL */ | ||
| 3307 | #define TPS65917_SMPS4_CTRL_WR_S 0x80 | ||
| 3308 | #define TPS65917_SMPS4_CTRL_WR_S_SHIFT 0x07 | ||
| 3309 | #define TPS65917_SMPS4_CTRL_ROOF_FLOOR_EN 0x40 | ||
| 3310 | #define TPS65917_SMPS4_CTRL_ROOF_FLOOR_EN_SHIFT 0x06 | ||
| 3311 | #define TPS65917_SMPS4_CTRL_STATUS_MASK 0x30 | ||
| 3312 | #define TPS65917_SMPS4_CTRL_STATUS_SHIFT 0x04 | ||
| 3313 | #define TPS65917_SMPS4_CTRL_MODE_SLEEP_MASK 0x0C | ||
| 3314 | #define TPS65917_SMPS4_CTRL_MODE_SLEEP_SHIFT 0x02 | ||
| 3315 | #define TPS65917_SMPS4_CTRL_MODE_ACTIVE_MASK 0x03 | ||
| 3316 | #define TPS65917_SMPS4_CTRL_MODE_ACTIVE_SHIFT 0x00 | ||
| 3317 | |||
| 3318 | /* Bit definitions for SMPS4_VOLTAGE */ | ||
| 3319 | #define TPS65917_SMPS4_VOLTAGE_RANGE 0x80 | ||
| 3320 | #define TPS65917_SMPS4_VOLTAGE_RANGE_SHIFT 0x07 | ||
| 3321 | #define TPS65917_SMPS4_VOLTAGE_VSEL_MASK 0x7F | ||
| 3322 | #define TPS65917_SMPS4_VOLTAGE_VSEL_SHIFT 0x00 | ||
| 3323 | |||
| 3324 | /* Bit definitions for SMPS5_CTRL */ | ||
| 3325 | #define TPS65917_SMPS5_CTRL_WR_S 0x80 | ||
| 3326 | #define TPS65917_SMPS5_CTRL_WR_S_SHIFT 0x07 | ||
| 3327 | #define TPS65917_SMPS5_CTRL_ROOF_FLOOR_EN 0x40 | ||
| 3328 | #define TPS65917_SMPS5_CTRL_ROOF_FLOOR_EN_SHIFT 0x06 | ||
| 3329 | #define TPS65917_SMPS5_CTRL_STATUS_MASK 0x30 | ||
| 3330 | #define TPS65917_SMPS5_CTRL_STATUS_SHIFT 0x04 | ||
| 3331 | #define TPS65917_SMPS5_CTRL_MODE_SLEEP_MASK 0x0C | ||
| 3332 | #define TPS65917_SMPS5_CTRL_MODE_SLEEP_SHIFT 0x02 | ||
| 3333 | #define TPS65917_SMPS5_CTRL_MODE_ACTIVE_MASK 0x03 | ||
| 3334 | #define TPS65917_SMPS5_CTRL_MODE_ACTIVE_SHIFT 0x00 | ||
| 3335 | |||
| 3336 | /* Bit definitions for SMPS5_VOLTAGE */ | ||
| 3337 | #define TPS65917_SMPS5_VOLTAGE_RANGE 0x80 | ||
| 3338 | #define TPS65917_SMPS5_VOLTAGE_RANGE_SHIFT 0x07 | ||
| 3339 | #define TPS65917_SMPS5_VOLTAGE_VSEL_MASK 0x7F | ||
| 3340 | #define TPS65917_SMPS5_VOLTAGE_VSEL_SHIFT 0x00 | ||
| 3341 | |||
| 3342 | /* Bit definitions for SMPS_CTRL */ | ||
| 3343 | #define TPS65917_SMPS_CTRL_SMPS1_SMPS12_EN 0x10 | ||
| 3344 | #define TPS65917_SMPS_CTRL_SMPS1_SMPS12_EN_SHIFT 0x04 | ||
| 3345 | #define TPS65917_SMPS_CTRL_SMPS12_PHASE_CTRL 0x03 | ||
| 3346 | #define TPS65917_SMPS_CTRL_SMPS12_PHASE_CTRL_SHIFT 0x00 | ||
| 3347 | |||
| 3348 | /* Bit definitions for SMPS_PD_CTRL */ | ||
| 3349 | #define TPS65917_SMPS_PD_CTRL_SMPS5 0x40 | ||
| 3350 | #define TPS65917_SMPS_PD_CTRL_SMPS5_SHIFT 0x06 | ||
| 3351 | #define TPS65917_SMPS_PD_CTRL_SMPS4 0x10 | ||
| 3352 | #define TPS65917_SMPS_PD_CTRL_SMPS4_SHIFT 0x04 | ||
| 3353 | #define TPS65917_SMPS_PD_CTRL_SMPS3 0x08 | ||
| 3354 | #define TPS65917_SMPS_PD_CTRL_SMPS3_SHIFT 0x03 | ||
| 3355 | #define TPS65917_SMPS_PD_CTRL_SMPS2 0x02 | ||
| 3356 | #define TPS65917_SMPS_PD_CTRL_SMPS2_SHIFT 0x01 | ||
| 3357 | #define TPS65917_SMPS_PD_CTRL_SMPS1 0x01 | ||
| 3358 | #define TPS65917_SMPS_PD_CTRL_SMPS1_SHIFT 0x00 | ||
| 3359 | |||
| 3360 | /* Bit definitions for SMPS_THERMAL_EN */ | ||
| 3361 | #define TPS65917_SMPS_THERMAL_EN_SMPS5 0x40 | ||
| 3362 | #define TPS65917_SMPS_THERMAL_EN_SMPS5_SHIFT 0x06 | ||
| 3363 | #define TPS65917_SMPS_THERMAL_EN_SMPS3 0x08 | ||
| 3364 | #define TPS65917_SMPS_THERMAL_EN_SMPS3_SHIFT 0x03 | ||
| 3365 | #define TPS65917_SMPS_THERMAL_EN_SMPS12 0x01 | ||
| 3366 | #define TPS65917_SMPS_THERMAL_EN_SMPS12_SHIFT 0x00 | ||
| 3367 | |||
| 3368 | /* Bit definitions for SMPS_THERMAL_STATUS */ | ||
| 3369 | #define TPS65917_SMPS_THERMAL_STATUS_SMPS5 0x40 | ||
| 3370 | #define TPS65917_SMPS_THERMAL_STATUS_SMPS5_SHIFT 0x06 | ||
| 3371 | #define TPS65917_SMPS_THERMAL_STATUS_SMPS3 0x08 | ||
| 3372 | #define TPS65917_SMPS_THERMAL_STATUS_SMPS3_SHIFT 0x03 | ||
| 3373 | #define TPS65917_SMPS_THERMAL_STATUS_SMPS12 0x01 | ||
| 3374 | #define TPS65917_SMPS_THERMAL_STATUS_SMPS12_SHIFT 0x00 | ||
| 3375 | |||
| 3376 | /* Bit definitions for SMPS_SHORT_STATUS */ | ||
| 3377 | #define TPS65917_SMPS_SHORT_STATUS_SMPS5 0x40 | ||
| 3378 | #define TPS65917_SMPS_SHORT_STATUS_SMPS5_SHIFT 0x06 | ||
| 3379 | #define TPS65917_SMPS_SHORT_STATUS_SMPS4 0x10 | ||
| 3380 | #define TPS65917_SMPS_SHORT_STATUS_SMPS4_SHIFT 0x04 | ||
| 3381 | #define TPS65917_SMPS_SHORT_STATUS_SMPS3 0x08 | ||
| 3382 | #define TPS65917_SMPS_SHORT_STATUS_SMPS3_SHIFT 0x03 | ||
| 3383 | #define TPS65917_SMPS_SHORT_STATUS_SMPS2 0x02 | ||
| 3384 | #define TPS65917_SMPS_SHORT_STATUS_SMPS2_SHIFT 0x01 | ||
| 3385 | #define TPS65917_SMPS_SHORT_STATUS_SMPS1 0x01 | ||
| 3386 | #define TPS65917_SMPS_SHORT_STATUS_SMPS1_SHIFT 0x00 | ||
| 3387 | |||
| 3388 | /* Bit definitions for SMPS_NEGATIVE_CURRENT_LIMIT_EN */ | ||
| 3389 | #define TPS65917_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS5 0x40 | ||
| 3390 | #define TPS65917_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS5_SHIFT 0x06 | ||
| 3391 | #define TPS65917_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS4 0x10 | ||
| 3392 | #define TPS65917_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS4_SHIFT 0x04 | ||
| 3393 | #define TPS65917_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS3 0x08 | ||
| 3394 | #define TPS65917_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS3_SHIFT 0x03 | ||
| 3395 | #define TPS65917_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS2 0x02 | ||
| 3396 | #define TPS65917_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS2_SHIFT 0x01 | ||
| 3397 | #define TPS65917_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS1 0x01 | ||
| 3398 | #define TPS65917_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS1_SHIFT 0x00 | ||
| 3399 | |||
| 3400 | /* Bit definitions for SMPS_POWERGOOD_MASK1 */ | ||
| 3401 | #define TPS65917_SMPS_POWERGOOD_MASK1_SMPS5 0x40 | ||
| 3402 | #define TPS65917_SMPS_POWERGOOD_MASK1_SMPS5_SHIFT 0x06 | ||
| 3403 | #define TPS65917_SMPS_POWERGOOD_MASK1_SMPS4 0x10 | ||
| 3404 | #define TPS65917_SMPS_POWERGOOD_MASK1_SMPS4_SHIFT 0x04 | ||
| 3405 | #define TPS65917_SMPS_POWERGOOD_MASK1_SMPS3 0x08 | ||
| 3406 | #define TPS65917_SMPS_POWERGOOD_MASK1_SMPS3_SHIFT 0x03 | ||
| 3407 | #define TPS65917_SMPS_POWERGOOD_MASK1_SMPS2 0x02 | ||
| 3408 | #define TPS65917_SMPS_POWERGOOD_MASK1_SMPS2_SHIFT 0x01 | ||
| 3409 | #define TPS65917_SMPS_POWERGOOD_MASK1_SMPS1 0x01 | ||
| 3410 | #define TPS65917_SMPS_POWERGOOD_MASK1_SMPS1_SHIFT 0x00 | ||
| 3411 | |||
| 3412 | /* Bit definitions for SMPS_POWERGOOD_MASK2 */ | ||
| 3413 | #define TPS65917_SMPS_POWERGOOD_MASK2_POWERGOOD_TYPE_SELECT 0x80 | ||
| 3414 | #define TPS65917_SMPS_POWERGOOD_MASK2_POWERGOOD_TYPE_SELECT_SHIFT 0x07 | ||
| 3415 | #define TPS65917_SMPS_POWERGOOD_MASK2_OVC_ALARM_SHIFT 0x10 | ||
| 3416 | #define TPS65917_SMPS_POWERGOOD_MASK2_OVC_ALARM 0x04 | ||
| 3417 | |||
| 3418 | /* Bit definitions for SMPS_PLL_CTRL */ | ||
| 3419 | |||
| 3420 | #define TPS65917_SMPS_PLL_CTRL_PLL_EN_PLL_BYPASS_SHIFT 0x08 | ||
| 3421 | #define TPS65917_SMPS_PLL_CTRL_PLL_PLL_EN_BYPASS 0x03 | ||
| 3422 | #define TPS65917_SMPS_PLL_CTRL_PLL_PLL_BYPASS_CLK_SHIFT 0x04 | ||
| 3423 | #define TPS65917_SMPS_PLL_CTRL_PLL_PLL_BYPASS_CLK 0x02 | ||
| 3424 | |||
| 3425 | /* Registers for function LDO */ | ||
| 3426 | #define TPS65917_LDO1_CTRL 0x00 | ||
| 3427 | #define TPS65917_LDO1_VOLTAGE 0x01 | ||
| 3428 | #define TPS65917_LDO2_CTRL 0x02 | ||
| 3429 | #define TPS65917_LDO2_VOLTAGE 0x03 | ||
| 3430 | #define TPS65917_LDO3_CTRL 0x04 | ||
| 3431 | #define TPS65917_LDO3_VOLTAGE 0x05 | ||
| 3432 | #define TPS65917_LDO4_CTRL 0x0E | ||
| 3433 | #define TPS65917_LDO4_VOLTAGE 0x0F | ||
| 3434 | #define TPS65917_LDO5_CTRL 0x12 | ||
| 3435 | #define TPS65917_LDO5_VOLTAGE 0x13 | ||
| 3436 | #define TPS65917_LDO_PD_CTRL1 0x1B | ||
| 3437 | #define TPS65917_LDO_PD_CTRL2 0x1C | ||
| 3438 | #define TPS65917_LDO_SHORT_STATUS1 0x1D | ||
| 3439 | #define TPS65917_LDO_SHORT_STATUS2 0x1E | ||
| 3440 | #define TPS65917_LDO_PD_CTRL3 0x2D | ||
| 3441 | #define TPS65917_LDO_SHORT_STATUS3 0x2E | ||
| 3442 | |||
| 3443 | /* Bit definitions for LDO1_CTRL */ | ||
| 3444 | #define TPS65917_LDO1_CTRL_WR_S 0x80 | ||
| 3445 | #define TPS65917_LDO1_CTRL_WR_S_SHIFT 0x07 | ||
| 3446 | #define TPS65917_LDO1_CTRL_BYPASS_EN 0x40 | ||
| 3447 | #define TPS65917_LDO1_CTRL_BYPASS_EN_SHIFT 0x06 | ||
| 3448 | #define TPS65917_LDO1_CTRL_STATUS 0x10 | ||
| 3449 | #define TPS65917_LDO1_CTRL_STATUS_SHIFT 0x04 | ||
| 3450 | #define TPS65917_LDO1_CTRL_MODE_SLEEP 0x04 | ||
| 3451 | #define TPS65917_LDO1_CTRL_MODE_SLEEP_SHIFT 0x02 | ||
| 3452 | #define TPS65917_LDO1_CTRL_MODE_ACTIVE 0x01 | ||
| 3453 | #define TPS65917_LDO1_CTRL_MODE_ACTIVE_SHIFT 0x00 | ||
| 3454 | |||
| 3455 | /* Bit definitions for LDO1_VOLTAGE */ | ||
| 3456 | #define TPS65917_LDO1_VOLTAGE_VSEL_MASK 0x2F | ||
| 3457 | #define TPS65917_LDO1_VOLTAGE_VSEL_SHIFT 0x00 | ||
| 3458 | |||
| 3459 | /* Bit definitions for LDO2_CTRL */ | ||
| 3460 | #define TPS65917_LDO2_CTRL_WR_S 0x80 | ||
| 3461 | #define TPS65917_LDO2_CTRL_WR_S_SHIFT 0x07 | ||
| 3462 | #define TPS65917_LDO2_CTRL_BYPASS_EN 0x40 | ||
| 3463 | #define TPS65917_LDO2_CTRL_BYPASS_EN_SHIFT 0x06 | ||
| 3464 | #define TPS65917_LDO2_CTRL_STATUS 0x10 | ||
| 3465 | #define TPS65917_LDO2_CTRL_STATUS_SHIFT 0x04 | ||
| 3466 | #define TPS65917_LDO2_CTRL_MODE_SLEEP 0x04 | ||
| 3467 | #define TPS65917_LDO2_CTRL_MODE_SLEEP_SHIFT 0x02 | ||
| 3468 | #define TPS65917_LDO2_CTRL_MODE_ACTIVE 0x01 | ||
| 3469 | #define TPS65917_LDO2_CTRL_MODE_ACTIVE_SHIFT 0x00 | ||
| 3470 | |||
| 3471 | /* Bit definitions for LDO2_VOLTAGE */ | ||
| 3472 | #define TPS65917_LDO2_VOLTAGE_VSEL_MASK 0x2F | ||
| 3473 | #define TPS65917_LDO2_VOLTAGE_VSEL_SHIFT 0x00 | ||
| 3474 | |||
| 3475 | /* Bit definitions for LDO3_CTRL */ | ||
| 3476 | #define TPS65917_LDO3_CTRL_WR_S 0x80 | ||
| 3477 | #define TPS65917_LDO3_CTRL_WR_S_SHIFT 0x07 | ||
| 3478 | #define TPS65917_LDO3_CTRL_STATUS 0x10 | ||
| 3479 | #define TPS65917_LDO3_CTRL_STATUS_SHIFT 0x04 | ||
| 3480 | #define TPS65917_LDO3_CTRL_MODE_SLEEP 0x04 | ||
| 3481 | #define TPS65917_LDO3_CTRL_MODE_SLEEP_SHIFT 0x02 | ||
| 3482 | #define TPS65917_LDO3_CTRL_MODE_ACTIVE 0x01 | ||
| 3483 | #define TPS65917_LDO3_CTRL_MODE_ACTIVE_SHIFT 0x00 | ||
| 3484 | |||
| 3485 | /* Bit definitions for LDO3_VOLTAGE */ | ||
| 3486 | #define TPS65917_LDO3_VOLTAGE_VSEL_MASK 0x2F | ||
| 3487 | #define TPS65917_LDO3_VOLTAGE_VSEL_SHIFT 0x00 | ||
| 3488 | |||
| 3489 | /* Bit definitions for LDO4_CTRL */ | ||
| 3490 | #define TPS65917_LDO4_CTRL_WR_S 0x80 | ||
| 3491 | #define TPS65917_LDO4_CTRL_WR_S_SHIFT 0x07 | ||
| 3492 | #define TPS65917_LDO4_CTRL_STATUS 0x10 | ||
| 3493 | #define TPS65917_LDO4_CTRL_STATUS_SHIFT 0x04 | ||
| 3494 | #define TPS65917_LDO4_CTRL_MODE_SLEEP 0x04 | ||
| 3495 | #define TPS65917_LDO4_CTRL_MODE_SLEEP_SHIFT 0x02 | ||
| 3496 | #define TPS65917_LDO4_CTRL_MODE_ACTIVE 0x01 | ||
| 3497 | #define TPS65917_LDO4_CTRL_MODE_ACTIVE_SHIFT 0x00 | ||
| 3498 | |||
| 3499 | /* Bit definitions for LDO4_VOLTAGE */ | ||
| 3500 | #define TPS65917_LDO4_VOLTAGE_VSEL_MASK 0x2F | ||
| 3501 | #define TPS65917_LDO4_VOLTAGE_VSEL_SHIFT 0x00 | ||
| 3502 | |||
| 3503 | /* Bit definitions for LDO5_CTRL */ | ||
| 3504 | #define TPS65917_LDO5_CTRL_WR_S 0x80 | ||
| 3505 | #define TPS65917_LDO5_CTRL_WR_S_SHIFT 0x07 | ||
| 3506 | #define TPS65917_LDO5_CTRL_STATUS 0x10 | ||
| 3507 | #define TPS65917_LDO5_CTRL_STATUS_SHIFT 0x04 | ||
| 3508 | #define TPS65917_LDO5_CTRL_MODE_SLEEP 0x04 | ||
| 3509 | #define TPS65917_LDO5_CTRL_MODE_SLEEP_SHIFT 0x02 | ||
| 3510 | #define TPS65917_LDO5_CTRL_MODE_ACTIVE 0x01 | ||
| 3511 | #define TPS65917_LDO5_CTRL_MODE_ACTIVE_SHIFT 0x00 | ||
| 3512 | |||
| 3513 | /* Bit definitions for LDO5_VOLTAGE */ | ||
| 3514 | #define TPS65917_LDO5_VOLTAGE_VSEL_MASK 0x2F | ||
| 3515 | #define TPS65917_LDO5_VOLTAGE_VSEL_SHIFT 0x00 | ||
| 3516 | |||
| 3517 | /* Bit definitions for LDO_PD_CTRL1 */ | ||
| 3518 | #define TPS65917_LDO_PD_CTRL1_LDO4 0x80 | ||
| 3519 | #define TPS65917_LDO_PD_CTRL1_LDO4_SHIFT 0x07 | ||
| 3520 | #define TPS65917_LDO_PD_CTRL1_LDO2 0x02 | ||
| 3521 | #define TPS65917_LDO_PD_CTRL1_LDO2_SHIFT 0x01 | ||
| 3522 | #define TPS65917_LDO_PD_CTRL1_LDO1 0x01 | ||
| 3523 | #define TPS65917_LDO_PD_CTRL1_LDO1_SHIFT 0x00 | ||
| 3524 | |||
| 3525 | /* Bit definitions for LDO_PD_CTRL2 */ | ||
| 3526 | #define TPS65917_LDO_PD_CTRL2_LDO3 0x04 | ||
| 3527 | #define TPS65917_LDO_PD_CTRL2_LDO3_SHIFT 0x02 | ||
| 3528 | #define TPS65917_LDO_PD_CTRL2_LDO5 0x02 | ||
| 3529 | #define TPS65917_LDO_PD_CTRL2_LDO5_SHIFT 0x01 | ||
| 3530 | |||
| 3531 | /* Bit definitions for LDO_PD_CTRL3 */ | ||
| 3532 | #define TPS65917_LDO_PD_CTRL2_LDOVANA 0x80 | ||
| 3533 | #define TPS65917_LDO_PD_CTRL2_LDOVANA_SHIFT 0x07 | ||
| 3534 | |||
| 3535 | /* Bit definitions for LDO_SHORT_STATUS1 */ | ||
| 3536 | #define TPS65917_LDO_SHORT_STATUS1_LDO4 0x80 | ||
| 3537 | #define TPS65917_LDO_SHORT_STATUS1_LDO4_SHIFT 0x07 | ||
| 3538 | #define TPS65917_LDO_SHORT_STATUS1_LDO2 0x02 | ||
| 3539 | #define TPS65917_LDO_SHORT_STATUS1_LDO2_SHIFT 0x01 | ||
| 3540 | #define TPS65917_LDO_SHORT_STATUS1_LDO1 0x01 | ||
| 3541 | #define TPS65917_LDO_SHORT_STATUS1_LDO1_SHIFT 0x00 | ||
| 3542 | |||
| 3543 | /* Bit definitions for LDO_SHORT_STATUS2 */ | ||
| 3544 | #define TPS65917_LDO_SHORT_STATUS2_LDO3 0x04 | ||
| 3545 | #define TPS65917_LDO_SHORT_STATUS2_LDO3_SHIFT 0x02 | ||
| 3546 | #define TPS65917_LDO_SHORT_STATUS2_LDO5 0x02 | ||
| 3547 | #define TPS65917_LDO_SHORT_STATUS2_LDO5_SHIFT 0x01 | ||
| 3548 | |||
| 3549 | /* Bit definitions for LDO_SHORT_STATUS2 */ | ||
| 3550 | #define TPS65917_LDO_SHORT_STATUS2_LDOVANA 0x80 | ||
| 3551 | #define TPS65917_LDO_SHORT_STATUS2_LDOVANA_SHIFT 0x07 | ||
| 3552 | |||
| 3553 | /* Bit definitions for REGEN1_CTRL */ | ||
| 3554 | #define TPS65917_REGEN1_CTRL_STATUS 0x10 | ||
| 3555 | #define TPS65917_REGEN1_CTRL_STATUS_SHIFT 0x04 | ||
| 3556 | #define TPS65917_REGEN1_CTRL_MODE_SLEEP 0x04 | ||
| 3557 | #define TPS65917_REGEN1_CTRL_MODE_SLEEP_SHIFT 0x02 | ||
| 3558 | #define TPS65917_REGEN1_CTRL_MODE_ACTIVE 0x01 | ||
| 3559 | #define TPS65917_REGEN1_CTRL_MODE_ACTIVE_SHIFT 0x00 | ||
| 3560 | |||
| 3561 | /* Bit definitions for PLLEN_CTRL */ | ||
| 3562 | #define TPS65917_PLLEN_CTRL_STATUS 0x10 | ||
| 3563 | #define TPS65917_PLLEN_CTRL_STATUS_SHIFT 0x04 | ||
| 3564 | #define TPS65917_PLLEN_CTRL_MODE_SLEEP 0x04 | ||
| 3565 | #define TPS65917_PLLEN_CTRL_MODE_SLEEP_SHIFT 0x02 | ||
| 3566 | #define TPS65917_PLLEN_CTRL_MODE_ACTIVE 0x01 | ||
| 3567 | #define TPS65917_PLLEN_CTRL_MODE_ACTIVE_SHIFT 0x00 | ||
| 3568 | |||
| 3569 | /* Bit definitions for REGEN2_CTRL */ | ||
| 3570 | #define TPS65917_REGEN2_CTRL_STATUS 0x10 | ||
| 3571 | #define TPS65917_REGEN2_CTRL_STATUS_SHIFT 0x04 | ||
| 3572 | #define TPS65917_REGEN2_CTRL_MODE_SLEEP 0x04 | ||
| 3573 | #define TPS65917_REGEN2_CTRL_MODE_SLEEP_SHIFT 0x02 | ||
| 3574 | #define TPS65917_REGEN2_CTRL_MODE_ACTIVE 0x01 | ||
| 3575 | #define TPS65917_REGEN2_CTRL_MODE_ACTIVE_SHIFT 0x00 | ||
| 3576 | |||
| 3577 | /* Bit definitions for NSLEEP_RES_ASSIGN */ | ||
| 3578 | #define TPS65917_NSLEEP_RES_ASSIGN_PLL_EN 0x08 | ||
| 3579 | #define TPS65917_NSLEEP_RES_ASSIGN_PLL_EN_SHIFT 0x03 | ||
| 3580 | #define TPS65917_NSLEEP_RES_ASSIGN_REGEN3 0x04 | ||
| 3581 | #define TPS65917_NSLEEP_RES_ASSIGN_REGEN3_SHIFT 0x02 | ||
| 3582 | #define TPS65917_NSLEEP_RES_ASSIGN_REGEN2 0x02 | ||
| 3583 | #define TPS65917_NSLEEP_RES_ASSIGN_REGEN2_SHIFT 0x01 | ||
| 3584 | #define TPS65917_NSLEEP_RES_ASSIGN_REGEN1 0x01 | ||
| 3585 | #define TPS65917_NSLEEP_RES_ASSIGN_REGEN1_SHIFT 0x00 | ||
| 3586 | |||
| 3587 | /* Bit definitions for NSLEEP_SMPS_ASSIGN */ | ||
| 3588 | #define TPS65917_NSLEEP_SMPS_ASSIGN_SMPS5 0x40 | ||
| 3589 | #define TPS65917_NSLEEP_SMPS_ASSIGN_SMPS5_SHIFT 0x06 | ||
| 3590 | #define TPS65917_NSLEEP_SMPS_ASSIGN_SMPS4 0x10 | ||
| 3591 | #define TPS65917_NSLEEP_SMPS_ASSIGN_SMPS4_SHIFT 0x04 | ||
| 3592 | #define TPS65917_NSLEEP_SMPS_ASSIGN_SMPS3 0x08 | ||
| 3593 | #define TPS65917_NSLEEP_SMPS_ASSIGN_SMPS3_SHIFT 0x03 | ||
| 3594 | #define TPS65917_NSLEEP_SMPS_ASSIGN_SMPS2 0x02 | ||
| 3595 | #define TPS65917_NSLEEP_SMPS_ASSIGN_SMPS2_SHIFT 0x01 | ||
| 3596 | #define TPS65917_NSLEEP_SMPS_ASSIGN_SMPS1 0x01 | ||
| 3597 | #define TPS65917_NSLEEP_SMPS_ASSIGN_SMPS1_SHIFT 0x00 | ||
| 3598 | |||
| 3599 | /* Bit definitions for NSLEEP_LDO_ASSIGN1 */ | ||
| 3600 | #define TPS65917_NSLEEP_LDO_ASSIGN1_LDO4 0x80 | ||
| 3601 | #define TPS65917_NSLEEP_LDO_ASSIGN1_LDO4_SHIFT 0x07 | ||
| 3602 | #define TPS65917_NSLEEP_LDO_ASSIGN1_LDO2 0x02 | ||
| 3603 | #define TPS65917_NSLEEP_LDO_ASSIGN1_LDO2_SHIFT 0x01 | ||
| 3604 | #define TPS65917_NSLEEP_LDO_ASSIGN1_LDO1 0x01 | ||
| 3605 | #define TPS65917_NSLEEP_LDO_ASSIGN1_LDO1_SHIFT 0x00 | ||
| 3606 | |||
| 3607 | /* Bit definitions for NSLEEP_LDO_ASSIGN2 */ | ||
| 3608 | #define TPS65917_NSLEEP_LDO_ASSIGN2_LDO3 0x04 | ||
| 3609 | #define TPS65917_NSLEEP_LDO_ASSIGN2_LDO3_SHIFT 0x02 | ||
| 3610 | #define TPS65917_NSLEEP_LDO_ASSIGN2_LDO5 0x02 | ||
| 3611 | #define TPS65917_NSLEEP_LDO_ASSIGN2_LDO5_SHIFT 0x01 | ||
| 3612 | |||
| 3613 | /* Bit definitions for ENABLE1_RES_ASSIGN */ | ||
| 3614 | #define TPS65917_ENABLE1_RES_ASSIGN_PLLEN 0x08 | ||
| 3615 | #define TPS65917_ENABLE1_RES_ASSIGN_PLLEN_SHIFT 0x03 | ||
| 3616 | #define TPS65917_ENABLE1_RES_ASSIGN_REGEN3 0x04 | ||
| 3617 | #define TPS65917_ENABLE1_RES_ASSIGN_REGEN3_SHIFT 0x02 | ||
| 3618 | #define TPS65917_ENABLE1_RES_ASSIGN_REGEN2 0x02 | ||
| 3619 | #define TPS65917_ENABLE1_RES_ASSIGN_REGEN2_SHIFT 0x01 | ||
| 3620 | #define TPS65917_ENABLE1_RES_ASSIGN_REGEN1 0x01 | ||
| 3621 | #define TPS65917_ENABLE1_RES_ASSIGN_REGEN1_SHIFT 0x00 | ||
| 3622 | |||
| 3623 | /* Bit definitions for ENABLE1_SMPS_ASSIGN */ | ||
| 3624 | #define TPS65917_ENABLE1_SMPS_ASSIGN_SMPS5 0x40 | ||
| 3625 | #define TPS65917_ENABLE1_SMPS_ASSIGN_SMPS5_SHIFT 0x06 | ||
| 3626 | #define TPS65917_ENABLE1_SMPS_ASSIGN_SMPS4 0x10 | ||
| 3627 | #define TPS65917_ENABLE1_SMPS_ASSIGN_SMPS4_SHIFT 0x04 | ||
| 3628 | #define TPS65917_ENABLE1_SMPS_ASSIGN_SMPS3 0x08 | ||
| 3629 | #define TPS65917_ENABLE1_SMPS_ASSIGN_SMPS3_SHIFT 0x03 | ||
| 3630 | #define TPS65917_ENABLE1_SMPS_ASSIGN_SMPS2 0x02 | ||
| 3631 | #define TPS65917_ENABLE1_SMPS_ASSIGN_SMPS2_SHIFT 0x01 | ||
| 3632 | #define TPS65917_ENABLE1_SMPS_ASSIGN_SMPS1 0x01 | ||
| 3633 | #define TPS65917_ENABLE1_SMPS_ASSIGN_SMPS1_SHIFT 0x00 | ||
| 3634 | |||
| 3635 | /* Bit definitions for ENABLE1_LDO_ASSIGN1 */ | ||
| 3636 | #define TPS65917_ENABLE1_LDO_ASSIGN1_LDO4 0x80 | ||
| 3637 | #define TPS65917_ENABLE1_LDO_ASSIGN1_LDO4_SHIFT 0x07 | ||
| 3638 | #define TPS65917_ENABLE1_LDO_ASSIGN1_LDO2 0x02 | ||
| 3639 | #define TPS65917_ENABLE1_LDO_ASSIGN1_LDO2_SHIFT 0x01 | ||
| 3640 | #define TPS65917_ENABLE1_LDO_ASSIGN1_LDO1 0x01 | ||
| 3641 | #define TPS65917_ENABLE1_LDO_ASSIGN1_LDO1_SHIFT 0x00 | ||
| 3642 | |||
| 3643 | /* Bit definitions for ENABLE1_LDO_ASSIGN2 */ | ||
| 3644 | #define TPS65917_ENABLE1_LDO_ASSIGN2_LDO3 0x04 | ||
| 3645 | #define TPS65917_ENABLE1_LDO_ASSIGN2_LDO3_SHIFT 0x02 | ||
| 3646 | #define TPS65917_ENABLE1_LDO_ASSIGN2_LDO5 0x02 | ||
| 3647 | #define TPS65917_ENABLE1_LDO_ASSIGN2_LDO5_SHIFT 0x01 | ||
| 3648 | |||
| 3649 | /* Bit definitions for ENABLE2_RES_ASSIGN */ | ||
| 3650 | #define TPS65917_ENABLE2_RES_ASSIGN_PLLEN 0x08 | ||
| 3651 | #define TPS65917_ENABLE2_RES_ASSIGN_PLLEN_SHIFT 0x03 | ||
| 3652 | #define TPS65917_ENABLE2_RES_ASSIGN_REGEN3 0x04 | ||
| 3653 | #define TPS65917_ENABLE2_RES_ASSIGN_REGEN3_SHIFT 0x02 | ||
| 3654 | #define TPS65917_ENABLE2_RES_ASSIGN_REGEN2 0x02 | ||
| 3655 | #define TPS65917_ENABLE2_RES_ASSIGN_REGEN2_SHIFT 0x01 | ||
| 3656 | #define TPS65917_ENABLE2_RES_ASSIGN_REGEN1 0x01 | ||
| 3657 | #define TPS65917_ENABLE2_RES_ASSIGN_REGEN1_SHIFT 0x00 | ||
| 3658 | |||
| 3659 | /* Bit definitions for ENABLE2_SMPS_ASSIGN */ | ||
| 3660 | #define TPS65917_ENABLE2_SMPS_ASSIGN_SMPS5 0x40 | ||
| 3661 | #define TPS65917_ENABLE2_SMPS_ASSIGN_SMPS5_SHIFT 0x06 | ||
| 3662 | #define TPS65917_ENABLE2_SMPS_ASSIGN_SMPS4 0x10 | ||
| 3663 | #define TPS65917_ENABLE2_SMPS_ASSIGN_SMPS4_SHIFT 0x04 | ||
| 3664 | #define TPS65917_ENABLE2_SMPS_ASSIGN_SMPS3 0x08 | ||
| 3665 | #define TPS65917_ENABLE2_SMPS_ASSIGN_SMPS3_SHIFT 0x03 | ||
| 3666 | #define TPS65917_ENABLE2_SMPS_ASSIGN_SMPS2 0x02 | ||
| 3667 | #define TPS65917_ENABLE2_SMPS_ASSIGN_SMPS2_SHIFT 0x01 | ||
| 3668 | #define TPS65917_ENABLE2_SMPS_ASSIGN_SMPS1 0x01 | ||
| 3669 | #define TPS65917_ENABLE2_SMPS_ASSIGN_SMPS1_SHIFT 0x00 | ||
| 3670 | |||
| 3671 | /* Bit definitions for ENABLE2_LDO_ASSIGN1 */ | ||
| 3672 | #define TPS65917_ENABLE2_LDO_ASSIGN1_LDO4 0x80 | ||
| 3673 | #define TPS65917_ENABLE2_LDO_ASSIGN1_LDO4_SHIFT 0x07 | ||
| 3674 | #define TPS65917_ENABLE2_LDO_ASSIGN1_LDO2 0x02 | ||
| 3675 | #define TPS65917_ENABLE2_LDO_ASSIGN1_LDO2_SHIFT 0x01 | ||
| 3676 | #define TPS65917_ENABLE2_LDO_ASSIGN1_LDO1 0x01 | ||
| 3677 | #define TPS65917_ENABLE2_LDO_ASSIGN1_LDO1_SHIFT 0x00 | ||
| 3678 | |||
| 3679 | /* Bit definitions for ENABLE2_LDO_ASSIGN2 */ | ||
| 3680 | #define TPS65917_ENABLE2_LDO_ASSIGN2_LDO3 0x04 | ||
| 3681 | #define TPS65917_ENABLE2_LDO_ASSIGN2_LDO3_SHIFT 0x02 | ||
| 3682 | #define TPS65917_ENABLE2_LDO_ASSIGN2_LDO5 0x02 | ||
| 3683 | #define TPS65917_ENABLE2_LDO_ASSIGN2_LDO5_SHIFT 0x01 | ||
| 3684 | |||
| 3685 | /* Bit definitions for REGEN3_CTRL */ | ||
| 3686 | #define TPS65917_REGEN3_CTRL_STATUS 0x10 | ||
| 3687 | #define TPS65917_REGEN3_CTRL_STATUS_SHIFT 0x04 | ||
| 3688 | #define TPS65917_REGEN3_CTRL_MODE_SLEEP 0x04 | ||
| 3689 | #define TPS65917_REGEN3_CTRL_MODE_SLEEP_SHIFT 0x02 | ||
| 3690 | #define TPS65917_REGEN3_CTRL_MODE_ACTIVE 0x01 | ||
| 3691 | #define TPS65917_REGEN3_CTRL_MODE_ACTIVE_SHIFT 0x00 | ||
| 3692 | |||
| 3693 | /* Registers for function RESOURCE */ | ||
| 3694 | #define TPS65917_REGEN1_CTRL 0x2 | ||
| 3695 | #define TPS65917_PLLEN_CTRL 0x3 | ||
| 3696 | #define TPS65917_NSLEEP_RES_ASSIGN 0x6 | ||
| 3697 | #define TPS65917_NSLEEP_SMPS_ASSIGN 0x7 | ||
| 3698 | #define TPS65917_NSLEEP_LDO_ASSIGN1 0x8 | ||
| 3699 | #define TPS65917_NSLEEP_LDO_ASSIGN2 0x9 | ||
| 3700 | #define TPS65917_ENABLE1_RES_ASSIGN 0xA | ||
| 3701 | #define TPS65917_ENABLE1_SMPS_ASSIGN 0xB | ||
| 3702 | #define TPS65917_ENABLE1_LDO_ASSIGN1 0xC | ||
| 3703 | #define TPS65917_ENABLE1_LDO_ASSIGN2 0xD | ||
| 3704 | #define TPS65917_ENABLE2_RES_ASSIGN 0xE | ||
| 3705 | #define TPS65917_ENABLE2_SMPS_ASSIGN 0xF | ||
| 3706 | #define TPS65917_ENABLE2_LDO_ASSIGN1 0x10 | ||
| 3707 | #define TPS65917_ENABLE2_LDO_ASSIGN2 0x11 | ||
| 3708 | #define TPS65917_REGEN2_CTRL 0x12 | ||
| 3709 | #define TPS65917_REGEN3_CTRL 0x13 | ||
| 3710 | |||
| 2874 | static inline int palmas_read(struct palmas *palmas, unsigned int base, | 3711 | static inline int palmas_read(struct palmas *palmas, unsigned int base, |
| 2875 | unsigned int reg, unsigned int *val) | 3712 | unsigned int reg, unsigned int *val) |
| 2876 | { | 3713 | { |
diff --git a/include/linux/mic_bus.h b/include/linux/mic_bus.h new file mode 100644 index 000000000000..d5b5f76d57ef --- /dev/null +++ b/include/linux/mic_bus.h | |||
| @@ -0,0 +1,110 @@ | |||
| 1 | /* | ||
| 2 | * Intel MIC Platform Software Stack (MPSS) | ||
| 3 | * | ||
| 4 | * Copyright(c) 2014 Intel Corporation. | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or modify | ||
| 7 | * it under the terms of the GNU General Public License, version 2, as | ||
| 8 | * published by the Free Software Foundation. | ||
| 9 | * | ||
| 10 | * This program is distributed in the hope that it will be useful, but | ||
| 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 13 | * General Public License for more details. | ||
| 14 | * | ||
| 15 | * The full GNU General Public License is included in this distribution in | ||
| 16 | * the file called "COPYING". | ||
| 17 | * | ||
| 18 | * Intel MIC Bus driver. | ||
| 19 | * | ||
| 20 | * This implementation is very similar to the the virtio bus driver | ||
| 21 | * implementation @ include/linux/virtio.h. | ||
| 22 | */ | ||
| 23 | #ifndef _MIC_BUS_H_ | ||
| 24 | #define _MIC_BUS_H_ | ||
| 25 | /* | ||
| 26 | * Everything a mbus driver needs to work with any particular mbus | ||
| 27 | * implementation. | ||
| 28 | */ | ||
| 29 | #include <linux/interrupt.h> | ||
| 30 | #include <linux/dma-mapping.h> | ||
| 31 | |||
| 32 | struct mbus_device_id { | ||
| 33 | __u32 device; | ||
| 34 | __u32 vendor; | ||
| 35 | }; | ||
| 36 | |||
| 37 | #define MBUS_DEV_DMA_HOST 2 | ||
| 38 | #define MBUS_DEV_DMA_MIC 3 | ||
| 39 | #define MBUS_DEV_ANY_ID 0xffffffff | ||
| 40 | |||
| 41 | /** | ||
| 42 | * mbus_device - representation of a device using mbus | ||
| 43 | * @mmio_va: virtual address of mmio space | ||
| 44 | * @hw_ops: the hardware ops supported by this device. | ||
| 45 | * @id: the device type identification (used to match it with a driver). | ||
| 46 | * @dev: underlying device. | ||
| 47 | * be used to communicate with. | ||
| 48 | * @index: unique position on the mbus bus | ||
| 49 | */ | ||
| 50 | struct mbus_device { | ||
| 51 | void __iomem *mmio_va; | ||
| 52 | struct mbus_hw_ops *hw_ops; | ||
| 53 | struct mbus_device_id id; | ||
| 54 | struct device dev; | ||
| 55 | int index; | ||
| 56 | }; | ||
| 57 | |||
| 58 | /** | ||
| 59 | * mbus_driver - operations for a mbus I/O driver | ||
| 60 | * @driver: underlying device driver (populate name and owner). | ||
| 61 | * @id_table: the ids serviced by this driver. | ||
| 62 | * @probe: the function to call when a device is found. Returns 0 or -errno. | ||
| 63 | * @remove: the function to call when a device is removed. | ||
| 64 | */ | ||
| 65 | struct mbus_driver { | ||
| 66 | struct device_driver driver; | ||
| 67 | const struct mbus_device_id *id_table; | ||
| 68 | int (*probe)(struct mbus_device *dev); | ||
| 69 | void (*scan)(struct mbus_device *dev); | ||
| 70 | void (*remove)(struct mbus_device *dev); | ||
| 71 | }; | ||
| 72 | |||
| 73 | /** | ||
| 74 | * struct mic_irq - opaque pointer used as cookie | ||
| 75 | */ | ||
| 76 | struct mic_irq; | ||
| 77 | |||
| 78 | /** | ||
| 79 | * mbus_hw_ops - Hardware operations for accessing a MIC device on the MIC bus. | ||
| 80 | */ | ||
| 81 | struct mbus_hw_ops { | ||
| 82 | struct mic_irq* (*request_threaded_irq)(struct mbus_device *mbdev, | ||
| 83 | irq_handler_t handler, | ||
| 84 | irq_handler_t thread_fn, | ||
| 85 | const char *name, void *data, | ||
| 86 | int intr_src); | ||
| 87 | void (*free_irq)(struct mbus_device *mbdev, | ||
| 88 | struct mic_irq *cookie, void *data); | ||
| 89 | void (*ack_interrupt)(struct mbus_device *mbdev, int num); | ||
| 90 | }; | ||
| 91 | |||
| 92 | struct mbus_device * | ||
| 93 | mbus_register_device(struct device *pdev, int id, struct dma_map_ops *dma_ops, | ||
| 94 | struct mbus_hw_ops *hw_ops, void __iomem *mmio_va); | ||
| 95 | void mbus_unregister_device(struct mbus_device *mbdev); | ||
| 96 | |||
| 97 | int mbus_register_driver(struct mbus_driver *drv); | ||
| 98 | void mbus_unregister_driver(struct mbus_driver *drv); | ||
| 99 | |||
| 100 | static inline struct mbus_device *dev_to_mbus(struct device *_dev) | ||
| 101 | { | ||
| 102 | return container_of(_dev, struct mbus_device, dev); | ||
| 103 | } | ||
| 104 | |||
| 105 | static inline struct mbus_driver *drv_to_mbus(struct device_driver *drv) | ||
| 106 | { | ||
| 107 | return container_of(drv, struct mbus_driver, driver); | ||
| 108 | } | ||
| 109 | |||
| 110 | #endif /* _MIC_BUS_H */ | ||
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h index 35b51e7af886..e15b1544ea83 100644 --- a/include/linux/mlx4/device.h +++ b/include/linux/mlx4/device.h | |||
| @@ -48,6 +48,17 @@ | |||
| 48 | #define MSIX_LEGACY_SZ 4 | 48 | #define MSIX_LEGACY_SZ 4 |
| 49 | #define MIN_MSIX_P_PORT 5 | 49 | #define MIN_MSIX_P_PORT 5 |
| 50 | 50 | ||
| 51 | #define MLX4_NUM_UP 8 | ||
| 52 | #define MLX4_NUM_TC 8 | ||
| 53 | #define MLX4_MAX_100M_UNITS_VAL 255 /* | ||
| 54 | * work around: can't set values | ||
| 55 | * greater then this value when | ||
| 56 | * using 100 Mbps units. | ||
| 57 | */ | ||
| 58 | #define MLX4_RATELIMIT_100M_UNITS 3 /* 100 Mbps */ | ||
| 59 | #define MLX4_RATELIMIT_1G_UNITS 4 /* 1 Gbps */ | ||
| 60 | #define MLX4_RATELIMIT_DEFAULT 0x00ff | ||
| 61 | |||
| 51 | #define MLX4_ROCE_MAX_GIDS 128 | 62 | #define MLX4_ROCE_MAX_GIDS 128 |
| 52 | #define MLX4_ROCE_PF_GIDS 16 | 63 | #define MLX4_ROCE_PF_GIDS 16 |
| 53 | 64 | ||
| @@ -1243,4 +1254,11 @@ int mlx4_vf_smi_enabled(struct mlx4_dev *dev, int slave, int port); | |||
| 1243 | int mlx4_vf_get_enable_smi_admin(struct mlx4_dev *dev, int slave, int port); | 1254 | int mlx4_vf_get_enable_smi_admin(struct mlx4_dev *dev, int slave, int port); |
| 1244 | int mlx4_vf_set_enable_smi_admin(struct mlx4_dev *dev, int slave, int port, | 1255 | int mlx4_vf_set_enable_smi_admin(struct mlx4_dev *dev, int slave, int port, |
| 1245 | int enable); | 1256 | int enable); |
| 1257 | |||
| 1258 | /* Returns true if running in low memory profile (kdump kernel) */ | ||
| 1259 | static inline bool mlx4_low_memory_profile(void) | ||
| 1260 | { | ||
| 1261 | return reset_devices; | ||
| 1262 | } | ||
| 1263 | |||
| 1246 | #endif /* MLX4_DEVICE_H */ | 1264 | #endif /* MLX4_DEVICE_H */ |
diff --git a/include/linux/mlx5/device.h b/include/linux/mlx5/device.h index 3406cfb1267a..334947151dfc 100644 --- a/include/linux/mlx5/device.h +++ b/include/linux/mlx5/device.h | |||
| @@ -456,9 +456,6 @@ struct mlx5_eqe_cq_err { | |||
| 456 | u8 syndrome; | 456 | u8 syndrome; |
| 457 | }; | 457 | }; |
| 458 | 458 | ||
| 459 | struct mlx5_eqe_dropped_packet { | ||
| 460 | }; | ||
| 461 | |||
| 462 | struct mlx5_eqe_port_state { | 459 | struct mlx5_eqe_port_state { |
| 463 | u8 reserved0[8]; | 460 | u8 reserved0[8]; |
| 464 | u8 port; | 461 | u8 port; |
| @@ -498,7 +495,6 @@ union ev_data { | |||
| 498 | struct mlx5_eqe_comp comp; | 495 | struct mlx5_eqe_comp comp; |
| 499 | struct mlx5_eqe_qp_srq qp_srq; | 496 | struct mlx5_eqe_qp_srq qp_srq; |
| 500 | struct mlx5_eqe_cq_err cq_err; | 497 | struct mlx5_eqe_cq_err cq_err; |
| 501 | struct mlx5_eqe_dropped_packet dp; | ||
| 502 | struct mlx5_eqe_port_state port; | 498 | struct mlx5_eqe_port_state port; |
| 503 | struct mlx5_eqe_gpio gpio; | 499 | struct mlx5_eqe_gpio gpio; |
| 504 | struct mlx5_eqe_congestion cong; | 500 | struct mlx5_eqe_congestion cong; |
diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h index 2bce4aad2570..b88e9b46d957 100644 --- a/include/linux/mlx5/driver.h +++ b/include/linux/mlx5/driver.h | |||
| @@ -381,8 +381,8 @@ struct mlx5_buf { | |||
| 381 | struct mlx5_buf_list *page_list; | 381 | struct mlx5_buf_list *page_list; |
| 382 | int nbufs; | 382 | int nbufs; |
| 383 | int npages; | 383 | int npages; |
| 384 | int page_shift; | ||
| 385 | int size; | 384 | int size; |
| 385 | u8 page_shift; | ||
| 386 | }; | 386 | }; |
| 387 | 387 | ||
| 388 | struct mlx5_eq { | 388 | struct mlx5_eq { |
| @@ -543,6 +543,10 @@ struct mlx5_priv { | |||
| 543 | /* protect mkey key part */ | 543 | /* protect mkey key part */ |
| 544 | spinlock_t mkey_lock; | 544 | spinlock_t mkey_lock; |
| 545 | u8 mkey_key; | 545 | u8 mkey_key; |
| 546 | |||
| 547 | struct list_head dev_list; | ||
| 548 | struct list_head ctx_list; | ||
| 549 | spinlock_t ctx_lock; | ||
| 546 | }; | 550 | }; |
| 547 | 551 | ||
| 548 | struct mlx5_core_dev { | 552 | struct mlx5_core_dev { |
| @@ -555,7 +559,7 @@ struct mlx5_core_dev { | |||
| 555 | struct mlx5_init_seg __iomem *iseg; | 559 | struct mlx5_init_seg __iomem *iseg; |
| 556 | void (*event) (struct mlx5_core_dev *dev, | 560 | void (*event) (struct mlx5_core_dev *dev, |
| 557 | enum mlx5_dev_event event, | 561 | enum mlx5_dev_event event, |
| 558 | void *data); | 562 | unsigned long param); |
| 559 | struct mlx5_priv priv; | 563 | struct mlx5_priv priv; |
| 560 | struct mlx5_profile *profile; | 564 | struct mlx5_profile *profile; |
| 561 | atomic_t num_qps; | 565 | atomic_t num_qps; |
| @@ -604,8 +608,8 @@ struct mlx5_cmd_work_ent { | |||
| 604 | int page_queue; | 608 | int page_queue; |
| 605 | u8 status; | 609 | u8 status; |
| 606 | u8 token; | 610 | u8 token; |
| 607 | struct timespec ts1; | 611 | u64 ts1; |
| 608 | struct timespec ts2; | 612 | u64 ts2; |
| 609 | u16 op; | 613 | u16 op; |
| 610 | }; | 614 | }; |
| 611 | 615 | ||
| @@ -686,8 +690,6 @@ static inline u32 mlx5_base_mkey(const u32 key) | |||
| 686 | return key & 0xffffff00u; | 690 | return key & 0xffffff00u; |
| 687 | } | 691 | } |
| 688 | 692 | ||
| 689 | int mlx5_dev_init(struct mlx5_core_dev *dev, struct pci_dev *pdev); | ||
| 690 | void mlx5_dev_cleanup(struct mlx5_core_dev *dev); | ||
| 691 | int mlx5_cmd_init(struct mlx5_core_dev *dev); | 693 | int mlx5_cmd_init(struct mlx5_core_dev *dev); |
| 692 | void mlx5_cmd_cleanup(struct mlx5_core_dev *dev); | 694 | void mlx5_cmd_cleanup(struct mlx5_core_dev *dev); |
| 693 | void mlx5_cmd_use_events(struct mlx5_core_dev *dev); | 695 | void mlx5_cmd_use_events(struct mlx5_core_dev *dev); |
| @@ -734,7 +736,7 @@ int mlx5_core_dump_fill_mkey(struct mlx5_core_dev *dev, struct mlx5_core_mr *mr, | |||
| 734 | int mlx5_core_alloc_pd(struct mlx5_core_dev *dev, u32 *pdn); | 736 | int mlx5_core_alloc_pd(struct mlx5_core_dev *dev, u32 *pdn); |
| 735 | int mlx5_core_dealloc_pd(struct mlx5_core_dev *dev, u32 pdn); | 737 | int mlx5_core_dealloc_pd(struct mlx5_core_dev *dev, u32 pdn); |
| 736 | int mlx5_core_mad_ifc(struct mlx5_core_dev *dev, void *inb, void *outb, | 738 | int mlx5_core_mad_ifc(struct mlx5_core_dev *dev, void *inb, void *outb, |
| 737 | u16 opmod, int port); | 739 | u16 opmod, u8 port); |
| 738 | void mlx5_pagealloc_init(struct mlx5_core_dev *dev); | 740 | void mlx5_pagealloc_init(struct mlx5_core_dev *dev); |
| 739 | void mlx5_pagealloc_cleanup(struct mlx5_core_dev *dev); | 741 | void mlx5_pagealloc_cleanup(struct mlx5_core_dev *dev); |
| 740 | int mlx5_pagealloc_start(struct mlx5_core_dev *dev); | 742 | int mlx5_pagealloc_start(struct mlx5_core_dev *dev); |
| @@ -767,7 +769,7 @@ void mlx5_qp_debugfs_cleanup(struct mlx5_core_dev *dev); | |||
| 767 | int mlx5_core_access_reg(struct mlx5_core_dev *dev, void *data_in, | 769 | int mlx5_core_access_reg(struct mlx5_core_dev *dev, void *data_in, |
| 768 | int size_in, void *data_out, int size_out, | 770 | int size_in, void *data_out, int size_out, |
| 769 | u16 reg_num, int arg, int write); | 771 | u16 reg_num, int arg, int write); |
| 770 | int mlx5_set_port_caps(struct mlx5_core_dev *dev, int port_num, u32 caps); | 772 | int mlx5_set_port_caps(struct mlx5_core_dev *dev, u8 port_num, u32 caps); |
| 771 | 773 | ||
| 772 | int mlx5_debug_eq_add(struct mlx5_core_dev *dev, struct mlx5_eq *eq); | 774 | int mlx5_debug_eq_add(struct mlx5_core_dev *dev, struct mlx5_eq *eq); |
| 773 | void mlx5_debug_eq_remove(struct mlx5_core_dev *dev, struct mlx5_eq *eq); | 775 | void mlx5_debug_eq_remove(struct mlx5_core_dev *dev, struct mlx5_eq *eq); |
| @@ -811,9 +813,20 @@ enum { | |||
| 811 | MAX_MR_CACHE_ENTRIES = 16, | 813 | MAX_MR_CACHE_ENTRIES = 16, |
| 812 | }; | 814 | }; |
| 813 | 815 | ||
| 816 | struct mlx5_interface { | ||
| 817 | void * (*add)(struct mlx5_core_dev *dev); | ||
| 818 | void (*remove)(struct mlx5_core_dev *dev, void *context); | ||
| 819 | void (*event)(struct mlx5_core_dev *dev, void *context, | ||
| 820 | enum mlx5_dev_event event, unsigned long param); | ||
| 821 | struct list_head list; | ||
| 822 | }; | ||
| 823 | |||
| 824 | int mlx5_register_interface(struct mlx5_interface *intf); | ||
| 825 | void mlx5_unregister_interface(struct mlx5_interface *intf); | ||
| 826 | |||
| 814 | struct mlx5_profile { | 827 | struct mlx5_profile { |
| 815 | u64 mask; | 828 | u64 mask; |
| 816 | u32 log_max_qp; | 829 | u8 log_max_qp; |
| 817 | struct { | 830 | struct { |
| 818 | int size; | 831 | int size; |
| 819 | int limit; | 832 | int limit; |
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index 96c5750e3110..796deac19fcf 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h | |||
| @@ -516,4 +516,12 @@ struct vm_special_mapping | |||
| 516 | struct page **pages; | 516 | struct page **pages; |
| 517 | }; | 517 | }; |
| 518 | 518 | ||
| 519 | enum tlb_flush_reason { | ||
| 520 | TLB_FLUSH_ON_TASK_SWITCH, | ||
| 521 | TLB_REMOTE_SHOOTDOWN, | ||
| 522 | TLB_LOCAL_SHOOTDOWN, | ||
| 523 | TLB_LOCAL_MM_SHOOTDOWN, | ||
| 524 | NR_TLB_FLUSH_REASONS, | ||
| 525 | }; | ||
| 526 | |||
| 519 | #endif /* _LINUX_MM_TYPES_H */ | 527 | #endif /* _LINUX_MM_TYPES_H */ |
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h index b1990c5524e1..494f99e852da 100644 --- a/include/linux/moduleparam.h +++ b/include/linux/moduleparam.h | |||
| @@ -381,6 +381,11 @@ extern int param_set_ulong(const char *val, const struct kernel_param *kp); | |||
| 381 | extern int param_get_ulong(char *buffer, const struct kernel_param *kp); | 381 | extern int param_get_ulong(char *buffer, const struct kernel_param *kp); |
| 382 | #define param_check_ulong(name, p) __param_check(name, p, unsigned long) | 382 | #define param_check_ulong(name, p) __param_check(name, p, unsigned long) |
| 383 | 383 | ||
| 384 | extern struct kernel_param_ops param_ops_ullong; | ||
| 385 | extern int param_set_ullong(const char *val, const struct kernel_param *kp); | ||
| 386 | extern int param_get_ullong(char *buffer, const struct kernel_param *kp); | ||
| 387 | #define param_check_ullong(name, p) __param_check(name, p, unsigned long long) | ||
| 388 | |||
| 384 | extern struct kernel_param_ops param_ops_charp; | 389 | extern struct kernel_param_ops param_ops_charp; |
| 385 | extern int param_set_charp(const char *val, const struct kernel_param *kp); | 390 | extern int param_set_charp(const char *val, const struct kernel_param *kp); |
| 386 | extern int param_get_charp(char *buffer, const struct kernel_param *kp); | 391 | extern int param_get_charp(char *buffer, const struct kernel_param *kp); |
diff --git a/include/linux/msi.h b/include/linux/msi.h index 92a2f991262a..8103f32f6d87 100644 --- a/include/linux/msi.h +++ b/include/linux/msi.h | |||
| @@ -25,7 +25,8 @@ void write_msi_msg(unsigned int irq, struct msi_msg *msg); | |||
| 25 | struct msi_desc { | 25 | struct msi_desc { |
| 26 | struct { | 26 | struct { |
| 27 | __u8 is_msix : 1; | 27 | __u8 is_msix : 1; |
| 28 | __u8 multiple: 3; /* log2 number of messages */ | 28 | __u8 multiple: 3; /* log2 num of messages allocated */ |
| 29 | __u8 multi_cap : 3; /* log2 num of messages supported */ | ||
| 29 | __u8 maskbit : 1; /* mask-pending bit supported ? */ | 30 | __u8 maskbit : 1; /* mask-pending bit supported ? */ |
| 30 | __u8 is_64 : 1; /* Address size: 0=32bit 1=64bit */ | 31 | __u8 is_64 : 1; /* Address size: 0=32bit 1=64bit */ |
| 31 | __u8 pos; /* Location of the msi capability */ | 32 | __u8 pos; /* Location of the msi capability */ |
diff --git a/include/linux/mutex.h b/include/linux/mutex.h index 42aa9b9ecd5f..8d5535c58cc2 100644 --- a/include/linux/mutex.h +++ b/include/linux/mutex.h | |||
| @@ -176,8 +176,4 @@ extern void mutex_unlock(struct mutex *lock); | |||
| 176 | 176 | ||
| 177 | extern int atomic_dec_and_mutex_lock(atomic_t *cnt, struct mutex *lock); | 177 | extern int atomic_dec_and_mutex_lock(atomic_t *cnt, struct mutex *lock); |
| 178 | 178 | ||
| 179 | #ifndef arch_mutex_cpu_relax | ||
| 180 | # define arch_mutex_cpu_relax() cpu_relax() | ||
| 181 | #endif | ||
| 182 | |||
| 183 | #endif /* __LINUX_MUTEX_H */ | 179 | #endif /* __LINUX_MUTEX_H */ |
diff --git a/include/linux/netdev_features.h b/include/linux/netdev_features.h index d99800cbdcf3..dcfdecbfa0b7 100644 --- a/include/linux/netdev_features.h +++ b/include/linux/netdev_features.h | |||
| @@ -176,4 +176,12 @@ enum { | |||
| 176 | NETIF_F_HW_VLAN_STAG_RX | \ | 176 | NETIF_F_HW_VLAN_STAG_RX | \ |
| 177 | NETIF_F_HW_VLAN_STAG_TX) | 177 | NETIF_F_HW_VLAN_STAG_TX) |
| 178 | 178 | ||
| 179 | #define NETIF_F_GSO_ENCAP_ALL (NETIF_F_GSO_GRE | \ | ||
| 180 | NETIF_F_GSO_GRE_CSUM | \ | ||
| 181 | NETIF_F_GSO_IPIP | \ | ||
| 182 | NETIF_F_GSO_SIT | \ | ||
| 183 | NETIF_F_GSO_UDP_TUNNEL | \ | ||
| 184 | NETIF_F_GSO_UDP_TUNNEL_CSUM | \ | ||
| 185 | NETIF_F_GSO_MPLS) | ||
| 186 | |||
| 179 | #endif /* _LINUX_NETDEV_FEATURES_H */ | 187 | #endif /* _LINUX_NETDEV_FEATURES_H */ |
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 66f9a04ec270..38377392d082 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
| @@ -943,7 +943,8 @@ typedef u16 (*select_queue_fallback_t)(struct net_device *dev, | |||
| 943 | * const unsigned char *addr) | 943 | * const unsigned char *addr) |
| 944 | * Deletes the FDB entry from dev coresponding to addr. | 944 | * Deletes the FDB entry from dev coresponding to addr. |
| 945 | * int (*ndo_fdb_dump)(struct sk_buff *skb, struct netlink_callback *cb, | 945 | * int (*ndo_fdb_dump)(struct sk_buff *skb, struct netlink_callback *cb, |
| 946 | * struct net_device *dev, int idx) | 946 | * struct net_device *dev, struct net_device *filter_dev, |
| 947 | * int idx) | ||
| 947 | * Used to add FDB entries to dump requests. Implementers should add | 948 | * Used to add FDB entries to dump requests. Implementers should add |
| 948 | * entries to skb and update idx with the number of entries. | 949 | * entries to skb and update idx with the number of entries. |
| 949 | * | 950 | * |
| @@ -1114,6 +1115,7 @@ struct net_device_ops { | |||
| 1114 | int (*ndo_fdb_dump)(struct sk_buff *skb, | 1115 | int (*ndo_fdb_dump)(struct sk_buff *skb, |
| 1115 | struct netlink_callback *cb, | 1116 | struct netlink_callback *cb, |
| 1116 | struct net_device *dev, | 1117 | struct net_device *dev, |
| 1118 | struct net_device *filter_dev, | ||
| 1117 | int idx); | 1119 | int idx); |
| 1118 | 1120 | ||
| 1119 | int (*ndo_bridge_setlink)(struct net_device *dev, | 1121 | int (*ndo_bridge_setlink)(struct net_device *dev, |
| @@ -1229,42 +1231,228 @@ enum netdev_priv_flags { | |||
| 1229 | #define IFF_LIVE_ADDR_CHANGE IFF_LIVE_ADDR_CHANGE | 1231 | #define IFF_LIVE_ADDR_CHANGE IFF_LIVE_ADDR_CHANGE |
| 1230 | #define IFF_MACVLAN IFF_MACVLAN | 1232 | #define IFF_MACVLAN IFF_MACVLAN |
| 1231 | 1233 | ||
| 1232 | /* | 1234 | /** |
| 1233 | * The DEVICE structure. | 1235 | * struct net_device - The DEVICE structure. |
| 1234 | * Actually, this whole structure is a big mistake. It mixes I/O | 1236 | * Actually, this whole structure is a big mistake. It mixes I/O |
| 1235 | * data with strictly "high-level" data, and it has to know about | 1237 | * data with strictly "high-level" data, and it has to know about |
| 1236 | * almost every data structure used in the INET module. | 1238 | * almost every data structure used in the INET module. |
| 1239 | * | ||
| 1240 | * @name: This is the first field of the "visible" part of this structure | ||
| 1241 | * (i.e. as seen by users in the "Space.c" file). It is the name | ||
| 1242 | * of the interface. | ||
| 1243 | * | ||
| 1244 | * @name_hlist: Device name hash chain, please keep it close to name[] | ||
| 1245 | * @ifalias: SNMP alias | ||
| 1246 | * @mem_end: Shared memory end | ||
| 1247 | * @mem_start: Shared memory start | ||
| 1248 | * @base_addr: Device I/O address | ||
| 1249 | * @irq: Device IRQ number | ||
| 1250 | * | ||
| 1251 | * @state: Generic network queuing layer state, see netdev_state_t | ||
| 1252 | * @dev_list: The global list of network devices | ||
| 1253 | * @napi_list: List entry, that is used for polling napi devices | ||
| 1254 | * @unreg_list: List entry, that is used, when we are unregistering the | ||
| 1255 | * device, see the function unregister_netdev | ||
| 1256 | * @close_list: List entry, that is used, when we are closing the device | ||
| 1257 | * | ||
| 1258 | * @adj_list: Directly linked devices, like slaves for bonding | ||
| 1259 | * @all_adj_list: All linked devices, *including* neighbours | ||
| 1260 | * @features: Currently active device features | ||
| 1261 | * @hw_features: User-changeable features | ||
| 1262 | * | ||
| 1263 | * @wanted_features: User-requested features | ||
| 1264 | * @vlan_features: Mask of features inheritable by VLAN devices | ||
| 1265 | * | ||
| 1266 | * @hw_enc_features: Mask of features inherited by encapsulating devices | ||
| 1267 | * This field indicates what encapsulation | ||
| 1268 | * offloads the hardware is capable of doing, | ||
| 1269 | * and drivers will need to set them appropriately. | ||
| 1270 | * | ||
| 1271 | * @mpls_features: Mask of features inheritable by MPLS | ||
| 1272 | * | ||
| 1273 | * @ifindex: interface index | ||
| 1274 | * @iflink: unique device identifier | ||
| 1275 | * | ||
| 1276 | * @stats: Statistics struct, which was left as a legacy, use | ||
| 1277 | * rtnl_link_stats64 instead | ||
| 1278 | * | ||
| 1279 | * @rx_dropped: Dropped packets by core network, | ||
| 1280 | * do not use this in drivers | ||
| 1281 | * @tx_dropped: Dropped packets by core network, | ||
| 1282 | * do not use this in drivers | ||
| 1283 | * | ||
| 1284 | * @carrier_changes: Stats to monitor carrier on<->off transitions | ||
| 1285 | * | ||
| 1286 | * @wireless_handlers: List of functions to handle Wireless Extensions, | ||
| 1287 | * instead of ioctl, | ||
| 1288 | * see <net/iw_handler.h> for details. | ||
| 1289 | * @wireless_data: Instance data managed by the core of wireless extensions | ||
| 1290 | * | ||
| 1291 | * @netdev_ops: Includes several pointers to callbacks, | ||
| 1292 | * if one wants to override the ndo_*() functions | ||
| 1293 | * @ethtool_ops: Management operations | ||
| 1294 | * @fwd_ops: Management operations | ||
| 1295 | * @header_ops: Includes callbacks for creating,parsing,rebuilding,etc | ||
| 1296 | * of Layer 2 headers. | ||
| 1297 | * | ||
| 1298 | * @flags: Interface flags (a la BSD) | ||
| 1299 | * @priv_flags: Like 'flags' but invisible to userspace, | ||
| 1300 | * see if.h for the definitions | ||
| 1301 | * @gflags: Global flags ( kept as legacy ) | ||
| 1302 | * @padded: How much padding added by alloc_netdev() | ||
| 1303 | * @operstate: RFC2863 operstate | ||
| 1304 | * @link_mode: Mapping policy to operstate | ||
| 1305 | * @if_port: Selectable AUI, TP, ... | ||
| 1306 | * @dma: DMA channel | ||
| 1307 | * @mtu: Interface MTU value | ||
| 1308 | * @type: Interface hardware type | ||
| 1309 | * @hard_header_len: Hardware header length | ||
| 1310 | * | ||
| 1311 | * @needed_headroom: Extra headroom the hardware may need, but not in all | ||
| 1312 | * cases can this be guaranteed | ||
| 1313 | * @needed_tailroom: Extra tailroom the hardware may need, but not in all | ||
| 1314 | * cases can this be guaranteed. Some cases also use | ||
| 1315 | * LL_MAX_HEADER instead to allocate the skb | ||
| 1316 | * | ||
| 1317 | * interface address info: | ||
| 1318 | * | ||
| 1319 | * @perm_addr: Permanent hw address | ||
| 1320 | * @addr_assign_type: Hw address assignment type | ||
| 1321 | * @addr_len: Hardware address length | ||
| 1322 | * @neigh_priv_len; Used in neigh_alloc(), | ||
| 1323 | * initialized only in atm/clip.c | ||
| 1324 | * @dev_id: Used to differentiate devices that share | ||
| 1325 | * the same link layer address | ||
| 1326 | * @dev_port: Used to differentiate devices that share | ||
| 1327 | * the same function | ||
| 1328 | * @addr_list_lock: XXX: need comments on this one | ||
| 1329 | * @uc: unicast mac addresses | ||
| 1330 | * @mc: multicast mac addresses | ||
| 1331 | * @dev_addrs: list of device hw addresses | ||
| 1332 | * @queues_kset: Group of all Kobjects in the Tx and RX queues | ||
| 1333 | * @uc_promisc: Counter, that indicates, that promiscuous mode | ||
| 1334 | * has been enabled due to the need to listen to | ||
| 1335 | * additional unicast addresses in a device that | ||
| 1336 | * does not implement ndo_set_rx_mode() | ||
| 1337 | * @promiscuity: Number of times, the NIC is told to work in | ||
| 1338 | * Promiscuous mode, if it becomes 0 the NIC will | ||
| 1339 | * exit from working in Promiscuous mode | ||
| 1340 | * @allmulti: Counter, enables or disables allmulticast mode | ||
| 1341 | * | ||
| 1342 | * @vlan_info: VLAN info | ||
| 1343 | * @dsa_ptr: dsa specific data | ||
| 1344 | * @tipc_ptr: TIPC specific data | ||
| 1345 | * @atalk_ptr: AppleTalk link | ||
| 1346 | * @ip_ptr: IPv4 specific data | ||
| 1347 | * @dn_ptr: DECnet specific data | ||
| 1348 | * @ip6_ptr: IPv6 specific data | ||
| 1349 | * @ax25_ptr: AX.25 specific data | ||
| 1350 | * @ieee80211_ptr: IEEE 802.11 specific data, assign before registering | ||
| 1351 | * | ||
| 1352 | * @last_rx: Time of last Rx | ||
| 1353 | * @dev_addr: Hw address (before bcast, | ||
| 1354 | * because most packets are unicast) | ||
| 1355 | * | ||
| 1356 | * @_rx: Array of RX queues | ||
| 1357 | * @num_rx_queues: Number of RX queues | ||
| 1358 | * allocated at register_netdev() time | ||
| 1359 | * @real_num_rx_queues: Number of RX queues currently active in device | ||
| 1360 | * | ||
| 1361 | * @rx_handler: handler for received packets | ||
| 1362 | * @rx_handler_data: XXX: need comments on this one | ||
| 1363 | * @ingress_queue: XXX: need comments on this one | ||
| 1364 | * @broadcast: hw bcast address | ||
| 1365 | * | ||
| 1366 | * @_tx: Array of TX queues | ||
| 1367 | * @num_tx_queues: Number of TX queues allocated at alloc_netdev_mq() time | ||
| 1368 | * @real_num_tx_queues: Number of TX queues currently active in device | ||
| 1369 | * @qdisc: Root qdisc from userspace point of view | ||
| 1370 | * @tx_queue_len: Max frames per queue allowed | ||
| 1371 | * @tx_global_lock: XXX: need comments on this one | ||
| 1372 | * | ||
| 1373 | * @xps_maps: XXX: need comments on this one | ||
| 1374 | * | ||
| 1375 | * @rx_cpu_rmap: CPU reverse-mapping for RX completion interrupts, | ||
| 1376 | * indexed by RX queue number. Assigned by driver. | ||
| 1377 | * This must only be set if the ndo_rx_flow_steer | ||
| 1378 | * operation is defined | ||
| 1379 | * | ||
| 1380 | * @trans_start: Time (in jiffies) of last Tx | ||
| 1381 | * @watchdog_timeo: Represents the timeout that is used by | ||
| 1382 | * the watchdog ( see dev_watchdog() ) | ||
| 1383 | * @watchdog_timer: List of timers | ||
| 1384 | * | ||
| 1385 | * @pcpu_refcnt: Number of references to this device | ||
| 1386 | * @todo_list: Delayed register/unregister | ||
| 1387 | * @index_hlist: Device index hash chain | ||
| 1388 | * @link_watch_list: XXX: need comments on this one | ||
| 1389 | * | ||
| 1390 | * @reg_state: Register/unregister state machine | ||
| 1391 | * @dismantle: Device is going to be freed | ||
| 1392 | * @rtnl_link_state: This enum represents the phases of creating | ||
| 1393 | * a new link | ||
| 1394 | * | ||
| 1395 | * @destructor: Called from unregister, | ||
| 1396 | * can be used to call free_netdev | ||
| 1397 | * @npinfo: XXX: need comments on this one | ||
| 1398 | * @nd_net: Network namespace this network device is inside | ||
| 1399 | * | ||
| 1400 | * @ml_priv: Mid-layer private | ||
| 1401 | * @lstats: Loopback statistics | ||
| 1402 | * @tstats: Tunnel statistics | ||
| 1403 | * @dstats: Dummy statistics | ||
| 1404 | * @vstats: Virtual ethernet statistics | ||
| 1405 | * | ||
| 1406 | * @garp_port: GARP | ||
| 1407 | * @mrp_port: MRP | ||
| 1408 | * | ||
| 1409 | * @dev: Class/net/name entry | ||
| 1410 | * @sysfs_groups: Space for optional device, statistics and wireless | ||
| 1411 | * sysfs groups | ||
| 1412 | * | ||
| 1413 | * @sysfs_rx_queue_group: Space for optional per-rx queue attributes | ||
| 1414 | * @rtnl_link_ops: Rtnl_link_ops | ||
| 1415 | * | ||
| 1416 | * @gso_max_size: Maximum size of generic segmentation offload | ||
| 1417 | * @gso_max_segs: Maximum number of segments that can be passed to the | ||
| 1418 | * NIC for GSO | ||
| 1419 | * | ||
| 1420 | * @dcbnl_ops: Data Center Bridging netlink ops | ||
| 1421 | * @num_tc: Number of traffic classes in the net device | ||
| 1422 | * @tc_to_txq: XXX: need comments on this one | ||
| 1423 | * @prio_tc_map XXX: need comments on this one | ||
| 1424 | * | ||
| 1425 | * @fcoe_ddp_xid: Max exchange id for FCoE LRO by ddp | ||
| 1426 | * | ||
| 1427 | * @priomap: XXX: need comments on this one | ||
| 1428 | * @phydev: Physical device may attach itself | ||
| 1429 | * for hardware timestamping | ||
| 1430 | * | ||
| 1431 | * @qdisc_tx_busylock: XXX: need comments on this one | ||
| 1432 | * | ||
| 1433 | * @group: The group, that the device belongs to | ||
| 1434 | * @pm_qos_req: Power Management QoS object | ||
| 1237 | * | 1435 | * |
| 1238 | * FIXME: cleanup struct net_device such that network protocol info | 1436 | * FIXME: cleanup struct net_device such that network protocol info |
| 1239 | * moves out. | 1437 | * moves out. |
| 1240 | */ | 1438 | */ |
| 1241 | 1439 | ||
| 1242 | struct net_device { | 1440 | struct net_device { |
| 1243 | |||
| 1244 | /* | ||
| 1245 | * This is the first field of the "visible" part of this structure | ||
| 1246 | * (i.e. as seen by users in the "Space.c" file). It is the name | ||
| 1247 | * of the interface. | ||
| 1248 | */ | ||
| 1249 | char name[IFNAMSIZ]; | 1441 | char name[IFNAMSIZ]; |
| 1250 | |||
| 1251 | /* device name hash chain, please keep it close to name[] */ | ||
| 1252 | struct hlist_node name_hlist; | 1442 | struct hlist_node name_hlist; |
| 1253 | |||
| 1254 | /* snmp alias */ | ||
| 1255 | char *ifalias; | 1443 | char *ifalias; |
| 1256 | |||
| 1257 | /* | 1444 | /* |
| 1258 | * I/O specific fields | 1445 | * I/O specific fields |
| 1259 | * FIXME: Merge these and struct ifmap into one | 1446 | * FIXME: Merge these and struct ifmap into one |
| 1260 | */ | 1447 | */ |
| 1261 | unsigned long mem_end; /* shared mem end */ | 1448 | unsigned long mem_end; |
| 1262 | unsigned long mem_start; /* shared mem start */ | 1449 | unsigned long mem_start; |
| 1263 | unsigned long base_addr; /* device I/O address */ | 1450 | unsigned long base_addr; |
| 1264 | int irq; /* device IRQ number */ | 1451 | int irq; |
| 1265 | 1452 | ||
| 1266 | /* | 1453 | /* |
| 1267 | * Some hardware also needs these fields, but they are not | 1454 | * Some hardware also needs these fields (state,dev_list, |
| 1455 | * napi_list,unreg_list,close_list) but they are not | ||
| 1268 | * part of the usual set specified in Space.c. | 1456 | * part of the usual set specified in Space.c. |
| 1269 | */ | 1457 | */ |
| 1270 | 1458 | ||
| @@ -1275,110 +1463,80 @@ struct net_device { | |||
| 1275 | struct list_head unreg_list; | 1463 | struct list_head unreg_list; |
| 1276 | struct list_head close_list; | 1464 | struct list_head close_list; |
| 1277 | 1465 | ||
| 1278 | /* directly linked devices, like slaves for bonding */ | ||
| 1279 | struct { | 1466 | struct { |
| 1280 | struct list_head upper; | 1467 | struct list_head upper; |
| 1281 | struct list_head lower; | 1468 | struct list_head lower; |
| 1282 | } adj_list; | 1469 | } adj_list; |
| 1283 | 1470 | ||
| 1284 | /* all linked devices, *including* neighbours */ | ||
| 1285 | struct { | 1471 | struct { |
| 1286 | struct list_head upper; | 1472 | struct list_head upper; |
| 1287 | struct list_head lower; | 1473 | struct list_head lower; |
| 1288 | } all_adj_list; | 1474 | } all_adj_list; |
| 1289 | 1475 | ||
| 1290 | |||
| 1291 | /* currently active device features */ | ||
| 1292 | netdev_features_t features; | 1476 | netdev_features_t features; |
| 1293 | /* user-changeable features */ | ||
| 1294 | netdev_features_t hw_features; | 1477 | netdev_features_t hw_features; |
| 1295 | /* user-requested features */ | ||
| 1296 | netdev_features_t wanted_features; | 1478 | netdev_features_t wanted_features; |
| 1297 | /* mask of features inheritable by VLAN devices */ | ||
| 1298 | netdev_features_t vlan_features; | 1479 | netdev_features_t vlan_features; |
| 1299 | /* mask of features inherited by encapsulating devices | ||
| 1300 | * This field indicates what encapsulation offloads | ||
| 1301 | * the hardware is capable of doing, and drivers will | ||
| 1302 | * need to set them appropriately. | ||
| 1303 | */ | ||
| 1304 | netdev_features_t hw_enc_features; | 1480 | netdev_features_t hw_enc_features; |
| 1305 | /* mask of fetures inheritable by MPLS */ | ||
| 1306 | netdev_features_t mpls_features; | 1481 | netdev_features_t mpls_features; |
| 1307 | 1482 | ||
| 1308 | /* Interface index. Unique device identifier */ | ||
| 1309 | int ifindex; | 1483 | int ifindex; |
| 1310 | int iflink; | 1484 | int iflink; |
| 1311 | 1485 | ||
| 1312 | struct net_device_stats stats; | 1486 | struct net_device_stats stats; |
| 1313 | 1487 | ||
| 1314 | /* dropped packets by core network, Do not use this in drivers */ | ||
| 1315 | atomic_long_t rx_dropped; | 1488 | atomic_long_t rx_dropped; |
| 1316 | atomic_long_t tx_dropped; | 1489 | atomic_long_t tx_dropped; |
| 1317 | 1490 | ||
| 1318 | /* Stats to monitor carrier on<->off transitions */ | ||
| 1319 | atomic_t carrier_changes; | 1491 | atomic_t carrier_changes; |
| 1320 | 1492 | ||
| 1321 | #ifdef CONFIG_WIRELESS_EXT | 1493 | #ifdef CONFIG_WIRELESS_EXT |
| 1322 | /* List of functions to handle Wireless Extensions (instead of ioctl). | ||
| 1323 | * See <net/iw_handler.h> for details. Jean II */ | ||
| 1324 | const struct iw_handler_def * wireless_handlers; | 1494 | const struct iw_handler_def * wireless_handlers; |
| 1325 | /* Instance data managed by the core of Wireless Extensions. */ | ||
| 1326 | struct iw_public_data * wireless_data; | 1495 | struct iw_public_data * wireless_data; |
| 1327 | #endif | 1496 | #endif |
| 1328 | /* Management operations */ | ||
| 1329 | const struct net_device_ops *netdev_ops; | 1497 | const struct net_device_ops *netdev_ops; |
| 1330 | const struct ethtool_ops *ethtool_ops; | 1498 | const struct ethtool_ops *ethtool_ops; |
| 1331 | const struct forwarding_accel_ops *fwd_ops; | 1499 | const struct forwarding_accel_ops *fwd_ops; |
| 1332 | 1500 | ||
| 1333 | /* Hardware header description */ | ||
| 1334 | const struct header_ops *header_ops; | 1501 | const struct header_ops *header_ops; |
| 1335 | 1502 | ||
| 1336 | unsigned int flags; /* interface flags (a la BSD) */ | 1503 | unsigned int flags; |
| 1337 | unsigned int priv_flags; /* Like 'flags' but invisible to userspace. | 1504 | unsigned int priv_flags; |
| 1338 | * See if.h for definitions. */ | 1505 | |
| 1339 | unsigned short gflags; | 1506 | unsigned short gflags; |
| 1340 | unsigned short padded; /* How much padding added by alloc_netdev() */ | 1507 | unsigned short padded; |
| 1341 | 1508 | ||
| 1342 | unsigned char operstate; /* RFC2863 operstate */ | 1509 | unsigned char operstate; |
| 1343 | unsigned char link_mode; /* mapping policy to operstate */ | 1510 | unsigned char link_mode; |
| 1344 | 1511 | ||
| 1345 | unsigned char if_port; /* Selectable AUI, TP,..*/ | 1512 | unsigned char if_port; |
| 1346 | unsigned char dma; /* DMA channel */ | 1513 | unsigned char dma; |
| 1347 | 1514 | ||
| 1348 | unsigned int mtu; /* interface MTU value */ | 1515 | unsigned int mtu; |
| 1349 | unsigned short type; /* interface hardware type */ | 1516 | unsigned short type; |
| 1350 | unsigned short hard_header_len; /* hardware hdr length */ | 1517 | unsigned short hard_header_len; |
| 1351 | 1518 | ||
| 1352 | /* extra head- and tailroom the hardware may need, but not in all cases | ||
| 1353 | * can this be guaranteed, especially tailroom. Some cases also use | ||
| 1354 | * LL_MAX_HEADER instead to allocate the skb. | ||
| 1355 | */ | ||
| 1356 | unsigned short needed_headroom; | 1519 | unsigned short needed_headroom; |
| 1357 | unsigned short needed_tailroom; | 1520 | unsigned short needed_tailroom; |
| 1358 | 1521 | ||
| 1359 | /* Interface address info. */ | 1522 | /* Interface address info. */ |
| 1360 | unsigned char perm_addr[MAX_ADDR_LEN]; /* permanent hw address */ | 1523 | unsigned char perm_addr[MAX_ADDR_LEN]; |
| 1361 | unsigned char addr_assign_type; /* hw address assignment type */ | 1524 | unsigned char addr_assign_type; |
| 1362 | unsigned char addr_len; /* hardware address length */ | 1525 | unsigned char addr_len; |
| 1363 | unsigned short neigh_priv_len; | 1526 | unsigned short neigh_priv_len; |
| 1364 | unsigned short dev_id; /* Used to differentiate devices | 1527 | unsigned short dev_id; |
| 1365 | * that share the same link | 1528 | unsigned short dev_port; |
| 1366 | * layer address | ||
| 1367 | */ | ||
| 1368 | unsigned short dev_port; /* Used to differentiate | ||
| 1369 | * devices that share the same | ||
| 1370 | * function | ||
| 1371 | */ | ||
| 1372 | spinlock_t addr_list_lock; | 1529 | spinlock_t addr_list_lock; |
| 1373 | struct netdev_hw_addr_list uc; /* Unicast mac addresses */ | 1530 | struct netdev_hw_addr_list uc; |
| 1374 | struct netdev_hw_addr_list mc; /* Multicast mac addresses */ | 1531 | struct netdev_hw_addr_list mc; |
| 1375 | struct netdev_hw_addr_list dev_addrs; /* list of device | 1532 | struct netdev_hw_addr_list dev_addrs; |
| 1376 | * hw addresses | 1533 | |
| 1377 | */ | ||
| 1378 | #ifdef CONFIG_SYSFS | 1534 | #ifdef CONFIG_SYSFS |
| 1379 | struct kset *queues_kset; | 1535 | struct kset *queues_kset; |
| 1380 | #endif | 1536 | #endif |
| 1381 | 1537 | ||
| 1538 | unsigned char name_assign_type; | ||
| 1539 | |||
| 1382 | bool uc_promisc; | 1540 | bool uc_promisc; |
| 1383 | unsigned int promiscuity; | 1541 | unsigned int promiscuity; |
| 1384 | unsigned int allmulti; | 1542 | unsigned int allmulti; |
| @@ -1387,40 +1545,34 @@ struct net_device { | |||
| 1387 | /* Protocol specific pointers */ | 1545 | /* Protocol specific pointers */ |
| 1388 | 1546 | ||
| 1389 | #if IS_ENABLED(CONFIG_VLAN_8021Q) | 1547 | #if IS_ENABLED(CONFIG_VLAN_8021Q) |
| 1390 | struct vlan_info __rcu *vlan_info; /* VLAN info */ | 1548 | struct vlan_info __rcu *vlan_info; |
| 1391 | #endif | 1549 | #endif |
| 1392 | #if IS_ENABLED(CONFIG_NET_DSA) | 1550 | #if IS_ENABLED(CONFIG_NET_DSA) |
| 1393 | struct dsa_switch_tree *dsa_ptr; /* dsa specific data */ | 1551 | struct dsa_switch_tree *dsa_ptr; |
| 1394 | #endif | 1552 | #endif |
| 1395 | #if IS_ENABLED(CONFIG_TIPC) | 1553 | #if IS_ENABLED(CONFIG_TIPC) |
| 1396 | struct tipc_bearer __rcu *tipc_ptr; /* TIPC specific data */ | 1554 | struct tipc_bearer __rcu *tipc_ptr; |
| 1397 | #endif | 1555 | #endif |
| 1398 | void *atalk_ptr; /* AppleTalk link */ | 1556 | void *atalk_ptr; |
| 1399 | struct in_device __rcu *ip_ptr; /* IPv4 specific data */ | 1557 | struct in_device __rcu *ip_ptr; |
| 1400 | struct dn_dev __rcu *dn_ptr; /* DECnet specific data */ | 1558 | struct dn_dev __rcu *dn_ptr; |
| 1401 | struct inet6_dev __rcu *ip6_ptr; /* IPv6 specific data */ | 1559 | struct inet6_dev __rcu *ip6_ptr; |
| 1402 | void *ax25_ptr; /* AX.25 specific data */ | 1560 | void *ax25_ptr; |
| 1403 | struct wireless_dev *ieee80211_ptr; /* IEEE 802.11 specific data, | 1561 | struct wireless_dev *ieee80211_ptr; |
| 1404 | assign before registering */ | ||
| 1405 | 1562 | ||
| 1406 | /* | 1563 | /* |
| 1407 | * Cache lines mostly used on receive path (including eth_type_trans()) | 1564 | * Cache lines mostly used on receive path (including eth_type_trans()) |
| 1408 | */ | 1565 | */ |
| 1409 | unsigned long last_rx; /* Time of last Rx */ | 1566 | unsigned long last_rx; |
| 1410 | 1567 | ||
| 1411 | /* Interface address info used in eth_type_trans() */ | 1568 | /* Interface address info used in eth_type_trans() */ |
| 1412 | unsigned char *dev_addr; /* hw address, (before bcast | 1569 | unsigned char *dev_addr; |
| 1413 | because most packets are | ||
| 1414 | unicast) */ | ||
| 1415 | 1570 | ||
| 1416 | 1571 | ||
| 1417 | #ifdef CONFIG_SYSFS | 1572 | #ifdef CONFIG_SYSFS |
| 1418 | struct netdev_rx_queue *_rx; | 1573 | struct netdev_rx_queue *_rx; |
| 1419 | 1574 | ||
| 1420 | /* Number of RX queues allocated at register_netdev() time */ | ||
| 1421 | unsigned int num_rx_queues; | 1575 | unsigned int num_rx_queues; |
| 1422 | |||
| 1423 | /* Number of RX queues currently active in device */ | ||
| 1424 | unsigned int real_num_rx_queues; | 1576 | unsigned int real_num_rx_queues; |
| 1425 | 1577 | ||
| 1426 | #endif | 1578 | #endif |
| @@ -1429,33 +1581,23 @@ struct net_device { | |||
| 1429 | void __rcu *rx_handler_data; | 1581 | void __rcu *rx_handler_data; |
| 1430 | 1582 | ||
| 1431 | struct netdev_queue __rcu *ingress_queue; | 1583 | struct netdev_queue __rcu *ingress_queue; |
| 1432 | unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */ | 1584 | unsigned char broadcast[MAX_ADDR_LEN]; |
| 1433 | 1585 | ||
| 1434 | 1586 | ||
| 1435 | /* | 1587 | /* |
| 1436 | * Cache lines mostly used on transmit path | 1588 | * Cache lines mostly used on transmit path |
| 1437 | */ | 1589 | */ |
| 1438 | struct netdev_queue *_tx ____cacheline_aligned_in_smp; | 1590 | struct netdev_queue *_tx ____cacheline_aligned_in_smp; |
| 1439 | |||
| 1440 | /* Number of TX queues allocated at alloc_netdev_mq() time */ | ||
| 1441 | unsigned int num_tx_queues; | 1591 | unsigned int num_tx_queues; |
| 1442 | |||
| 1443 | /* Number of TX queues currently active in device */ | ||
| 1444 | unsigned int real_num_tx_queues; | 1592 | unsigned int real_num_tx_queues; |
| 1445 | |||
| 1446 | /* root qdisc from userspace point of view */ | ||
| 1447 | struct Qdisc *qdisc; | 1593 | struct Qdisc *qdisc; |
| 1448 | 1594 | unsigned long tx_queue_len; | |
| 1449 | unsigned long tx_queue_len; /* Max frames per queue allowed */ | ||
| 1450 | spinlock_t tx_global_lock; | 1595 | spinlock_t tx_global_lock; |
| 1451 | 1596 | ||
| 1452 | #ifdef CONFIG_XPS | 1597 | #ifdef CONFIG_XPS |
| 1453 | struct xps_dev_maps __rcu *xps_maps; | 1598 | struct xps_dev_maps __rcu *xps_maps; |
| 1454 | #endif | 1599 | #endif |
| 1455 | #ifdef CONFIG_RFS_ACCEL | 1600 | #ifdef CONFIG_RFS_ACCEL |
| 1456 | /* CPU reverse-mapping for RX completion interrupts, indexed | ||
| 1457 | * by RX queue number. Assigned by driver. This must only be | ||
| 1458 | * set if the ndo_rx_flow_steer operation is defined. */ | ||
| 1459 | struct cpu_rmap *rx_cpu_rmap; | 1601 | struct cpu_rmap *rx_cpu_rmap; |
| 1460 | #endif | 1602 | #endif |
| 1461 | 1603 | ||
| @@ -1465,22 +1607,17 @@ struct net_device { | |||
| 1465 | * trans_start here is expensive for high speed devices on SMP, | 1607 | * trans_start here is expensive for high speed devices on SMP, |
| 1466 | * please use netdev_queue->trans_start instead. | 1608 | * please use netdev_queue->trans_start instead. |
| 1467 | */ | 1609 | */ |
| 1468 | unsigned long trans_start; /* Time (in jiffies) of last Tx */ | 1610 | unsigned long trans_start; |
| 1469 | 1611 | ||
| 1470 | int watchdog_timeo; /* used by dev_watchdog() */ | 1612 | int watchdog_timeo; |
| 1471 | struct timer_list watchdog_timer; | 1613 | struct timer_list watchdog_timer; |
| 1472 | 1614 | ||
| 1473 | /* Number of references to this device */ | ||
| 1474 | int __percpu *pcpu_refcnt; | 1615 | int __percpu *pcpu_refcnt; |
| 1475 | |||
| 1476 | /* delayed register/unregister */ | ||
| 1477 | struct list_head todo_list; | 1616 | struct list_head todo_list; |
| 1478 | /* device index hash chain */ | ||
| 1479 | struct hlist_node index_hlist; | ||
| 1480 | 1617 | ||
| 1618 | struct hlist_node index_hlist; | ||
| 1481 | struct list_head link_watch_list; | 1619 | struct list_head link_watch_list; |
| 1482 | 1620 | ||
| 1483 | /* register/unregister state machine */ | ||
| 1484 | enum { NETREG_UNINITIALIZED=0, | 1621 | enum { NETREG_UNINITIALIZED=0, |
| 1485 | NETREG_REGISTERED, /* completed register_netdevice */ | 1622 | NETREG_REGISTERED, /* completed register_netdevice */ |
| 1486 | NETREG_UNREGISTERING, /* called unregister_netdevice */ | 1623 | NETREG_UNREGISTERING, /* called unregister_netdevice */ |
| @@ -1489,14 +1626,13 @@ struct net_device { | |||
| 1489 | NETREG_DUMMY, /* dummy device for NAPI poll */ | 1626 | NETREG_DUMMY, /* dummy device for NAPI poll */ |
| 1490 | } reg_state:8; | 1627 | } reg_state:8; |
| 1491 | 1628 | ||
| 1492 | bool dismantle; /* device is going do be freed */ | 1629 | bool dismantle; |
| 1493 | 1630 | ||
| 1494 | enum { | 1631 | enum { |
| 1495 | RTNL_LINK_INITIALIZED, | 1632 | RTNL_LINK_INITIALIZED, |
| 1496 | RTNL_LINK_INITIALIZING, | 1633 | RTNL_LINK_INITIALIZING, |
| 1497 | } rtnl_link_state:16; | 1634 | } rtnl_link_state:16; |
| 1498 | 1635 | ||
| 1499 | /* Called from unregister, can be used to call free_netdev */ | ||
| 1500 | void (*destructor)(struct net_device *dev); | 1636 | void (*destructor)(struct net_device *dev); |
| 1501 | 1637 | ||
| 1502 | #ifdef CONFIG_NETPOLL | 1638 | #ifdef CONFIG_NETPOLL |
| @@ -1504,31 +1640,25 @@ struct net_device { | |||
| 1504 | #endif | 1640 | #endif |
| 1505 | 1641 | ||
| 1506 | #ifdef CONFIG_NET_NS | 1642 | #ifdef CONFIG_NET_NS |
| 1507 | /* Network namespace this network device is inside */ | ||
| 1508 | struct net *nd_net; | 1643 | struct net *nd_net; |
| 1509 | #endif | 1644 | #endif |
| 1510 | 1645 | ||
| 1511 | /* mid-layer private */ | 1646 | /* mid-layer private */ |
| 1512 | union { | 1647 | union { |
| 1513 | void *ml_priv; | 1648 | void *ml_priv; |
| 1514 | struct pcpu_lstats __percpu *lstats; /* loopback stats */ | 1649 | struct pcpu_lstats __percpu *lstats; |
| 1515 | struct pcpu_sw_netstats __percpu *tstats; | 1650 | struct pcpu_sw_netstats __percpu *tstats; |
| 1516 | struct pcpu_dstats __percpu *dstats; /* dummy stats */ | 1651 | struct pcpu_dstats __percpu *dstats; |
| 1517 | struct pcpu_vstats __percpu *vstats; /* veth stats */ | 1652 | struct pcpu_vstats __percpu *vstats; |
| 1518 | }; | 1653 | }; |
| 1519 | /* GARP */ | 1654 | |
| 1520 | struct garp_port __rcu *garp_port; | 1655 | struct garp_port __rcu *garp_port; |
| 1521 | /* MRP */ | ||
| 1522 | struct mrp_port __rcu *mrp_port; | 1656 | struct mrp_port __rcu *mrp_port; |
| 1523 | 1657 | ||
| 1524 | /* class/net/name entry */ | 1658 | struct device dev; |
| 1525 | struct device dev; | ||
| 1526 | /* space for optional device, statistics, and wireless sysfs groups */ | ||
| 1527 | const struct attribute_group *sysfs_groups[4]; | 1659 | const struct attribute_group *sysfs_groups[4]; |
| 1528 | /* space for optional per-rx queue attributes */ | ||
| 1529 | const struct attribute_group *sysfs_rx_queue_group; | 1660 | const struct attribute_group *sysfs_rx_queue_group; |
| 1530 | 1661 | ||
| 1531 | /* rtnetlink link ops */ | ||
| 1532 | const struct rtnl_link_ops *rtnl_link_ops; | 1662 | const struct rtnl_link_ops *rtnl_link_ops; |
| 1533 | 1663 | ||
| 1534 | /* for setting kernel sock attribute on TCP connection setup */ | 1664 | /* for setting kernel sock attribute on TCP connection setup */ |
| @@ -1538,7 +1668,6 @@ struct net_device { | |||
| 1538 | u16 gso_max_segs; | 1668 | u16 gso_max_segs; |
| 1539 | 1669 | ||
| 1540 | #ifdef CONFIG_DCB | 1670 | #ifdef CONFIG_DCB |
| 1541 | /* Data Center Bridging netlink ops */ | ||
| 1542 | const struct dcbnl_rtnl_ops *dcbnl_ops; | 1671 | const struct dcbnl_rtnl_ops *dcbnl_ops; |
| 1543 | #endif | 1672 | #endif |
| 1544 | u8 num_tc; | 1673 | u8 num_tc; |
| @@ -1546,20 +1675,14 @@ struct net_device { | |||
| 1546 | u8 prio_tc_map[TC_BITMASK + 1]; | 1675 | u8 prio_tc_map[TC_BITMASK + 1]; |
| 1547 | 1676 | ||
| 1548 | #if IS_ENABLED(CONFIG_FCOE) | 1677 | #if IS_ENABLED(CONFIG_FCOE) |
| 1549 | /* max exchange id for FCoE LRO by ddp */ | ||
| 1550 | unsigned int fcoe_ddp_xid; | 1678 | unsigned int fcoe_ddp_xid; |
| 1551 | #endif | 1679 | #endif |
| 1552 | #if IS_ENABLED(CONFIG_CGROUP_NET_PRIO) | 1680 | #if IS_ENABLED(CONFIG_CGROUP_NET_PRIO) |
| 1553 | struct netprio_map __rcu *priomap; | 1681 | struct netprio_map __rcu *priomap; |
| 1554 | #endif | 1682 | #endif |
| 1555 | /* phy device may attach itself for hardware timestamping */ | ||
| 1556 | struct phy_device *phydev; | 1683 | struct phy_device *phydev; |
| 1557 | |||
| 1558 | struct lock_class_key *qdisc_tx_busylock; | 1684 | struct lock_class_key *qdisc_tx_busylock; |
| 1559 | |||
| 1560 | /* group the device belongs to */ | ||
| 1561 | int group; | 1685 | int group; |
| 1562 | |||
| 1563 | struct pm_qos_request pm_qos_req; | 1686 | struct pm_qos_request pm_qos_req; |
| 1564 | }; | 1687 | }; |
| 1565 | #define to_net_dev(d) container_of(d, struct net_device, dev) | 1688 | #define to_net_dev(d) container_of(d, struct net_device, dev) |
| @@ -2486,7 +2609,7 @@ static inline int netif_set_xps_queue(struct net_device *dev, | |||
| 2486 | * as a distribution range limit for the returned value. | 2609 | * as a distribution range limit for the returned value. |
| 2487 | */ | 2610 | */ |
| 2488 | static inline u16 skb_tx_hash(const struct net_device *dev, | 2611 | static inline u16 skb_tx_hash(const struct net_device *dev, |
| 2489 | const struct sk_buff *skb) | 2612 | struct sk_buff *skb) |
| 2490 | { | 2613 | { |
| 2491 | return __skb_tx_hash(dev, skb, dev->real_num_tx_queues); | 2614 | return __skb_tx_hash(dev, skb, dev->real_num_tx_queues); |
| 2492 | } | 2615 | } |
| @@ -2987,13 +3110,15 @@ void ether_setup(struct net_device *dev); | |||
| 2987 | 3110 | ||
| 2988 | /* Support for loadable net-drivers */ | 3111 | /* Support for loadable net-drivers */ |
| 2989 | struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name, | 3112 | struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name, |
| 3113 | unsigned char name_assign_type, | ||
| 2990 | void (*setup)(struct net_device *), | 3114 | void (*setup)(struct net_device *), |
| 2991 | unsigned int txqs, unsigned int rxqs); | 3115 | unsigned int txqs, unsigned int rxqs); |
| 2992 | #define alloc_netdev(sizeof_priv, name, setup) \ | 3116 | #define alloc_netdev(sizeof_priv, name, name_assign_type, setup) \ |
| 2993 | alloc_netdev_mqs(sizeof_priv, name, setup, 1, 1) | 3117 | alloc_netdev_mqs(sizeof_priv, name, name_assign_type, setup, 1, 1) |
| 2994 | 3118 | ||
| 2995 | #define alloc_netdev_mq(sizeof_priv, name, setup, count) \ | 3119 | #define alloc_netdev_mq(sizeof_priv, name, name_assign_type, setup, count) \ |
| 2996 | alloc_netdev_mqs(sizeof_priv, name, setup, count, count) | 3120 | alloc_netdev_mqs(sizeof_priv, name, name_assign_type, setup, count, \ |
| 3121 | count) | ||
| 2997 | 3122 | ||
| 2998 | int register_netdev(struct net_device *dev); | 3123 | int register_netdev(struct net_device *dev); |
| 2999 | void unregister_netdev(struct net_device *dev); | 3124 | void unregister_netdev(struct net_device *dev); |
| @@ -3377,11 +3502,26 @@ extern struct pernet_operations __net_initdata loopback_net_ops; | |||
| 3377 | 3502 | ||
| 3378 | static inline const char *netdev_name(const struct net_device *dev) | 3503 | static inline const char *netdev_name(const struct net_device *dev) |
| 3379 | { | 3504 | { |
| 3380 | if (dev->reg_state != NETREG_REGISTERED) | 3505 | if (!dev->name[0] || strchr(dev->name, '%')) |
| 3381 | return "(unregistered net_device)"; | 3506 | return "(unnamed net_device)"; |
| 3382 | return dev->name; | 3507 | return dev->name; |
| 3383 | } | 3508 | } |
| 3384 | 3509 | ||
| 3510 | static inline const char *netdev_reg_state(const struct net_device *dev) | ||
| 3511 | { | ||
| 3512 | switch (dev->reg_state) { | ||
| 3513 | case NETREG_UNINITIALIZED: return " (uninitialized)"; | ||
| 3514 | case NETREG_REGISTERED: return ""; | ||
| 3515 | case NETREG_UNREGISTERING: return " (unregistering)"; | ||
| 3516 | case NETREG_UNREGISTERED: return " (unregistered)"; | ||
| 3517 | case NETREG_RELEASED: return " (released)"; | ||
| 3518 | case NETREG_DUMMY: return " (dummy)"; | ||
| 3519 | } | ||
| 3520 | |||
| 3521 | WARN_ONCE(1, "%s: unknown reg_state %d\n", dev->name, dev->reg_state); | ||
| 3522 | return " (unknown)"; | ||
| 3523 | } | ||
| 3524 | |||
| 3385 | __printf(3, 4) | 3525 | __printf(3, 4) |
| 3386 | int netdev_printk(const char *level, const struct net_device *dev, | 3526 | int netdev_printk(const char *level, const struct net_device *dev, |
| 3387 | const char *format, ...); | 3527 | const char *format, ...); |
| @@ -3438,7 +3578,8 @@ do { \ | |||
| 3438 | * file/line information and a backtrace. | 3578 | * file/line information and a backtrace. |
| 3439 | */ | 3579 | */ |
| 3440 | #define netdev_WARN(dev, format, args...) \ | 3580 | #define netdev_WARN(dev, format, args...) \ |
| 3441 | WARN(1, "netdevice: %s\n" format, netdev_name(dev), ##args) | 3581 | WARN(1, "netdevice: %s%s\n" format, netdev_name(dev), \ |
| 3582 | netdev_reg_state(dev), ##args) | ||
| 3442 | 3583 | ||
| 3443 | /* netif printk helpers, similar to netdev_printk */ | 3584 | /* netif printk helpers, similar to netdev_printk */ |
| 3444 | 3585 | ||
diff --git a/include/linux/nmi.h b/include/linux/nmi.h index 447775ee2c4b..1d2a6ab6b8bb 100644 --- a/include/linux/nmi.h +++ b/include/linux/nmi.h | |||
| @@ -63,4 +63,8 @@ extern int proc_dowatchdog(struct ctl_table *, int , | |||
| 63 | void __user *, size_t *, loff_t *); | 63 | void __user *, size_t *, loff_t *); |
| 64 | #endif | 64 | #endif |
| 65 | 65 | ||
| 66 | #ifdef CONFIG_HAVE_ACPI_APEI_NMI | ||
| 67 | #include <asm/nmi.h> | ||
| 68 | #endif | ||
| 69 | |||
| 66 | #endif | 70 | #endif |
diff --git a/include/linux/of_address.h b/include/linux/of_address.h index c13b8782a4eb..fb7b7221e063 100644 --- a/include/linux/of_address.h +++ b/include/linux/of_address.h | |||
| @@ -109,7 +109,12 @@ static inline bool of_dma_is_coherent(struct device_node *np) | |||
| 109 | extern int of_address_to_resource(struct device_node *dev, int index, | 109 | extern int of_address_to_resource(struct device_node *dev, int index, |
| 110 | struct resource *r); | 110 | struct resource *r); |
| 111 | void __iomem *of_iomap(struct device_node *node, int index); | 111 | void __iomem *of_iomap(struct device_node *node, int index); |
| 112 | void __iomem *of_io_request_and_map(struct device_node *device, | ||
| 113 | int index, char *name); | ||
| 112 | #else | 114 | #else |
| 115 | |||
| 116 | #include <linux/io.h> | ||
| 117 | |||
| 113 | static inline int of_address_to_resource(struct device_node *dev, int index, | 118 | static inline int of_address_to_resource(struct device_node *dev, int index, |
| 114 | struct resource *r) | 119 | struct resource *r) |
| 115 | { | 120 | { |
| @@ -120,6 +125,12 @@ static inline void __iomem *of_iomap(struct device_node *device, int index) | |||
| 120 | { | 125 | { |
| 121 | return NULL; | 126 | return NULL; |
| 122 | } | 127 | } |
| 128 | |||
| 129 | static inline void __iomem *of_io_request_and_map(struct device_node *device, | ||
| 130 | int index, char *name) | ||
| 131 | { | ||
| 132 | return IOMEM_ERR_PTR(-EINVAL); | ||
| 133 | } | ||
| 123 | #endif | 134 | #endif |
| 124 | 135 | ||
| 125 | #if defined(CONFIG_OF_ADDRESS) && defined(CONFIG_PCI) | 136 | #if defined(CONFIG_OF_ADDRESS) && defined(CONFIG_PCI) |
diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h index 05117899fcb4..0ff360d5b3b3 100644 --- a/include/linux/of_fdt.h +++ b/include/linux/of_fdt.h | |||
| @@ -73,6 +73,8 @@ extern int early_init_dt_scan_root(unsigned long node, const char *uname, | |||
| 73 | int depth, void *data); | 73 | int depth, void *data); |
| 74 | 74 | ||
| 75 | extern bool early_init_dt_scan(void *params); | 75 | extern bool early_init_dt_scan(void *params); |
| 76 | extern bool early_init_dt_verify(void *params); | ||
| 77 | extern void early_init_dt_scan_nodes(void); | ||
| 76 | 78 | ||
| 77 | extern const char *of_flat_dt_get_machine_name(void); | 79 | extern const char *of_flat_dt_get_machine_name(void); |
| 78 | extern const void *of_flat_dt_match_machine(const void *default_match, | 80 | extern const void *of_flat_dt_match_machine(const void *default_match, |
| @@ -84,6 +86,7 @@ extern void unflatten_and_copy_device_tree(void); | |||
| 84 | extern void early_init_devtree(void *); | 86 | extern void early_init_devtree(void *); |
| 85 | extern void early_get_first_memblock_info(void *, phys_addr_t *); | 87 | extern void early_get_first_memblock_info(void *, phys_addr_t *); |
| 86 | extern u64 fdt_translate_address(const void *blob, int node_offset); | 88 | extern u64 fdt_translate_address(const void *blob, int node_offset); |
| 89 | extern void of_fdt_limit_memory(int limit); | ||
| 87 | #else /* CONFIG_OF_FLATTREE */ | 90 | #else /* CONFIG_OF_FLATTREE */ |
| 88 | static inline void early_init_fdt_scan_reserved_mem(void) {} | 91 | static inline void early_init_fdt_scan_reserved_mem(void) {} |
| 89 | static inline const char *of_flat_dt_get_machine_name(void) { return NULL; } | 92 | static inline const char *of_flat_dt_get_machine_name(void) { return NULL; } |
diff --git a/include/linux/oid_registry.h b/include/linux/oid_registry.h index 6926db724258..c2bbf672b84e 100644 --- a/include/linux/oid_registry.h +++ b/include/linux/oid_registry.h | |||
| @@ -52,9 +52,15 @@ enum OID { | |||
| 52 | OID_md4, /* 1.2.840.113549.2.4 */ | 52 | OID_md4, /* 1.2.840.113549.2.4 */ |
| 53 | OID_md5, /* 1.2.840.113549.2.5 */ | 53 | OID_md5, /* 1.2.840.113549.2.5 */ |
| 54 | 54 | ||
| 55 | OID_certAuthInfoAccess, /* 1.3.6.1.5.5.7.1.1 */ | 55 | /* Microsoft Authenticode & Software Publishing */ |
| 56 | OID_msIndirectData, /* 1.3.6.1.4.1.311.2.1.4 */ | ||
| 57 | OID_msPeImageDataObjId, /* 1.3.6.1.4.1.311.2.1.15 */ | ||
| 58 | OID_msIndividualSPKeyPurpose, /* 1.3.6.1.4.1.311.2.1.21 */ | ||
| 56 | OID_msOutlookExpress, /* 1.3.6.1.4.1.311.16.4 */ | 59 | OID_msOutlookExpress, /* 1.3.6.1.4.1.311.16.4 */ |
| 60 | |||
| 61 | OID_certAuthInfoAccess, /* 1.3.6.1.5.5.7.1.1 */ | ||
| 57 | OID_sha1, /* 1.3.14.3.2.26 */ | 62 | OID_sha1, /* 1.3.14.3.2.26 */ |
| 63 | OID_sha256, /* 2.16.840.1.101.3.4.2.1 */ | ||
| 58 | 64 | ||
| 59 | /* Distinguished Name attribute IDs [RFC 2256] */ | 65 | /* Distinguished Name attribute IDs [RFC 2256] */ |
| 60 | OID_commonName, /* 2.5.4.3 */ | 66 | OID_commonName, /* 2.5.4.3 */ |
diff --git a/include/linux/omap-iommu.h b/include/linux/omap-iommu.h index cac78de09c07..c1aede46718b 100644 --- a/include/linux/omap-iommu.h +++ b/include/linux/omap-iommu.h | |||
| @@ -10,41 +10,8 @@ | |||
| 10 | * published by the Free Software Foundation. | 10 | * published by the Free Software Foundation. |
| 11 | */ | 11 | */ |
| 12 | 12 | ||
| 13 | #ifndef _INTEL_IOMMU_H_ | 13 | #ifndef _OMAP_IOMMU_H_ |
| 14 | #define _INTEL_IOMMU_H_ | 14 | #define _OMAP_IOMMU_H_ |
| 15 | |||
| 16 | struct iovm_struct { | ||
| 17 | struct omap_iommu *iommu; /* iommu object which this belongs to */ | ||
| 18 | u32 da_start; /* area definition */ | ||
| 19 | u32 da_end; | ||
| 20 | u32 flags; /* IOVMF_: see below */ | ||
| 21 | struct list_head list; /* linked in ascending order */ | ||
| 22 | const struct sg_table *sgt; /* keep 'page' <-> 'da' mapping */ | ||
| 23 | void *va; /* mpu side mapped address */ | ||
| 24 | }; | ||
| 25 | |||
| 26 | #define MMU_RAM_ENDIAN_SHIFT 9 | ||
| 27 | #define MMU_RAM_ENDIAN_LITTLE (0 << MMU_RAM_ENDIAN_SHIFT) | ||
| 28 | #define MMU_RAM_ELSZ_8 (0 << MMU_RAM_ELSZ_SHIFT) | ||
| 29 | #define IOVMF_ENDIAN_LITTLE MMU_RAM_ENDIAN_LITTLE | ||
| 30 | #define MMU_RAM_ELSZ_SHIFT 7 | ||
| 31 | #define IOVMF_ELSZ_8 MMU_RAM_ELSZ_8 | ||
| 32 | |||
| 33 | struct iommu_domain; | ||
| 34 | |||
| 35 | extern struct iovm_struct *omap_find_iovm_area(struct device *dev, u32 da); | ||
| 36 | extern u32 | ||
| 37 | omap_iommu_vmap(struct iommu_domain *domain, struct device *dev, u32 da, | ||
| 38 | const struct sg_table *sgt, u32 flags); | ||
| 39 | extern struct sg_table *omap_iommu_vunmap(struct iommu_domain *domain, | ||
| 40 | struct device *dev, u32 da); | ||
| 41 | extern u32 | ||
| 42 | omap_iommu_vmalloc(struct iommu_domain *domain, struct device *dev, | ||
| 43 | u32 da, size_t bytes, u32 flags); | ||
| 44 | extern void | ||
| 45 | omap_iommu_vfree(struct iommu_domain *domain, struct device *dev, | ||
| 46 | const u32 da); | ||
| 47 | extern void *omap_da_to_va(struct device *dev, u32 da); | ||
| 48 | 15 | ||
| 49 | extern void omap_iommu_save_ctx(struct device *dev); | 16 | extern void omap_iommu_save_ctx(struct device *dev); |
| 50 | extern void omap_iommu_restore_ctx(struct device *dev); | 17 | extern void omap_iommu_restore_ctx(struct device *dev); |
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index 0a97b583ee8d..e1474ae18c88 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h | |||
| @@ -399,6 +399,18 @@ static inline struct page *read_mapping_page(struct address_space *mapping, | |||
| 399 | } | 399 | } |
| 400 | 400 | ||
| 401 | /* | 401 | /* |
| 402 | * Get the offset in PAGE_SIZE. | ||
| 403 | * (TODO: hugepage should have ->index in PAGE_SIZE) | ||
| 404 | */ | ||
| 405 | static inline pgoff_t page_to_pgoff(struct page *page) | ||
| 406 | { | ||
| 407 | if (unlikely(PageHeadHuge(page))) | ||
| 408 | return page->index << compound_order(page); | ||
| 409 | else | ||
| 410 | return page->index << (PAGE_CACHE_SHIFT - PAGE_SHIFT); | ||
| 411 | } | ||
| 412 | |||
| 413 | /* | ||
| 402 | * Return byte-offset into filesystem object for page. | 414 | * Return byte-offset into filesystem object for page. |
| 403 | */ | 415 | */ |
| 404 | static inline loff_t page_offset(struct page *page) | 416 | static inline loff_t page_offset(struct page *page) |
diff --git a/include/linux/pci-acpi.h b/include/linux/pci-acpi.h index 637a608ded0b..64dacb7288a6 100644 --- a/include/linux/pci-acpi.h +++ b/include/linux/pci-acpi.h | |||
| @@ -11,12 +11,17 @@ | |||
| 11 | #include <linux/acpi.h> | 11 | #include <linux/acpi.h> |
| 12 | 12 | ||
| 13 | #ifdef CONFIG_ACPI | 13 | #ifdef CONFIG_ACPI |
| 14 | extern acpi_status pci_acpi_add_bus_pm_notifier(struct acpi_device *dev, | 14 | extern acpi_status pci_acpi_add_bus_pm_notifier(struct acpi_device *dev); |
| 15 | struct pci_bus *pci_bus); | 15 | static inline acpi_status pci_acpi_remove_bus_pm_notifier(struct acpi_device *dev) |
| 16 | extern acpi_status pci_acpi_remove_bus_pm_notifier(struct acpi_device *dev); | 16 | { |
| 17 | return acpi_remove_pm_notifier(dev); | ||
| 18 | } | ||
| 17 | extern acpi_status pci_acpi_add_pm_notifier(struct acpi_device *dev, | 19 | extern acpi_status pci_acpi_add_pm_notifier(struct acpi_device *dev, |
| 18 | struct pci_dev *pci_dev); | 20 | struct pci_dev *pci_dev); |
| 19 | extern acpi_status pci_acpi_remove_pm_notifier(struct acpi_device *dev); | 21 | static inline acpi_status pci_acpi_remove_pm_notifier(struct acpi_device *dev) |
| 22 | { | ||
| 23 | return acpi_remove_pm_notifier(dev); | ||
| 24 | } | ||
| 20 | extern phys_addr_t acpi_pci_root_get_mcfg_addr(acpi_handle handle); | 25 | extern phys_addr_t acpi_pci_root_get_mcfg_addr(acpi_handle handle); |
| 21 | 26 | ||
| 22 | static inline acpi_handle acpi_find_root_bridge_handle(struct pci_dev *pdev) | 27 | static inline acpi_handle acpi_find_root_bridge_handle(struct pci_dev *pdev) |
diff --git a/include/linux/pci.h b/include/linux/pci.h index 466bcd111d85..61978a460841 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
| @@ -978,6 +978,8 @@ int pci_try_reset_slot(struct pci_slot *slot); | |||
| 978 | int pci_probe_reset_bus(struct pci_bus *bus); | 978 | int pci_probe_reset_bus(struct pci_bus *bus); |
| 979 | int pci_reset_bus(struct pci_bus *bus); | 979 | int pci_reset_bus(struct pci_bus *bus); |
| 980 | int pci_try_reset_bus(struct pci_bus *bus); | 980 | int pci_try_reset_bus(struct pci_bus *bus); |
| 981 | void pci_reset_secondary_bus(struct pci_dev *dev); | ||
| 982 | void pcibios_reset_secondary_bus(struct pci_dev *dev); | ||
| 981 | void pci_reset_bridge_secondary_bus(struct pci_dev *dev); | 983 | void pci_reset_bridge_secondary_bus(struct pci_dev *dev); |
| 982 | void pci_update_resource(struct pci_dev *dev, int resno); | 984 | void pci_update_resource(struct pci_dev *dev, int resno); |
| 983 | int __must_check pci_assign_resource(struct pci_dev *dev, int i); | 985 | int __must_check pci_assign_resource(struct pci_dev *dev, int i); |
| @@ -1186,7 +1188,6 @@ int pci_msix_vec_count(struct pci_dev *dev); | |||
| 1186 | int pci_enable_msix(struct pci_dev *dev, struct msix_entry *entries, int nvec); | 1188 | int pci_enable_msix(struct pci_dev *dev, struct msix_entry *entries, int nvec); |
| 1187 | void pci_msix_shutdown(struct pci_dev *dev); | 1189 | void pci_msix_shutdown(struct pci_dev *dev); |
| 1188 | void pci_disable_msix(struct pci_dev *dev); | 1190 | void pci_disable_msix(struct pci_dev *dev); |
| 1189 | void msi_remove_pci_irq_vectors(struct pci_dev *dev); | ||
| 1190 | void pci_restore_msi_state(struct pci_dev *dev); | 1191 | void pci_restore_msi_state(struct pci_dev *dev); |
| 1191 | int pci_msi_enabled(void); | 1192 | int pci_msi_enabled(void); |
| 1192 | int pci_enable_msi_range(struct pci_dev *dev, int minvec, int maxvec); | 1193 | int pci_enable_msi_range(struct pci_dev *dev, int minvec, int maxvec); |
| @@ -1217,7 +1218,6 @@ static inline int pci_enable_msix(struct pci_dev *dev, | |||
| 1217 | { return -ENOSYS; } | 1218 | { return -ENOSYS; } |
| 1218 | static inline void pci_msix_shutdown(struct pci_dev *dev) { } | 1219 | static inline void pci_msix_shutdown(struct pci_dev *dev) { } |
| 1219 | static inline void pci_disable_msix(struct pci_dev *dev) { } | 1220 | static inline void pci_disable_msix(struct pci_dev *dev) { } |
| 1220 | static inline void msi_remove_pci_irq_vectors(struct pci_dev *dev) { } | ||
| 1221 | static inline void pci_restore_msi_state(struct pci_dev *dev) { } | 1221 | static inline void pci_restore_msi_state(struct pci_dev *dev) { } |
| 1222 | static inline int pci_msi_enabled(void) { return 0; } | 1222 | static inline int pci_msi_enabled(void) { return 0; } |
| 1223 | static inline int pci_enable_msi_range(struct pci_dev *dev, int minvec, | 1223 | static inline int pci_enable_msi_range(struct pci_dev *dev, int minvec, |
| @@ -1477,8 +1477,9 @@ enum pci_fixup_pass { | |||
| 1477 | pci_fixup_final, /* Final phase of device fixups */ | 1477 | pci_fixup_final, /* Final phase of device fixups */ |
| 1478 | pci_fixup_enable, /* pci_enable_device() time */ | 1478 | pci_fixup_enable, /* pci_enable_device() time */ |
| 1479 | pci_fixup_resume, /* pci_device_resume() */ | 1479 | pci_fixup_resume, /* pci_device_resume() */ |
| 1480 | pci_fixup_suspend, /* pci_device_suspend */ | 1480 | pci_fixup_suspend, /* pci_device_suspend() */ |
| 1481 | pci_fixup_resume_early, /* pci_device_resume_early() */ | 1481 | pci_fixup_resume_early, /* pci_device_resume_early() */ |
| 1482 | pci_fixup_suspend_late, /* pci_device_suspend_late() */ | ||
| 1482 | }; | 1483 | }; |
| 1483 | 1484 | ||
| 1484 | /* Anonymous variables would be nice... */ | 1485 | /* Anonymous variables would be nice... */ |
| @@ -1519,6 +1520,11 @@ enum pci_fixup_pass { | |||
| 1519 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_suspend, \ | 1520 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_suspend, \ |
| 1520 | suspend##hook, vendor, device, class, \ | 1521 | suspend##hook, vendor, device, class, \ |
| 1521 | class_shift, hook) | 1522 | class_shift, hook) |
| 1523 | #define DECLARE_PCI_FIXUP_CLASS_SUSPEND_LATE(vendor, device, class, \ | ||
| 1524 | class_shift, hook) \ | ||
| 1525 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_suspend_late, \ | ||
| 1526 | suspend_late##hook, vendor, device, \ | ||
| 1527 | class, class_shift, hook) | ||
| 1522 | 1528 | ||
| 1523 | #define DECLARE_PCI_FIXUP_EARLY(vendor, device, hook) \ | 1529 | #define DECLARE_PCI_FIXUP_EARLY(vendor, device, hook) \ |
| 1524 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_early, \ | 1530 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_early, \ |
| @@ -1544,6 +1550,10 @@ enum pci_fixup_pass { | |||
| 1544 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_suspend, \ | 1550 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_suspend, \ |
| 1545 | suspend##hook, vendor, device, \ | 1551 | suspend##hook, vendor, device, \ |
| 1546 | PCI_ANY_ID, 0, hook) | 1552 | PCI_ANY_ID, 0, hook) |
| 1553 | #define DECLARE_PCI_FIXUP_SUSPEND_LATE(vendor, device, hook) \ | ||
| 1554 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_suspend_late, \ | ||
| 1555 | suspend_late##hook, vendor, device, \ | ||
| 1556 | PCI_ANY_ID, 0, hook) | ||
| 1547 | 1557 | ||
| 1548 | #ifdef CONFIG_PCI_QUIRKS | 1558 | #ifdef CONFIG_PCI_QUIRKS |
| 1549 | void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev); | 1559 | void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev); |
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index 7fa31731c854..6ed0bb73a864 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h | |||
| @@ -6,6 +6,8 @@ | |||
| 6 | * Do not add new entries to this file unless the definitions | 6 | * Do not add new entries to this file unless the definitions |
| 7 | * are shared between multiple drivers. | 7 | * are shared between multiple drivers. |
| 8 | */ | 8 | */ |
| 9 | #ifndef _LINUX_PCI_IDS_H | ||
| 10 | #define _LINUX_PCI_IDS_H | ||
| 9 | 11 | ||
| 10 | /* Device classes and subclasses */ | 12 | /* Device classes and subclasses */ |
| 11 | 13 | ||
| @@ -2968,3 +2970,5 @@ | |||
| 2968 | #define PCI_DEVICE_ID_XEN_PLATFORM 0x0001 | 2970 | #define PCI_DEVICE_ID_XEN_PLATFORM 0x0001 |
| 2969 | 2971 | ||
| 2970 | #define PCI_VENDOR_ID_OCZ 0x1b85 | 2972 | #define PCI_VENDOR_ID_OCZ 0x1b85 |
| 2973 | |||
| 2974 | #endif /* _LINUX_PCI_IDS_H */ | ||
diff --git a/include/linux/pe.h b/include/linux/pe.h new file mode 100644 index 000000000000..e170b95e763b --- /dev/null +++ b/include/linux/pe.h | |||
| @@ -0,0 +1,448 @@ | |||
| 1 | /* | ||
| 2 | * Copyright 2011 Red Hat, Inc. | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This program is free software; you can redistribute it and/or modify | ||
| 6 | * it under the terms of the GNU General Public License as published by | ||
| 7 | * the Free Software Foundation; version 2 of the License. | ||
| 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, see <http://www.gnu.org/licenses/>. | ||
| 16 | * | ||
| 17 | * Author(s): Peter Jones <pjones@redhat.com> | ||
| 18 | */ | ||
| 19 | #ifndef __LINUX_PE_H | ||
| 20 | #define __LINUX_PE_H | ||
| 21 | |||
| 22 | #include <linux/types.h> | ||
| 23 | |||
| 24 | #define MZ_MAGIC 0x5a4d /* "MZ" */ | ||
| 25 | |||
| 26 | struct mz_hdr { | ||
| 27 | uint16_t magic; /* MZ_MAGIC */ | ||
| 28 | uint16_t lbsize; /* size of last used block */ | ||
| 29 | uint16_t blocks; /* pages in file, 0x3 */ | ||
| 30 | uint16_t relocs; /* relocations */ | ||
| 31 | uint16_t hdrsize; /* header size in "paragraphs" */ | ||
| 32 | uint16_t min_extra_pps; /* .bss */ | ||
| 33 | uint16_t max_extra_pps; /* runtime limit for the arena size */ | ||
| 34 | uint16_t ss; /* relative stack segment */ | ||
| 35 | uint16_t sp; /* initial %sp register */ | ||
| 36 | uint16_t checksum; /* word checksum */ | ||
| 37 | uint16_t ip; /* initial %ip register */ | ||
| 38 | uint16_t cs; /* initial %cs relative to load segment */ | ||
| 39 | uint16_t reloc_table_offset; /* offset of the first relocation */ | ||
| 40 | uint16_t overlay_num; /* overlay number. set to 0. */ | ||
| 41 | uint16_t reserved0[4]; /* reserved */ | ||
| 42 | uint16_t oem_id; /* oem identifier */ | ||
| 43 | uint16_t oem_info; /* oem specific */ | ||
| 44 | uint16_t reserved1[10]; /* reserved */ | ||
| 45 | uint32_t peaddr; /* address of pe header */ | ||
| 46 | char message[64]; /* message to print */ | ||
| 47 | }; | ||
| 48 | |||
| 49 | struct mz_reloc { | ||
| 50 | uint16_t offset; | ||
| 51 | uint16_t segment; | ||
| 52 | }; | ||
| 53 | |||
| 54 | #define PE_MAGIC 0x00004550 /* "PE\0\0" */ | ||
| 55 | #define PE_OPT_MAGIC_PE32 0x010b | ||
| 56 | #define PE_OPT_MAGIC_PE32_ROM 0x0107 | ||
| 57 | #define PE_OPT_MAGIC_PE32PLUS 0x020b | ||
| 58 | |||
| 59 | /* machine type */ | ||
| 60 | #define IMAGE_FILE_MACHINE_UNKNOWN 0x0000 | ||
| 61 | #define IMAGE_FILE_MACHINE_AM33 0x01d3 | ||
| 62 | #define IMAGE_FILE_MACHINE_AMD64 0x8664 | ||
| 63 | #define IMAGE_FILE_MACHINE_ARM 0x01c0 | ||
| 64 | #define IMAGE_FILE_MACHINE_ARMV7 0x01c4 | ||
| 65 | #define IMAGE_FILE_MACHINE_EBC 0x0ebc | ||
| 66 | #define IMAGE_FILE_MACHINE_I386 0x014c | ||
| 67 | #define IMAGE_FILE_MACHINE_IA64 0x0200 | ||
| 68 | #define IMAGE_FILE_MACHINE_M32R 0x9041 | ||
| 69 | #define IMAGE_FILE_MACHINE_MIPS16 0x0266 | ||
| 70 | #define IMAGE_FILE_MACHINE_MIPSFPU 0x0366 | ||
| 71 | #define IMAGE_FILE_MACHINE_MIPSFPU16 0x0466 | ||
| 72 | #define IMAGE_FILE_MACHINE_POWERPC 0x01f0 | ||
| 73 | #define IMAGE_FILE_MACHINE_POWERPCFP 0x01f1 | ||
| 74 | #define IMAGE_FILE_MACHINE_R4000 0x0166 | ||
| 75 | #define IMAGE_FILE_MACHINE_SH3 0x01a2 | ||
| 76 | #define IMAGE_FILE_MACHINE_SH3DSP 0x01a3 | ||
| 77 | #define IMAGE_FILE_MACHINE_SH3E 0x01a4 | ||
| 78 | #define IMAGE_FILE_MACHINE_SH4 0x01a6 | ||
| 79 | #define IMAGE_FILE_MACHINE_SH5 0x01a8 | ||
| 80 | #define IMAGE_FILE_MACHINE_THUMB 0x01c2 | ||
| 81 | #define IMAGE_FILE_MACHINE_WCEMIPSV2 0x0169 | ||
| 82 | |||
| 83 | /* flags */ | ||
| 84 | #define IMAGE_FILE_RELOCS_STRIPPED 0x0001 | ||
| 85 | #define IMAGE_FILE_EXECUTABLE_IMAGE 0x0002 | ||
| 86 | #define IMAGE_FILE_LINE_NUMS_STRIPPED 0x0004 | ||
| 87 | #define IMAGE_FILE_LOCAL_SYMS_STRIPPED 0x0008 | ||
| 88 | #define IMAGE_FILE_AGGRESSIVE_WS_TRIM 0x0010 | ||
| 89 | #define IMAGE_FILE_LARGE_ADDRESS_AWARE 0x0020 | ||
| 90 | #define IMAGE_FILE_16BIT_MACHINE 0x0040 | ||
| 91 | #define IMAGE_FILE_BYTES_REVERSED_LO 0x0080 | ||
| 92 | #define IMAGE_FILE_32BIT_MACHINE 0x0100 | ||
| 93 | #define IMAGE_FILE_DEBUG_STRIPPED 0x0200 | ||
| 94 | #define IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP 0x0400 | ||
| 95 | #define IMAGE_FILE_NET_RUN_FROM_SWAP 0x0800 | ||
| 96 | #define IMAGE_FILE_SYSTEM 0x1000 | ||
| 97 | #define IMAGE_FILE_DLL 0x2000 | ||
| 98 | #define IMAGE_FILE_UP_SYSTEM_ONLY 0x4000 | ||
| 99 | #define IMAGE_FILE_BYTES_REVERSED_HI 0x8000 | ||
| 100 | |||
| 101 | struct pe_hdr { | ||
| 102 | uint32_t magic; /* PE magic */ | ||
| 103 | uint16_t machine; /* machine type */ | ||
| 104 | uint16_t sections; /* number of sections */ | ||
| 105 | uint32_t timestamp; /* time_t */ | ||
| 106 | uint32_t symbol_table; /* symbol table offset */ | ||
| 107 | uint32_t symbols; /* number of symbols */ | ||
| 108 | uint16_t opt_hdr_size; /* size of optional header */ | ||
| 109 | uint16_t flags; /* flags */ | ||
| 110 | }; | ||
| 111 | |||
| 112 | #define IMAGE_FILE_OPT_ROM_MAGIC 0x107 | ||
| 113 | #define IMAGE_FILE_OPT_PE32_MAGIC 0x10b | ||
| 114 | #define IMAGE_FILE_OPT_PE32_PLUS_MAGIC 0x20b | ||
| 115 | |||
| 116 | #define IMAGE_SUBSYSTEM_UNKNOWN 0 | ||
| 117 | #define IMAGE_SUBSYSTEM_NATIVE 1 | ||
| 118 | #define IMAGE_SUBSYSTEM_WINDOWS_GUI 2 | ||
| 119 | #define IMAGE_SUBSYSTEM_WINDOWS_CUI 3 | ||
| 120 | #define IMAGE_SUBSYSTEM_POSIX_CUI 7 | ||
| 121 | #define IMAGE_SUBSYSTEM_WINDOWS_CE_GUI 9 | ||
| 122 | #define IMAGE_SUBSYSTEM_EFI_APPLICATION 10 | ||
| 123 | #define IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER 11 | ||
| 124 | #define IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER 12 | ||
| 125 | #define IMAGE_SUBSYSTEM_EFI_ROM_IMAGE 13 | ||
| 126 | #define IMAGE_SUBSYSTEM_XBOX 14 | ||
| 127 | |||
| 128 | #define IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE 0x0040 | ||
| 129 | #define IMAGE_DLL_CHARACTERISTICS_FORCE_INTEGRITY 0x0080 | ||
| 130 | #define IMAGE_DLL_CHARACTERISTICS_NX_COMPAT 0x0100 | ||
| 131 | #define IMAGE_DLLCHARACTERISTICS_NO_ISOLATION 0x0200 | ||
| 132 | #define IMAGE_DLLCHARACTERISTICS_NO_SEH 0x0400 | ||
| 133 | #define IMAGE_DLLCHARACTERISTICS_NO_BIND 0x0800 | ||
| 134 | #define IMAGE_DLLCHARACTERISTICS_WDM_DRIVER 0x2000 | ||
| 135 | #define IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE 0x8000 | ||
| 136 | |||
| 137 | /* the fact that pe32 isn't padded where pe32+ is 64-bit means union won't | ||
| 138 | * work right. vomit. */ | ||
| 139 | struct pe32_opt_hdr { | ||
| 140 | /* "standard" header */ | ||
| 141 | uint16_t magic; /* file type */ | ||
| 142 | uint8_t ld_major; /* linker major version */ | ||
| 143 | uint8_t ld_minor; /* linker minor version */ | ||
| 144 | uint32_t text_size; /* size of text section(s) */ | ||
| 145 | uint32_t data_size; /* size of data section(s) */ | ||
| 146 | uint32_t bss_size; /* size of bss section(s) */ | ||
| 147 | uint32_t entry_point; /* file offset of entry point */ | ||
| 148 | uint32_t code_base; /* relative code addr in ram */ | ||
| 149 | uint32_t data_base; /* relative data addr in ram */ | ||
| 150 | /* "windows" header */ | ||
| 151 | uint32_t image_base; /* preferred load address */ | ||
| 152 | uint32_t section_align; /* alignment in bytes */ | ||
| 153 | uint32_t file_align; /* file alignment in bytes */ | ||
| 154 | uint16_t os_major; /* major OS version */ | ||
| 155 | uint16_t os_minor; /* minor OS version */ | ||
| 156 | uint16_t image_major; /* major image version */ | ||
| 157 | uint16_t image_minor; /* minor image version */ | ||
| 158 | uint16_t subsys_major; /* major subsystem version */ | ||
| 159 | uint16_t subsys_minor; /* minor subsystem version */ | ||
| 160 | uint32_t win32_version; /* reserved, must be 0 */ | ||
| 161 | uint32_t image_size; /* image size */ | ||
| 162 | uint32_t header_size; /* header size rounded up to | ||
| 163 | file_align */ | ||
| 164 | uint32_t csum; /* checksum */ | ||
| 165 | uint16_t subsys; /* subsystem */ | ||
| 166 | uint16_t dll_flags; /* more flags! */ | ||
| 167 | uint32_t stack_size_req;/* amt of stack requested */ | ||
| 168 | uint32_t stack_size; /* amt of stack required */ | ||
| 169 | uint32_t heap_size_req; /* amt of heap requested */ | ||
| 170 | uint32_t heap_size; /* amt of heap required */ | ||
| 171 | uint32_t loader_flags; /* reserved, must be 0 */ | ||
| 172 | uint32_t data_dirs; /* number of data dir entries */ | ||
| 173 | }; | ||
| 174 | |||
| 175 | struct pe32plus_opt_hdr { | ||
| 176 | uint16_t magic; /* file type */ | ||
| 177 | uint8_t ld_major; /* linker major version */ | ||
| 178 | uint8_t ld_minor; /* linker minor version */ | ||
| 179 | uint32_t text_size; /* size of text section(s) */ | ||
| 180 | uint32_t data_size; /* size of data section(s) */ | ||
| 181 | uint32_t bss_size; /* size of bss section(s) */ | ||
| 182 | uint32_t entry_point; /* file offset of entry point */ | ||
| 183 | uint32_t code_base; /* relative code addr in ram */ | ||
| 184 | /* "windows" header */ | ||
| 185 | uint64_t image_base; /* preferred load address */ | ||
| 186 | uint32_t section_align; /* alignment in bytes */ | ||
| 187 | uint32_t file_align; /* file alignment in bytes */ | ||
| 188 | uint16_t os_major; /* major OS version */ | ||
| 189 | uint16_t os_minor; /* minor OS version */ | ||
| 190 | uint16_t image_major; /* major image version */ | ||
| 191 | uint16_t image_minor; /* minor image version */ | ||
| 192 | uint16_t subsys_major; /* major subsystem version */ | ||
| 193 | uint16_t subsys_minor; /* minor subsystem version */ | ||
| 194 | uint32_t win32_version; /* reserved, must be 0 */ | ||
| 195 | uint32_t image_size; /* image size */ | ||
| 196 | uint32_t header_size; /* header size rounded up to | ||
| 197 | file_align */ | ||
| 198 | uint32_t csum; /* checksum */ | ||
| 199 | uint16_t subsys; /* subsystem */ | ||
| 200 | uint16_t dll_flags; /* more flags! */ | ||
| 201 | uint64_t stack_size_req;/* amt of stack requested */ | ||
| 202 | uint64_t stack_size; /* amt of stack required */ | ||
| 203 | uint64_t heap_size_req; /* amt of heap requested */ | ||
| 204 | uint64_t heap_size; /* amt of heap required */ | ||
| 205 | uint32_t loader_flags; /* reserved, must be 0 */ | ||
| 206 | uint32_t data_dirs; /* number of data dir entries */ | ||
| 207 | }; | ||
| 208 | |||
| 209 | struct data_dirent { | ||
| 210 | uint32_t virtual_address; /* relative to load address */ | ||
| 211 | uint32_t size; | ||
| 212 | }; | ||
| 213 | |||
| 214 | struct data_directory { | ||
| 215 | struct data_dirent exports; /* .edata */ | ||
| 216 | struct data_dirent imports; /* .idata */ | ||
| 217 | struct data_dirent resources; /* .rsrc */ | ||
| 218 | struct data_dirent exceptions; /* .pdata */ | ||
| 219 | struct data_dirent certs; /* certs */ | ||
| 220 | struct data_dirent base_relocations; /* .reloc */ | ||
| 221 | struct data_dirent debug; /* .debug */ | ||
| 222 | struct data_dirent arch; /* reservered */ | ||
| 223 | struct data_dirent global_ptr; /* global pointer reg. Size=0 */ | ||
| 224 | struct data_dirent tls; /* .tls */ | ||
| 225 | struct data_dirent load_config; /* load configuration structure */ | ||
| 226 | struct data_dirent bound_imports; /* no idea */ | ||
| 227 | struct data_dirent import_addrs; /* import address table */ | ||
| 228 | struct data_dirent delay_imports; /* delay-load import table */ | ||
| 229 | struct data_dirent clr_runtime_hdr; /* .cor (object only) */ | ||
| 230 | struct data_dirent reserved; | ||
| 231 | }; | ||
| 232 | |||
| 233 | struct section_header { | ||
| 234 | char name[8]; /* name or "/12\0" string tbl offset */ | ||
| 235 | uint32_t virtual_size; /* size of loaded section in ram */ | ||
| 236 | uint32_t virtual_address; /* relative virtual address */ | ||
| 237 | uint32_t raw_data_size; /* size of the section */ | ||
| 238 | uint32_t data_addr; /* file pointer to first page of sec */ | ||
| 239 | uint32_t relocs; /* file pointer to relocation entries */ | ||
| 240 | uint32_t line_numbers; /* line numbers! */ | ||
| 241 | uint16_t num_relocs; /* number of relocations */ | ||
| 242 | uint16_t num_lin_numbers; /* srsly. */ | ||
| 243 | uint32_t flags; | ||
| 244 | }; | ||
| 245 | |||
| 246 | /* they actually defined 0x00000000 as well, but I think we'll skip that one. */ | ||
| 247 | #define IMAGE_SCN_RESERVED_0 0x00000001 | ||
| 248 | #define IMAGE_SCN_RESERVED_1 0x00000002 | ||
| 249 | #define IMAGE_SCN_RESERVED_2 0x00000004 | ||
| 250 | #define IMAGE_SCN_TYPE_NO_PAD 0x00000008 /* don't pad - obsolete */ | ||
| 251 | #define IMAGE_SCN_RESERVED_3 0x00000010 | ||
| 252 | #define IMAGE_SCN_CNT_CODE 0x00000020 /* .text */ | ||
| 253 | #define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040 /* .data */ | ||
| 254 | #define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x00000080 /* .bss */ | ||
| 255 | #define IMAGE_SCN_LNK_OTHER 0x00000100 /* reserved */ | ||
| 256 | #define IMAGE_SCN_LNK_INFO 0x00000200 /* .drectve comments */ | ||
| 257 | #define IMAGE_SCN_RESERVED_4 0x00000400 | ||
| 258 | #define IMAGE_SCN_LNK_REMOVE 0x00000800 /* .o only - scn to be rm'd*/ | ||
| 259 | #define IMAGE_SCN_LNK_COMDAT 0x00001000 /* .o only - COMDAT data */ | ||
| 260 | #define IMAGE_SCN_RESERVED_5 0x00002000 /* spec omits this */ | ||
| 261 | #define IMAGE_SCN_RESERVED_6 0x00004000 /* spec omits this */ | ||
| 262 | #define IMAGE_SCN_GPREL 0x00008000 /* global pointer referenced data */ | ||
| 263 | /* spec lists 0x20000 twice, I suspect they meant 0x10000 for one of them */ | ||
| 264 | #define IMAGE_SCN_MEM_PURGEABLE 0x00010000 /* reserved for "future" use */ | ||
| 265 | #define IMAGE_SCN_16BIT 0x00020000 /* reserved for "future" use */ | ||
| 266 | #define IMAGE_SCN_LOCKED 0x00040000 /* reserved for "future" use */ | ||
| 267 | #define IMAGE_SCN_PRELOAD 0x00080000 /* reserved for "future" use */ | ||
| 268 | /* and here they just stuck a 1-byte integer in the middle of a bitfield */ | ||
| 269 | #define IMAGE_SCN_ALIGN_1BYTES 0x00100000 /* it does what it says on the box */ | ||
| 270 | #define IMAGE_SCN_ALIGN_2BYTES 0x00200000 | ||
| 271 | #define IMAGE_SCN_ALIGN_4BYTES 0x00300000 | ||
| 272 | #define IMAGE_SCN_ALIGN_8BYTES 0x00400000 | ||
| 273 | #define IMAGE_SCN_ALIGN_16BYTES 0x00500000 | ||
| 274 | #define IMAGE_SCN_ALIGN_32BYTES 0x00600000 | ||
| 275 | #define IMAGE_SCN_ALIGN_64BYTES 0x00700000 | ||
| 276 | #define IMAGE_SCN_ALIGN_128BYTES 0x00800000 | ||
| 277 | #define IMAGE_SCN_ALIGN_256BYTES 0x00900000 | ||
| 278 | #define IMAGE_SCN_ALIGN_512BYTES 0x00a00000 | ||
| 279 | #define IMAGE_SCN_ALIGN_1024BYTES 0x00b00000 | ||
| 280 | #define IMAGE_SCN_ALIGN_2048BYTES 0x00c00000 | ||
| 281 | #define IMAGE_SCN_ALIGN_4096BYTES 0x00d00000 | ||
| 282 | #define IMAGE_SCN_ALIGN_8192BYTES 0x00e00000 | ||
| 283 | #define IMAGE_SCN_LNK_NRELOC_OVFL 0x01000000 /* extended relocations */ | ||
| 284 | #define IMAGE_SCN_MEM_DISCARDABLE 0x02000000 /* scn can be discarded */ | ||
| 285 | #define IMAGE_SCN_MEM_NOT_CACHED 0x04000000 /* cannot be cached */ | ||
| 286 | #define IMAGE_SCN_MEM_NOT_PAGED 0x08000000 /* not pageable */ | ||
| 287 | #define IMAGE_SCN_MEM_SHARED 0x10000000 /* can be shared */ | ||
| 288 | #define IMAGE_SCN_MEM_EXECUTE 0x20000000 /* can be executed as code */ | ||
| 289 | #define IMAGE_SCN_MEM_READ 0x40000000 /* readable */ | ||
| 290 | #define IMAGE_SCN_MEM_WRITE 0x80000000 /* writeable */ | ||
| 291 | |||
| 292 | enum x64_coff_reloc_type { | ||
| 293 | IMAGE_REL_AMD64_ABSOLUTE = 0, | ||
| 294 | IMAGE_REL_AMD64_ADDR64, | ||
| 295 | IMAGE_REL_AMD64_ADDR32, | ||
| 296 | IMAGE_REL_AMD64_ADDR32N, | ||
| 297 | IMAGE_REL_AMD64_REL32, | ||
| 298 | IMAGE_REL_AMD64_REL32_1, | ||
| 299 | IMAGE_REL_AMD64_REL32_2, | ||
| 300 | IMAGE_REL_AMD64_REL32_3, | ||
| 301 | IMAGE_REL_AMD64_REL32_4, | ||
| 302 | IMAGE_REL_AMD64_REL32_5, | ||
| 303 | IMAGE_REL_AMD64_SECTION, | ||
| 304 | IMAGE_REL_AMD64_SECREL, | ||
| 305 | IMAGE_REL_AMD64_SECREL7, | ||
| 306 | IMAGE_REL_AMD64_TOKEN, | ||
| 307 | IMAGE_REL_AMD64_SREL32, | ||
| 308 | IMAGE_REL_AMD64_PAIR, | ||
| 309 | IMAGE_REL_AMD64_SSPAN32, | ||
| 310 | }; | ||
| 311 | |||
| 312 | enum arm_coff_reloc_type { | ||
| 313 | IMAGE_REL_ARM_ABSOLUTE, | ||
| 314 | IMAGE_REL_ARM_ADDR32, | ||
| 315 | IMAGE_REL_ARM_ADDR32N, | ||
| 316 | IMAGE_REL_ARM_BRANCH2, | ||
| 317 | IMAGE_REL_ARM_BRANCH1, | ||
| 318 | IMAGE_REL_ARM_SECTION, | ||
| 319 | IMAGE_REL_ARM_SECREL, | ||
| 320 | }; | ||
| 321 | |||
| 322 | enum sh_coff_reloc_type { | ||
| 323 | IMAGE_REL_SH3_ABSOLUTE, | ||
| 324 | IMAGE_REL_SH3_DIRECT16, | ||
| 325 | IMAGE_REL_SH3_DIRECT32, | ||
| 326 | IMAGE_REL_SH3_DIRECT8, | ||
| 327 | IMAGE_REL_SH3_DIRECT8_WORD, | ||
| 328 | IMAGE_REL_SH3_DIRECT8_LONG, | ||
| 329 | IMAGE_REL_SH3_DIRECT4, | ||
| 330 | IMAGE_REL_SH3_DIRECT4_WORD, | ||
| 331 | IMAGE_REL_SH3_DIRECT4_LONG, | ||
| 332 | IMAGE_REL_SH3_PCREL8_WORD, | ||
| 333 | IMAGE_REL_SH3_PCREL8_LONG, | ||
| 334 | IMAGE_REL_SH3_PCREL12_WORD, | ||
| 335 | IMAGE_REL_SH3_STARTOF_SECTION, | ||
| 336 | IMAGE_REL_SH3_SIZEOF_SECTION, | ||
| 337 | IMAGE_REL_SH3_SECTION, | ||
| 338 | IMAGE_REL_SH3_SECREL, | ||
| 339 | IMAGE_REL_SH3_DIRECT32_NB, | ||
| 340 | IMAGE_REL_SH3_GPREL4_LONG, | ||
| 341 | IMAGE_REL_SH3_TOKEN, | ||
| 342 | IMAGE_REL_SHM_PCRELPT, | ||
| 343 | IMAGE_REL_SHM_REFLO, | ||
| 344 | IMAGE_REL_SHM_REFHALF, | ||
| 345 | IMAGE_REL_SHM_RELLO, | ||
| 346 | IMAGE_REL_SHM_RELHALF, | ||
| 347 | IMAGE_REL_SHM_PAIR, | ||
| 348 | IMAGE_REL_SHM_NOMODE, | ||
| 349 | }; | ||
| 350 | |||
| 351 | enum ppc_coff_reloc_type { | ||
| 352 | IMAGE_REL_PPC_ABSOLUTE, | ||
| 353 | IMAGE_REL_PPC_ADDR64, | ||
| 354 | IMAGE_REL_PPC_ADDR32, | ||
| 355 | IMAGE_REL_PPC_ADDR24, | ||
| 356 | IMAGE_REL_PPC_ADDR16, | ||
| 357 | IMAGE_REL_PPC_ADDR14, | ||
| 358 | IMAGE_REL_PPC_REL24, | ||
| 359 | IMAGE_REL_PPC_REL14, | ||
| 360 | IMAGE_REL_PPC_ADDR32N, | ||
| 361 | IMAGE_REL_PPC_SECREL, | ||
| 362 | IMAGE_REL_PPC_SECTION, | ||
| 363 | IMAGE_REL_PPC_SECREL16, | ||
| 364 | IMAGE_REL_PPC_REFHI, | ||
| 365 | IMAGE_REL_PPC_REFLO, | ||
| 366 | IMAGE_REL_PPC_PAIR, | ||
| 367 | IMAGE_REL_PPC_SECRELLO, | ||
| 368 | IMAGE_REL_PPC_GPREL, | ||
| 369 | IMAGE_REL_PPC_TOKEN, | ||
| 370 | }; | ||
| 371 | |||
| 372 | enum x86_coff_reloc_type { | ||
| 373 | IMAGE_REL_I386_ABSOLUTE, | ||
| 374 | IMAGE_REL_I386_DIR16, | ||
| 375 | IMAGE_REL_I386_REL16, | ||
| 376 | IMAGE_REL_I386_DIR32, | ||
| 377 | IMAGE_REL_I386_DIR32NB, | ||
| 378 | IMAGE_REL_I386_SEG12, | ||
| 379 | IMAGE_REL_I386_SECTION, | ||
| 380 | IMAGE_REL_I386_SECREL, | ||
| 381 | IMAGE_REL_I386_TOKEN, | ||
| 382 | IMAGE_REL_I386_SECREL7, | ||
| 383 | IMAGE_REL_I386_REL32, | ||
| 384 | }; | ||
| 385 | |||
| 386 | enum ia64_coff_reloc_type { | ||
| 387 | IMAGE_REL_IA64_ABSOLUTE, | ||
| 388 | IMAGE_REL_IA64_IMM14, | ||
| 389 | IMAGE_REL_IA64_IMM22, | ||
| 390 | IMAGE_REL_IA64_IMM64, | ||
| 391 | IMAGE_REL_IA64_DIR32, | ||
| 392 | IMAGE_REL_IA64_DIR64, | ||
| 393 | IMAGE_REL_IA64_PCREL21B, | ||
| 394 | IMAGE_REL_IA64_PCREL21M, | ||
| 395 | IMAGE_REL_IA64_PCREL21F, | ||
| 396 | IMAGE_REL_IA64_GPREL22, | ||
| 397 | IMAGE_REL_IA64_LTOFF22, | ||
| 398 | IMAGE_REL_IA64_SECTION, | ||
| 399 | IMAGE_REL_IA64_SECREL22, | ||
| 400 | IMAGE_REL_IA64_SECREL64I, | ||
| 401 | IMAGE_REL_IA64_SECREL32, | ||
| 402 | IMAGE_REL_IA64_DIR32NB, | ||
| 403 | IMAGE_REL_IA64_SREL14, | ||
| 404 | IMAGE_REL_IA64_SREL22, | ||
| 405 | IMAGE_REL_IA64_SREL32, | ||
| 406 | IMAGE_REL_IA64_UREL32, | ||
| 407 | IMAGE_REL_IA64_PCREL60X, | ||
| 408 | IMAGE_REL_IA64_PCREL60B, | ||
| 409 | IMAGE_REL_IA64_PCREL60F, | ||
| 410 | IMAGE_REL_IA64_PCREL60I, | ||
| 411 | IMAGE_REL_IA64_PCREL60M, | ||
| 412 | IMAGE_REL_IA64_IMMGPREL6, | ||
| 413 | IMAGE_REL_IA64_TOKEN, | ||
| 414 | IMAGE_REL_IA64_GPREL32, | ||
| 415 | IMAGE_REL_IA64_ADDEND, | ||
| 416 | }; | ||
| 417 | |||
| 418 | struct coff_reloc { | ||
| 419 | uint32_t virtual_address; | ||
| 420 | uint32_t symbol_table_index; | ||
| 421 | union { | ||
| 422 | enum x64_coff_reloc_type x64_type; | ||
| 423 | enum arm_coff_reloc_type arm_type; | ||
| 424 | enum sh_coff_reloc_type sh_type; | ||
| 425 | enum ppc_coff_reloc_type ppc_type; | ||
| 426 | enum x86_coff_reloc_type x86_type; | ||
| 427 | enum ia64_coff_reloc_type ia64_type; | ||
| 428 | uint16_t data; | ||
| 429 | }; | ||
| 430 | }; | ||
| 431 | |||
| 432 | /* | ||
| 433 | * Definitions for the contents of the certs data block | ||
| 434 | */ | ||
| 435 | #define WIN_CERT_TYPE_PKCS_SIGNED_DATA 0x0002 | ||
| 436 | #define WIN_CERT_TYPE_EFI_OKCS115 0x0EF0 | ||
| 437 | #define WIN_CERT_TYPE_EFI_GUID 0x0EF1 | ||
| 438 | |||
| 439 | #define WIN_CERT_REVISION_1_0 0x0100 | ||
| 440 | #define WIN_CERT_REVISION_2_0 0x0200 | ||
| 441 | |||
| 442 | struct win_certificate { | ||
| 443 | uint32_t length; | ||
| 444 | uint16_t revision; | ||
| 445 | uint16_t cert_type; | ||
| 446 | }; | ||
| 447 | |||
| 448 | #endif /* __LINUX_PE_H */ | ||
diff --git a/include/linux/percpu-defs.h b/include/linux/percpu-defs.h index dec01d6c3f80..cfd56046ecec 100644 --- a/include/linux/percpu-defs.h +++ b/include/linux/percpu-defs.h | |||
| @@ -1,6 +1,40 @@ | |||
| 1 | /* | ||
| 2 | * linux/percpu-defs.h - basic definitions for percpu areas | ||
| 3 | * | ||
| 4 | * DO NOT INCLUDE DIRECTLY OUTSIDE PERCPU IMPLEMENTATION PROPER. | ||
| 5 | * | ||
| 6 | * This file is separate from linux/percpu.h to avoid cyclic inclusion | ||
| 7 | * dependency from arch header files. Only to be included from | ||
| 8 | * asm/percpu.h. | ||
| 9 | * | ||
| 10 | * This file includes macros necessary to declare percpu sections and | ||
| 11 | * variables, and definitions of percpu accessors and operations. It | ||
| 12 | * should provide enough percpu features to arch header files even when | ||
| 13 | * they can only include asm/percpu.h to avoid cyclic inclusion dependency. | ||
| 14 | */ | ||
| 15 | |||
| 1 | #ifndef _LINUX_PERCPU_DEFS_H | 16 | #ifndef _LINUX_PERCPU_DEFS_H |
| 2 | #define _LINUX_PERCPU_DEFS_H | 17 | #define _LINUX_PERCPU_DEFS_H |
| 3 | 18 | ||
| 19 | #ifdef CONFIG_SMP | ||
| 20 | |||
| 21 | #ifdef MODULE | ||
| 22 | #define PER_CPU_SHARED_ALIGNED_SECTION "" | ||
| 23 | #define PER_CPU_ALIGNED_SECTION "" | ||
| 24 | #else | ||
| 25 | #define PER_CPU_SHARED_ALIGNED_SECTION "..shared_aligned" | ||
| 26 | #define PER_CPU_ALIGNED_SECTION "..shared_aligned" | ||
| 27 | #endif | ||
| 28 | #define PER_CPU_FIRST_SECTION "..first" | ||
| 29 | |||
| 30 | #else | ||
| 31 | |||
| 32 | #define PER_CPU_SHARED_ALIGNED_SECTION "" | ||
| 33 | #define PER_CPU_ALIGNED_SECTION "..shared_aligned" | ||
| 34 | #define PER_CPU_FIRST_SECTION "" | ||
| 35 | |||
| 36 | #endif | ||
| 37 | |||
| 4 | /* | 38 | /* |
| 5 | * Base implementations of per-CPU variable declarations and definitions, where | 39 | * Base implementations of per-CPU variable declarations and definitions, where |
| 6 | * the section in which the variable is to be placed is provided by the | 40 | * the section in which the variable is to be placed is provided by the |
| @@ -19,19 +53,6 @@ | |||
| 19 | __attribute__((section(".discard"), unused)) | 53 | __attribute__((section(".discard"), unused)) |
| 20 | 54 | ||
| 21 | /* | 55 | /* |
| 22 | * Macro which verifies @ptr is a percpu pointer without evaluating | ||
| 23 | * @ptr. This is to be used in percpu accessors to verify that the | ||
| 24 | * input parameter is a percpu pointer. | ||
| 25 | * | ||
| 26 | * + 0 is required in order to convert the pointer type from a | ||
| 27 | * potential array type to a pointer to a single item of the array. | ||
| 28 | */ | ||
| 29 | #define __verify_pcpu_ptr(ptr) do { \ | ||
| 30 | const void __percpu *__vpp_verify = (typeof((ptr) + 0))NULL; \ | ||
| 31 | (void)__vpp_verify; \ | ||
| 32 | } while (0) | ||
| 33 | |||
| 34 | /* | ||
| 35 | * s390 and alpha modules require percpu variables to be defined as | 56 | * s390 and alpha modules require percpu variables to be defined as |
| 36 | * weak to force the compiler to generate GOT based external | 57 | * weak to force the compiler to generate GOT based external |
| 37 | * references for them. This is necessary because percpu sections | 58 | * references for them. This is necessary because percpu sections |
| @@ -164,4 +185,337 @@ | |||
| 164 | #define EXPORT_PER_CPU_SYMBOL_GPL(var) | 185 | #define EXPORT_PER_CPU_SYMBOL_GPL(var) |
| 165 | #endif | 186 | #endif |
| 166 | 187 | ||
| 188 | /* | ||
| 189 | * Accessors and operations. | ||
| 190 | */ | ||
| 191 | #ifndef __ASSEMBLY__ | ||
| 192 | |||
| 193 | /* | ||
| 194 | * __verify_pcpu_ptr() verifies @ptr is a percpu pointer without evaluating | ||
| 195 | * @ptr and is invoked once before a percpu area is accessed by all | ||
| 196 | * accessors and operations. This is performed in the generic part of | ||
| 197 | * percpu and arch overrides don't need to worry about it; however, if an | ||
| 198 | * arch wants to implement an arch-specific percpu accessor or operation, | ||
| 199 | * it may use __verify_pcpu_ptr() to verify the parameters. | ||
| 200 | * | ||
| 201 | * + 0 is required in order to convert the pointer type from a | ||
| 202 | * potential array type to a pointer to a single item of the array. | ||
| 203 | */ | ||
| 204 | #define __verify_pcpu_ptr(ptr) \ | ||
| 205 | do { \ | ||
| 206 | const void __percpu *__vpp_verify = (typeof((ptr) + 0))NULL; \ | ||
| 207 | (void)__vpp_verify; \ | ||
| 208 | } while (0) | ||
| 209 | |||
| 210 | #ifdef CONFIG_SMP | ||
| 211 | |||
| 212 | /* | ||
| 213 | * Add an offset to a pointer but keep the pointer as-is. Use RELOC_HIDE() | ||
| 214 | * to prevent the compiler from making incorrect assumptions about the | ||
| 215 | * pointer value. The weird cast keeps both GCC and sparse happy. | ||
| 216 | */ | ||
| 217 | #define SHIFT_PERCPU_PTR(__p, __offset) \ | ||
| 218 | RELOC_HIDE((typeof(*(__p)) __kernel __force *)(__p), (__offset)) | ||
| 219 | |||
| 220 | #define per_cpu_ptr(ptr, cpu) \ | ||
| 221 | ({ \ | ||
| 222 | __verify_pcpu_ptr(ptr); \ | ||
| 223 | SHIFT_PERCPU_PTR((ptr), per_cpu_offset((cpu))); \ | ||
| 224 | }) | ||
| 225 | |||
| 226 | #define raw_cpu_ptr(ptr) \ | ||
| 227 | ({ \ | ||
| 228 | __verify_pcpu_ptr(ptr); \ | ||
| 229 | arch_raw_cpu_ptr(ptr); \ | ||
| 230 | }) | ||
| 231 | |||
| 232 | #ifdef CONFIG_DEBUG_PREEMPT | ||
| 233 | #define this_cpu_ptr(ptr) \ | ||
| 234 | ({ \ | ||
| 235 | __verify_pcpu_ptr(ptr); \ | ||
| 236 | SHIFT_PERCPU_PTR(ptr, my_cpu_offset); \ | ||
| 237 | }) | ||
| 238 | #else | ||
| 239 | #define this_cpu_ptr(ptr) raw_cpu_ptr(ptr) | ||
| 240 | #endif | ||
| 241 | |||
| 242 | #else /* CONFIG_SMP */ | ||
| 243 | |||
| 244 | #define VERIFY_PERCPU_PTR(__p) \ | ||
| 245 | ({ \ | ||
| 246 | __verify_pcpu_ptr(__p); \ | ||
| 247 | (typeof(*(__p)) __kernel __force *)(__p); \ | ||
| 248 | }) | ||
| 249 | |||
| 250 | #define per_cpu_ptr(ptr, cpu) ({ (void)(cpu); VERIFY_PERCPU_PTR(ptr); }) | ||
| 251 | #define raw_cpu_ptr(ptr) per_cpu_ptr(ptr, 0) | ||
| 252 | #define this_cpu_ptr(ptr) raw_cpu_ptr(ptr) | ||
| 253 | |||
| 254 | #endif /* CONFIG_SMP */ | ||
| 255 | |||
| 256 | #define per_cpu(var, cpu) (*per_cpu_ptr(&(var), cpu)) | ||
| 257 | #define __raw_get_cpu_var(var) (*raw_cpu_ptr(&(var))) | ||
| 258 | #define __get_cpu_var(var) (*this_cpu_ptr(&(var))) | ||
| 259 | |||
| 260 | /* keep until we have removed all uses of __this_cpu_ptr */ | ||
| 261 | #define __this_cpu_ptr(ptr) raw_cpu_ptr(ptr) | ||
| 262 | |||
| 263 | /* | ||
| 264 | * Must be an lvalue. Since @var must be a simple identifier, | ||
| 265 | * we force a syntax error here if it isn't. | ||
| 266 | */ | ||
| 267 | #define get_cpu_var(var) \ | ||
| 268 | (*({ \ | ||
| 269 | preempt_disable(); \ | ||
| 270 | this_cpu_ptr(&var); \ | ||
| 271 | })) | ||
| 272 | |||
| 273 | /* | ||
| 274 | * The weird & is necessary because sparse considers (void)(var) to be | ||
| 275 | * a direct dereference of percpu variable (var). | ||
| 276 | */ | ||
| 277 | #define put_cpu_var(var) \ | ||
| 278 | do { \ | ||
| 279 | (void)&(var); \ | ||
| 280 | preempt_enable(); \ | ||
| 281 | } while (0) | ||
| 282 | |||
| 283 | #define get_cpu_ptr(var) \ | ||
| 284 | ({ \ | ||
| 285 | preempt_disable(); \ | ||
| 286 | this_cpu_ptr(var); \ | ||
| 287 | }) | ||
| 288 | |||
| 289 | #define put_cpu_ptr(var) \ | ||
| 290 | do { \ | ||
| 291 | (void)(var); \ | ||
| 292 | preempt_enable(); \ | ||
| 293 | } while (0) | ||
| 294 | |||
| 295 | /* | ||
| 296 | * Branching function to split up a function into a set of functions that | ||
| 297 | * are called for different scalar sizes of the objects handled. | ||
| 298 | */ | ||
| 299 | |||
| 300 | extern void __bad_size_call_parameter(void); | ||
| 301 | |||
| 302 | #ifdef CONFIG_DEBUG_PREEMPT | ||
| 303 | extern void __this_cpu_preempt_check(const char *op); | ||
| 304 | #else | ||
| 305 | static inline void __this_cpu_preempt_check(const char *op) { } | ||
| 306 | #endif | ||
| 307 | |||
| 308 | #define __pcpu_size_call_return(stem, variable) \ | ||
| 309 | ({ \ | ||
| 310 | typeof(variable) pscr_ret__; \ | ||
| 311 | __verify_pcpu_ptr(&(variable)); \ | ||
| 312 | switch(sizeof(variable)) { \ | ||
| 313 | case 1: pscr_ret__ = stem##1(variable); break; \ | ||
| 314 | case 2: pscr_ret__ = stem##2(variable); break; \ | ||
| 315 | case 4: pscr_ret__ = stem##4(variable); break; \ | ||
| 316 | case 8: pscr_ret__ = stem##8(variable); break; \ | ||
| 317 | default: \ | ||
| 318 | __bad_size_call_parameter(); break; \ | ||
| 319 | } \ | ||
| 320 | pscr_ret__; \ | ||
| 321 | }) | ||
| 322 | |||
| 323 | #define __pcpu_size_call_return2(stem, variable, ...) \ | ||
| 324 | ({ \ | ||
| 325 | typeof(variable) pscr2_ret__; \ | ||
| 326 | __verify_pcpu_ptr(&(variable)); \ | ||
| 327 | switch(sizeof(variable)) { \ | ||
| 328 | case 1: pscr2_ret__ = stem##1(variable, __VA_ARGS__); break; \ | ||
| 329 | case 2: pscr2_ret__ = stem##2(variable, __VA_ARGS__); break; \ | ||
| 330 | case 4: pscr2_ret__ = stem##4(variable, __VA_ARGS__); break; \ | ||
| 331 | case 8: pscr2_ret__ = stem##8(variable, __VA_ARGS__); break; \ | ||
| 332 | default: \ | ||
| 333 | __bad_size_call_parameter(); break; \ | ||
| 334 | } \ | ||
| 335 | pscr2_ret__; \ | ||
| 336 | }) | ||
| 337 | |||
| 338 | /* | ||
| 339 | * Special handling for cmpxchg_double. cmpxchg_double is passed two | ||
| 340 | * percpu variables. The first has to be aligned to a double word | ||
| 341 | * boundary and the second has to follow directly thereafter. | ||
| 342 | * We enforce this on all architectures even if they don't support | ||
| 343 | * a double cmpxchg instruction, since it's a cheap requirement, and it | ||
| 344 | * avoids breaking the requirement for architectures with the instruction. | ||
| 345 | */ | ||
| 346 | #define __pcpu_double_call_return_bool(stem, pcp1, pcp2, ...) \ | ||
| 347 | ({ \ | ||
| 348 | bool pdcrb_ret__; \ | ||
| 349 | __verify_pcpu_ptr(&(pcp1)); \ | ||
| 350 | BUILD_BUG_ON(sizeof(pcp1) != sizeof(pcp2)); \ | ||
| 351 | VM_BUG_ON((unsigned long)(&(pcp1)) % (2 * sizeof(pcp1))); \ | ||
| 352 | VM_BUG_ON((unsigned long)(&(pcp2)) != \ | ||
| 353 | (unsigned long)(&(pcp1)) + sizeof(pcp1)); \ | ||
| 354 | switch(sizeof(pcp1)) { \ | ||
| 355 | case 1: pdcrb_ret__ = stem##1(pcp1, pcp2, __VA_ARGS__); break; \ | ||
| 356 | case 2: pdcrb_ret__ = stem##2(pcp1, pcp2, __VA_ARGS__); break; \ | ||
| 357 | case 4: pdcrb_ret__ = stem##4(pcp1, pcp2, __VA_ARGS__); break; \ | ||
| 358 | case 8: pdcrb_ret__ = stem##8(pcp1, pcp2, __VA_ARGS__); break; \ | ||
| 359 | default: \ | ||
| 360 | __bad_size_call_parameter(); break; \ | ||
| 361 | } \ | ||
| 362 | pdcrb_ret__; \ | ||
| 363 | }) | ||
| 364 | |||
| 365 | #define __pcpu_size_call(stem, variable, ...) \ | ||
| 366 | do { \ | ||
| 367 | __verify_pcpu_ptr(&(variable)); \ | ||
| 368 | switch(sizeof(variable)) { \ | ||
| 369 | case 1: stem##1(variable, __VA_ARGS__);break; \ | ||
| 370 | case 2: stem##2(variable, __VA_ARGS__);break; \ | ||
| 371 | case 4: stem##4(variable, __VA_ARGS__);break; \ | ||
| 372 | case 8: stem##8(variable, __VA_ARGS__);break; \ | ||
| 373 | default: \ | ||
| 374 | __bad_size_call_parameter();break; \ | ||
| 375 | } \ | ||
| 376 | } while (0) | ||
| 377 | |||
| 378 | /* | ||
| 379 | * this_cpu operations (C) 2008-2013 Christoph Lameter <cl@linux.com> | ||
| 380 | * | ||
| 381 | * Optimized manipulation for memory allocated through the per cpu | ||
| 382 | * allocator or for addresses of per cpu variables. | ||
| 383 | * | ||
| 384 | * These operation guarantee exclusivity of access for other operations | ||
| 385 | * on the *same* processor. The assumption is that per cpu data is only | ||
| 386 | * accessed by a single processor instance (the current one). | ||
| 387 | * | ||
| 388 | * The arch code can provide optimized implementation by defining macros | ||
| 389 | * for certain scalar sizes. F.e. provide this_cpu_add_2() to provide per | ||
| 390 | * cpu atomic operations for 2 byte sized RMW actions. If arch code does | ||
| 391 | * not provide operations for a scalar size then the fallback in the | ||
| 392 | * generic code will be used. | ||
| 393 | * | ||
| 394 | * cmpxchg_double replaces two adjacent scalars at once. The first two | ||
| 395 | * parameters are per cpu variables which have to be of the same size. A | ||
| 396 | * truth value is returned to indicate success or failure (since a double | ||
| 397 | * register result is difficult to handle). There is very limited hardware | ||
| 398 | * support for these operations, so only certain sizes may work. | ||
| 399 | */ | ||
| 400 | |||
| 401 | /* | ||
| 402 | * Operations for contexts where we do not want to do any checks for | ||
| 403 | * preemptions. Unless strictly necessary, always use [__]this_cpu_*() | ||
| 404 | * instead. | ||
| 405 | * | ||
| 406 | * If there is no other protection through preempt disable and/or disabling | ||
| 407 | * interupts then one of these RMW operations can show unexpected behavior | ||
| 408 | * because the execution thread was rescheduled on another processor or an | ||
| 409 | * interrupt occurred and the same percpu variable was modified from the | ||
| 410 | * interrupt context. | ||
| 411 | */ | ||
| 412 | #define raw_cpu_read(pcp) __pcpu_size_call_return(raw_cpu_read_, pcp) | ||
| 413 | #define raw_cpu_write(pcp, val) __pcpu_size_call(raw_cpu_write_, pcp, val) | ||
| 414 | #define raw_cpu_add(pcp, val) __pcpu_size_call(raw_cpu_add_, pcp, val) | ||
| 415 | #define raw_cpu_and(pcp, val) __pcpu_size_call(raw_cpu_and_, pcp, val) | ||
| 416 | #define raw_cpu_or(pcp, val) __pcpu_size_call(raw_cpu_or_, pcp, val) | ||
| 417 | #define raw_cpu_add_return(pcp, val) __pcpu_size_call_return2(raw_cpu_add_return_, pcp, val) | ||
| 418 | #define raw_cpu_xchg(pcp, nval) __pcpu_size_call_return2(raw_cpu_xchg_, pcp, nval) | ||
| 419 | #define raw_cpu_cmpxchg(pcp, oval, nval) \ | ||
| 420 | __pcpu_size_call_return2(raw_cpu_cmpxchg_, pcp, oval, nval) | ||
| 421 | #define raw_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \ | ||
| 422 | __pcpu_double_call_return_bool(raw_cpu_cmpxchg_double_, pcp1, pcp2, oval1, oval2, nval1, nval2) | ||
| 423 | |||
| 424 | #define raw_cpu_sub(pcp, val) raw_cpu_add(pcp, -(val)) | ||
| 425 | #define raw_cpu_inc(pcp) raw_cpu_add(pcp, 1) | ||
| 426 | #define raw_cpu_dec(pcp) raw_cpu_sub(pcp, 1) | ||
| 427 | #define raw_cpu_sub_return(pcp, val) raw_cpu_add_return(pcp, -(typeof(pcp))(val)) | ||
| 428 | #define raw_cpu_inc_return(pcp) raw_cpu_add_return(pcp, 1) | ||
| 429 | #define raw_cpu_dec_return(pcp) raw_cpu_add_return(pcp, -1) | ||
| 430 | |||
| 431 | /* | ||
| 432 | * Operations for contexts that are safe from preemption/interrupts. These | ||
| 433 | * operations verify that preemption is disabled. | ||
| 434 | */ | ||
| 435 | #define __this_cpu_read(pcp) \ | ||
| 436 | ({ \ | ||
| 437 | __this_cpu_preempt_check("read"); \ | ||
| 438 | raw_cpu_read(pcp); \ | ||
| 439 | }) | ||
| 440 | |||
| 441 | #define __this_cpu_write(pcp, val) \ | ||
| 442 | ({ \ | ||
| 443 | __this_cpu_preempt_check("write"); \ | ||
| 444 | raw_cpu_write(pcp, val); \ | ||
| 445 | }) | ||
| 446 | |||
| 447 | #define __this_cpu_add(pcp, val) \ | ||
| 448 | ({ \ | ||
| 449 | __this_cpu_preempt_check("add"); \ | ||
| 450 | raw_cpu_add(pcp, val); \ | ||
| 451 | }) | ||
| 452 | |||
| 453 | #define __this_cpu_and(pcp, val) \ | ||
| 454 | ({ \ | ||
| 455 | __this_cpu_preempt_check("and"); \ | ||
| 456 | raw_cpu_and(pcp, val); \ | ||
| 457 | }) | ||
| 458 | |||
| 459 | #define __this_cpu_or(pcp, val) \ | ||
| 460 | ({ \ | ||
| 461 | __this_cpu_preempt_check("or"); \ | ||
| 462 | raw_cpu_or(pcp, val); \ | ||
| 463 | }) | ||
| 464 | |||
| 465 | #define __this_cpu_add_return(pcp, val) \ | ||
| 466 | ({ \ | ||
| 467 | __this_cpu_preempt_check("add_return"); \ | ||
| 468 | raw_cpu_add_return(pcp, val); \ | ||
| 469 | }) | ||
| 470 | |||
| 471 | #define __this_cpu_xchg(pcp, nval) \ | ||
| 472 | ({ \ | ||
| 473 | __this_cpu_preempt_check("xchg"); \ | ||
| 474 | raw_cpu_xchg(pcp, nval); \ | ||
| 475 | }) | ||
| 476 | |||
| 477 | #define __this_cpu_cmpxchg(pcp, oval, nval) \ | ||
| 478 | ({ \ | ||
| 479 | __this_cpu_preempt_check("cmpxchg"); \ | ||
| 480 | raw_cpu_cmpxchg(pcp, oval, nval); \ | ||
| 481 | }) | ||
| 482 | |||
| 483 | #define __this_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \ | ||
| 484 | ({ __this_cpu_preempt_check("cmpxchg_double"); \ | ||
| 485 | raw_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2); \ | ||
| 486 | }) | ||
| 487 | |||
| 488 | #define __this_cpu_sub(pcp, val) __this_cpu_add(pcp, -(typeof(pcp))(val)) | ||
| 489 | #define __this_cpu_inc(pcp) __this_cpu_add(pcp, 1) | ||
| 490 | #define __this_cpu_dec(pcp) __this_cpu_sub(pcp, 1) | ||
| 491 | #define __this_cpu_sub_return(pcp, val) __this_cpu_add_return(pcp, -(typeof(pcp))(val)) | ||
| 492 | #define __this_cpu_inc_return(pcp) __this_cpu_add_return(pcp, 1) | ||
| 493 | #define __this_cpu_dec_return(pcp) __this_cpu_add_return(pcp, -1) | ||
| 494 | |||
| 495 | /* | ||
| 496 | * Operations with implied preemption protection. These operations can be | ||
| 497 | * used without worrying about preemption. Note that interrupts may still | ||
| 498 | * occur while an operation is in progress and if the interrupt modifies | ||
| 499 | * the variable too then RMW actions may not be reliable. | ||
| 500 | */ | ||
| 501 | #define this_cpu_read(pcp) __pcpu_size_call_return(this_cpu_read_, pcp) | ||
| 502 | #define this_cpu_write(pcp, val) __pcpu_size_call(this_cpu_write_, pcp, val) | ||
| 503 | #define this_cpu_add(pcp, val) __pcpu_size_call(this_cpu_add_, pcp, val) | ||
| 504 | #define this_cpu_and(pcp, val) __pcpu_size_call(this_cpu_and_, pcp, val) | ||
| 505 | #define this_cpu_or(pcp, val) __pcpu_size_call(this_cpu_or_, pcp, val) | ||
| 506 | #define this_cpu_add_return(pcp, val) __pcpu_size_call_return2(this_cpu_add_return_, pcp, val) | ||
| 507 | #define this_cpu_xchg(pcp, nval) __pcpu_size_call_return2(this_cpu_xchg_, pcp, nval) | ||
| 508 | #define this_cpu_cmpxchg(pcp, oval, nval) \ | ||
| 509 | __pcpu_size_call_return2(this_cpu_cmpxchg_, pcp, oval, nval) | ||
| 510 | #define this_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \ | ||
| 511 | __pcpu_double_call_return_bool(this_cpu_cmpxchg_double_, pcp1, pcp2, oval1, oval2, nval1, nval2) | ||
| 512 | |||
| 513 | #define this_cpu_sub(pcp, val) this_cpu_add(pcp, -(typeof(pcp))(val)) | ||
| 514 | #define this_cpu_inc(pcp) this_cpu_add(pcp, 1) | ||
| 515 | #define this_cpu_dec(pcp) this_cpu_sub(pcp, 1) | ||
| 516 | #define this_cpu_sub_return(pcp, val) this_cpu_add_return(pcp, -(typeof(pcp))(val)) | ||
| 517 | #define this_cpu_inc_return(pcp) this_cpu_add_return(pcp, 1) | ||
| 518 | #define this_cpu_dec_return(pcp) this_cpu_add_return(pcp, -1) | ||
| 519 | |||
| 520 | #endif /* __ASSEMBLY__ */ | ||
| 167 | #endif /* _LINUX_PERCPU_DEFS_H */ | 521 | #endif /* _LINUX_PERCPU_DEFS_H */ |
diff --git a/include/linux/percpu-refcount.h b/include/linux/percpu-refcount.h index 5d8920e23073..3dfbf237cd8f 100644 --- a/include/linux/percpu-refcount.h +++ b/include/linux/percpu-refcount.h | |||
| @@ -57,11 +57,9 @@ struct percpu_ref { | |||
| 57 | atomic_t count; | 57 | atomic_t count; |
| 58 | /* | 58 | /* |
| 59 | * The low bit of the pointer indicates whether the ref is in percpu | 59 | * The low bit of the pointer indicates whether the ref is in percpu |
| 60 | * mode; if set, then get/put will manipulate the atomic_t (this is a | 60 | * mode; if set, then get/put will manipulate the atomic_t. |
| 61 | * hack because we need to keep the pointer around for | ||
| 62 | * percpu_ref_kill_rcu()) | ||
| 63 | */ | 61 | */ |
| 64 | unsigned __percpu *pcpu_count; | 62 | unsigned long pcpu_count_ptr; |
| 65 | percpu_ref_func_t *release; | 63 | percpu_ref_func_t *release; |
| 66 | percpu_ref_func_t *confirm_kill; | 64 | percpu_ref_func_t *confirm_kill; |
| 67 | struct rcu_head rcu; | 65 | struct rcu_head rcu; |
| @@ -69,7 +67,8 @@ struct percpu_ref { | |||
| 69 | 67 | ||
| 70 | int __must_check percpu_ref_init(struct percpu_ref *ref, | 68 | int __must_check percpu_ref_init(struct percpu_ref *ref, |
| 71 | percpu_ref_func_t *release); | 69 | percpu_ref_func_t *release); |
| 72 | void percpu_ref_cancel_init(struct percpu_ref *ref); | 70 | void percpu_ref_reinit(struct percpu_ref *ref); |
| 71 | void percpu_ref_exit(struct percpu_ref *ref); | ||
| 73 | void percpu_ref_kill_and_confirm(struct percpu_ref *ref, | 72 | void percpu_ref_kill_and_confirm(struct percpu_ref *ref, |
| 74 | percpu_ref_func_t *confirm_kill); | 73 | percpu_ref_func_t *confirm_kill); |
| 75 | 74 | ||
| @@ -88,12 +87,28 @@ static inline void percpu_ref_kill(struct percpu_ref *ref) | |||
| 88 | return percpu_ref_kill_and_confirm(ref, NULL); | 87 | return percpu_ref_kill_and_confirm(ref, NULL); |
| 89 | } | 88 | } |
| 90 | 89 | ||
| 91 | #define PCPU_STATUS_BITS 2 | ||
| 92 | #define PCPU_STATUS_MASK ((1 << PCPU_STATUS_BITS) - 1) | ||
| 93 | #define PCPU_REF_PTR 0 | ||
| 94 | #define PCPU_REF_DEAD 1 | 90 | #define PCPU_REF_DEAD 1 |
| 95 | 91 | ||
| 96 | #define REF_STATUS(count) (((unsigned long) count) & PCPU_STATUS_MASK) | 92 | /* |
| 93 | * Internal helper. Don't use outside percpu-refcount proper. The | ||
| 94 | * function doesn't return the pointer and let the caller test it for NULL | ||
| 95 | * because doing so forces the compiler to generate two conditional | ||
| 96 | * branches as it can't assume that @ref->pcpu_count is not NULL. | ||
| 97 | */ | ||
| 98 | static inline bool __pcpu_ref_alive(struct percpu_ref *ref, | ||
| 99 | unsigned __percpu **pcpu_countp) | ||
| 100 | { | ||
| 101 | unsigned long pcpu_ptr = ACCESS_ONCE(ref->pcpu_count_ptr); | ||
| 102 | |||
| 103 | /* paired with smp_store_release() in percpu_ref_reinit() */ | ||
| 104 | smp_read_barrier_depends(); | ||
| 105 | |||
| 106 | if (unlikely(pcpu_ptr & PCPU_REF_DEAD)) | ||
| 107 | return false; | ||
| 108 | |||
| 109 | *pcpu_countp = (unsigned __percpu *)pcpu_ptr; | ||
| 110 | return true; | ||
| 111 | } | ||
| 97 | 112 | ||
| 98 | /** | 113 | /** |
| 99 | * percpu_ref_get - increment a percpu refcount | 114 | * percpu_ref_get - increment a percpu refcount |
| @@ -107,9 +122,7 @@ static inline void percpu_ref_get(struct percpu_ref *ref) | |||
| 107 | 122 | ||
| 108 | rcu_read_lock_sched(); | 123 | rcu_read_lock_sched(); |
| 109 | 124 | ||
| 110 | pcpu_count = ACCESS_ONCE(ref->pcpu_count); | 125 | if (__pcpu_ref_alive(ref, &pcpu_count)) |
| 111 | |||
| 112 | if (likely(REF_STATUS(pcpu_count) == PCPU_REF_PTR)) | ||
| 113 | this_cpu_inc(*pcpu_count); | 126 | this_cpu_inc(*pcpu_count); |
| 114 | else | 127 | else |
| 115 | atomic_inc(&ref->count); | 128 | atomic_inc(&ref->count); |
| @@ -133,9 +146,7 @@ static inline bool percpu_ref_tryget(struct percpu_ref *ref) | |||
| 133 | 146 | ||
| 134 | rcu_read_lock_sched(); | 147 | rcu_read_lock_sched(); |
| 135 | 148 | ||
| 136 | pcpu_count = ACCESS_ONCE(ref->pcpu_count); | 149 | if (__pcpu_ref_alive(ref, &pcpu_count)) { |
| 137 | |||
| 138 | if (likely(REF_STATUS(pcpu_count) == PCPU_REF_PTR)) { | ||
| 139 | this_cpu_inc(*pcpu_count); | 150 | this_cpu_inc(*pcpu_count); |
| 140 | ret = true; | 151 | ret = true; |
| 141 | } else { | 152 | } else { |
| @@ -168,9 +179,7 @@ static inline bool percpu_ref_tryget_live(struct percpu_ref *ref) | |||
| 168 | 179 | ||
| 169 | rcu_read_lock_sched(); | 180 | rcu_read_lock_sched(); |
| 170 | 181 | ||
| 171 | pcpu_count = ACCESS_ONCE(ref->pcpu_count); | 182 | if (__pcpu_ref_alive(ref, &pcpu_count)) { |
| 172 | |||
| 173 | if (likely(REF_STATUS(pcpu_count) == PCPU_REF_PTR)) { | ||
| 174 | this_cpu_inc(*pcpu_count); | 183 | this_cpu_inc(*pcpu_count); |
| 175 | ret = true; | 184 | ret = true; |
| 176 | } | 185 | } |
| @@ -193,9 +202,7 @@ static inline void percpu_ref_put(struct percpu_ref *ref) | |||
| 193 | 202 | ||
| 194 | rcu_read_lock_sched(); | 203 | rcu_read_lock_sched(); |
| 195 | 204 | ||
| 196 | pcpu_count = ACCESS_ONCE(ref->pcpu_count); | 205 | if (__pcpu_ref_alive(ref, &pcpu_count)) |
| 197 | |||
| 198 | if (likely(REF_STATUS(pcpu_count) == PCPU_REF_PTR)) | ||
| 199 | this_cpu_dec(*pcpu_count); | 206 | this_cpu_dec(*pcpu_count); |
| 200 | else if (unlikely(atomic_dec_and_test(&ref->count))) | 207 | else if (unlikely(atomic_dec_and_test(&ref->count))) |
| 201 | ref->release(ref); | 208 | ref->release(ref); |
| @@ -203,4 +210,19 @@ static inline void percpu_ref_put(struct percpu_ref *ref) | |||
| 203 | rcu_read_unlock_sched(); | 210 | rcu_read_unlock_sched(); |
| 204 | } | 211 | } |
| 205 | 212 | ||
| 213 | /** | ||
| 214 | * percpu_ref_is_zero - test whether a percpu refcount reached zero | ||
| 215 | * @ref: percpu_ref to test | ||
| 216 | * | ||
| 217 | * Returns %true if @ref reached zero. | ||
| 218 | */ | ||
| 219 | static inline bool percpu_ref_is_zero(struct percpu_ref *ref) | ||
| 220 | { | ||
| 221 | unsigned __percpu *pcpu_count; | ||
| 222 | |||
| 223 | if (__pcpu_ref_alive(ref, &pcpu_count)) | ||
| 224 | return false; | ||
| 225 | return !atomic_read(&ref->count); | ||
| 226 | } | ||
| 227 | |||
| 206 | #endif | 228 | #endif |
diff --git a/include/linux/percpu.h b/include/linux/percpu.h index 8419053d0f2e..6f61b61b7996 100644 --- a/include/linux/percpu.h +++ b/include/linux/percpu.h | |||
| @@ -23,32 +23,6 @@ | |||
| 23 | PERCPU_MODULE_RESERVE) | 23 | PERCPU_MODULE_RESERVE) |
| 24 | #endif | 24 | #endif |
| 25 | 25 | ||
| 26 | /* | ||
| 27 | * Must be an lvalue. Since @var must be a simple identifier, | ||
| 28 | * we force a syntax error here if it isn't. | ||
| 29 | */ | ||
| 30 | #define get_cpu_var(var) (*({ \ | ||
| 31 | preempt_disable(); \ | ||
| 32 | this_cpu_ptr(&var); })) | ||
| 33 | |||
| 34 | /* | ||
| 35 | * The weird & is necessary because sparse considers (void)(var) to be | ||
| 36 | * a direct dereference of percpu variable (var). | ||
| 37 | */ | ||
| 38 | #define put_cpu_var(var) do { \ | ||
| 39 | (void)&(var); \ | ||
| 40 | preempt_enable(); \ | ||
| 41 | } while (0) | ||
| 42 | |||
| 43 | #define get_cpu_ptr(var) ({ \ | ||
| 44 | preempt_disable(); \ | ||
| 45 | this_cpu_ptr(var); }) | ||
| 46 | |||
| 47 | #define put_cpu_ptr(var) do { \ | ||
| 48 | (void)(var); \ | ||
| 49 | preempt_enable(); \ | ||
| 50 | } while (0) | ||
| 51 | |||
| 52 | /* minimum unit size, also is the maximum supported allocation size */ | 26 | /* minimum unit size, also is the maximum supported allocation size */ |
| 53 | #define PCPU_MIN_UNIT_SIZE PFN_ALIGN(32 << 10) | 27 | #define PCPU_MIN_UNIT_SIZE PFN_ALIGN(32 << 10) |
| 54 | 28 | ||
| @@ -140,17 +114,6 @@ extern int __init pcpu_page_first_chunk(size_t reserved_size, | |||
| 140 | pcpu_fc_populate_pte_fn_t populate_pte_fn); | 114 | pcpu_fc_populate_pte_fn_t populate_pte_fn); |
| 141 | #endif | 115 | #endif |
| 142 | 116 | ||
| 143 | /* | ||
| 144 | * Use this to get to a cpu's version of the per-cpu object | ||
| 145 | * dynamically allocated. Non-atomic access to the current CPU's | ||
| 146 | * version should probably be combined with get_cpu()/put_cpu(). | ||
| 147 | */ | ||
| 148 | #ifdef CONFIG_SMP | ||
| 149 | #define per_cpu_ptr(ptr, cpu) SHIFT_PERCPU_PTR((ptr), per_cpu_offset((cpu))) | ||
| 150 | #else | ||
| 151 | #define per_cpu_ptr(ptr, cpu) ({ (void)(cpu); VERIFY_PERCPU_PTR((ptr)); }) | ||
| 152 | #endif | ||
| 153 | |||
| 154 | extern void __percpu *__alloc_reserved_percpu(size_t size, size_t align); | 117 | extern void __percpu *__alloc_reserved_percpu(size_t size, size_t align); |
| 155 | extern bool is_kernel_percpu_address(unsigned long addr); | 118 | extern bool is_kernel_percpu_address(unsigned long addr); |
| 156 | 119 | ||
| @@ -166,640 +129,4 @@ extern phys_addr_t per_cpu_ptr_to_phys(void *addr); | |||
| 166 | #define alloc_percpu(type) \ | 129 | #define alloc_percpu(type) \ |
| 167 | (typeof(type) __percpu *)__alloc_percpu(sizeof(type), __alignof__(type)) | 130 | (typeof(type) __percpu *)__alloc_percpu(sizeof(type), __alignof__(type)) |
| 168 | 131 | ||
| 169 | /* | ||
| 170 | * Branching function to split up a function into a set of functions that | ||
| 171 | * are called for different scalar sizes of the objects handled. | ||
| 172 | */ | ||
| 173 | |||
| 174 | extern void __bad_size_call_parameter(void); | ||
| 175 | |||
| 176 | #ifdef CONFIG_DEBUG_PREEMPT | ||
| 177 | extern void __this_cpu_preempt_check(const char *op); | ||
| 178 | #else | ||
| 179 | static inline void __this_cpu_preempt_check(const char *op) { } | ||
| 180 | #endif | ||
| 181 | |||
| 182 | #define __pcpu_size_call_return(stem, variable) \ | ||
| 183 | ({ typeof(variable) pscr_ret__; \ | ||
| 184 | __verify_pcpu_ptr(&(variable)); \ | ||
| 185 | switch(sizeof(variable)) { \ | ||
| 186 | case 1: pscr_ret__ = stem##1(variable);break; \ | ||
| 187 | case 2: pscr_ret__ = stem##2(variable);break; \ | ||
| 188 | case 4: pscr_ret__ = stem##4(variable);break; \ | ||
| 189 | case 8: pscr_ret__ = stem##8(variable);break; \ | ||
| 190 | default: \ | ||
| 191 | __bad_size_call_parameter();break; \ | ||
| 192 | } \ | ||
| 193 | pscr_ret__; \ | ||
| 194 | }) | ||
| 195 | |||
| 196 | #define __pcpu_size_call_return2(stem, variable, ...) \ | ||
| 197 | ({ \ | ||
| 198 | typeof(variable) pscr2_ret__; \ | ||
| 199 | __verify_pcpu_ptr(&(variable)); \ | ||
| 200 | switch(sizeof(variable)) { \ | ||
| 201 | case 1: pscr2_ret__ = stem##1(variable, __VA_ARGS__); break; \ | ||
| 202 | case 2: pscr2_ret__ = stem##2(variable, __VA_ARGS__); break; \ | ||
| 203 | case 4: pscr2_ret__ = stem##4(variable, __VA_ARGS__); break; \ | ||
| 204 | case 8: pscr2_ret__ = stem##8(variable, __VA_ARGS__); break; \ | ||
| 205 | default: \ | ||
| 206 | __bad_size_call_parameter(); break; \ | ||
| 207 | } \ | ||
| 208 | pscr2_ret__; \ | ||
| 209 | }) | ||
| 210 | |||
| 211 | /* | ||
| 212 | * Special handling for cmpxchg_double. cmpxchg_double is passed two | ||
| 213 | * percpu variables. The first has to be aligned to a double word | ||
| 214 | * boundary and the second has to follow directly thereafter. | ||
| 215 | * We enforce this on all architectures even if they don't support | ||
| 216 | * a double cmpxchg instruction, since it's a cheap requirement, and it | ||
| 217 | * avoids breaking the requirement for architectures with the instruction. | ||
| 218 | */ | ||
| 219 | #define __pcpu_double_call_return_bool(stem, pcp1, pcp2, ...) \ | ||
| 220 | ({ \ | ||
| 221 | bool pdcrb_ret__; \ | ||
| 222 | __verify_pcpu_ptr(&pcp1); \ | ||
| 223 | BUILD_BUG_ON(sizeof(pcp1) != sizeof(pcp2)); \ | ||
| 224 | VM_BUG_ON((unsigned long)(&pcp1) % (2 * sizeof(pcp1))); \ | ||
| 225 | VM_BUG_ON((unsigned long)(&pcp2) != \ | ||
| 226 | (unsigned long)(&pcp1) + sizeof(pcp1)); \ | ||
| 227 | switch(sizeof(pcp1)) { \ | ||
| 228 | case 1: pdcrb_ret__ = stem##1(pcp1, pcp2, __VA_ARGS__); break; \ | ||
| 229 | case 2: pdcrb_ret__ = stem##2(pcp1, pcp2, __VA_ARGS__); break; \ | ||
| 230 | case 4: pdcrb_ret__ = stem##4(pcp1, pcp2, __VA_ARGS__); break; \ | ||
| 231 | case 8: pdcrb_ret__ = stem##8(pcp1, pcp2, __VA_ARGS__); break; \ | ||
| 232 | default: \ | ||
| 233 | __bad_size_call_parameter(); break; \ | ||
| 234 | } \ | ||
| 235 | pdcrb_ret__; \ | ||
| 236 | }) | ||
| 237 | |||
| 238 | #define __pcpu_size_call(stem, variable, ...) \ | ||
| 239 | do { \ | ||
| 240 | __verify_pcpu_ptr(&(variable)); \ | ||
| 241 | switch(sizeof(variable)) { \ | ||
| 242 | case 1: stem##1(variable, __VA_ARGS__);break; \ | ||
| 243 | case 2: stem##2(variable, __VA_ARGS__);break; \ | ||
| 244 | case 4: stem##4(variable, __VA_ARGS__);break; \ | ||
| 245 | case 8: stem##8(variable, __VA_ARGS__);break; \ | ||
| 246 | default: \ | ||
| 247 | __bad_size_call_parameter();break; \ | ||
| 248 | } \ | ||
| 249 | } while (0) | ||
| 250 | |||
| 251 | /* | ||
| 252 | * this_cpu operations (C) 2008-2013 Christoph Lameter <cl@linux.com> | ||
| 253 | * | ||
| 254 | * Optimized manipulation for memory allocated through the per cpu | ||
| 255 | * allocator or for addresses of per cpu variables. | ||
| 256 | * | ||
| 257 | * These operation guarantee exclusivity of access for other operations | ||
| 258 | * on the *same* processor. The assumption is that per cpu data is only | ||
| 259 | * accessed by a single processor instance (the current one). | ||
| 260 | * | ||
| 261 | * The first group is used for accesses that must be done in a | ||
| 262 | * preemption safe way since we know that the context is not preempt | ||
| 263 | * safe. Interrupts may occur. If the interrupt modifies the variable | ||
| 264 | * too then RMW actions will not be reliable. | ||
| 265 | * | ||
| 266 | * The arch code can provide optimized functions in two ways: | ||
| 267 | * | ||
| 268 | * 1. Override the function completely. F.e. define this_cpu_add(). | ||
| 269 | * The arch must then ensure that the various scalar format passed | ||
| 270 | * are handled correctly. | ||
| 271 | * | ||
| 272 | * 2. Provide functions for certain scalar sizes. F.e. provide | ||
| 273 | * this_cpu_add_2() to provide per cpu atomic operations for 2 byte | ||
| 274 | * sized RMW actions. If arch code does not provide operations for | ||
| 275 | * a scalar size then the fallback in the generic code will be | ||
| 276 | * used. | ||
| 277 | */ | ||
| 278 | |||
| 279 | #define _this_cpu_generic_read(pcp) \ | ||
| 280 | ({ typeof(pcp) ret__; \ | ||
| 281 | preempt_disable(); \ | ||
| 282 | ret__ = *this_cpu_ptr(&(pcp)); \ | ||
| 283 | preempt_enable(); \ | ||
| 284 | ret__; \ | ||
| 285 | }) | ||
| 286 | |||
| 287 | #ifndef this_cpu_read | ||
| 288 | # ifndef this_cpu_read_1 | ||
| 289 | # define this_cpu_read_1(pcp) _this_cpu_generic_read(pcp) | ||
| 290 | # endif | ||
| 291 | # ifndef this_cpu_read_2 | ||
| 292 | # define this_cpu_read_2(pcp) _this_cpu_generic_read(pcp) | ||
| 293 | # endif | ||
| 294 | # ifndef this_cpu_read_4 | ||
| 295 | # define this_cpu_read_4(pcp) _this_cpu_generic_read(pcp) | ||
| 296 | # endif | ||
| 297 | # ifndef this_cpu_read_8 | ||
| 298 | # define this_cpu_read_8(pcp) _this_cpu_generic_read(pcp) | ||
| 299 | # endif | ||
| 300 | # define this_cpu_read(pcp) __pcpu_size_call_return(this_cpu_read_, (pcp)) | ||
| 301 | #endif | ||
| 302 | |||
| 303 | #define _this_cpu_generic_to_op(pcp, val, op) \ | ||
| 304 | do { \ | ||
| 305 | unsigned long flags; \ | ||
| 306 | raw_local_irq_save(flags); \ | ||
| 307 | *raw_cpu_ptr(&(pcp)) op val; \ | ||
| 308 | raw_local_irq_restore(flags); \ | ||
| 309 | } while (0) | ||
| 310 | |||
| 311 | #ifndef this_cpu_write | ||
| 312 | # ifndef this_cpu_write_1 | ||
| 313 | # define this_cpu_write_1(pcp, val) _this_cpu_generic_to_op((pcp), (val), =) | ||
| 314 | # endif | ||
| 315 | # ifndef this_cpu_write_2 | ||
| 316 | # define this_cpu_write_2(pcp, val) _this_cpu_generic_to_op((pcp), (val), =) | ||
| 317 | # endif | ||
| 318 | # ifndef this_cpu_write_4 | ||
| 319 | # define this_cpu_write_4(pcp, val) _this_cpu_generic_to_op((pcp), (val), =) | ||
| 320 | # endif | ||
| 321 | # ifndef this_cpu_write_8 | ||
| 322 | # define this_cpu_write_8(pcp, val) _this_cpu_generic_to_op((pcp), (val), =) | ||
| 323 | # endif | ||
| 324 | # define this_cpu_write(pcp, val) __pcpu_size_call(this_cpu_write_, (pcp), (val)) | ||
| 325 | #endif | ||
| 326 | |||
| 327 | #ifndef this_cpu_add | ||
| 328 | # ifndef this_cpu_add_1 | ||
| 329 | # define this_cpu_add_1(pcp, val) _this_cpu_generic_to_op((pcp), (val), +=) | ||
| 330 | # endif | ||
| 331 | # ifndef this_cpu_add_2 | ||
| 332 | # define this_cpu_add_2(pcp, val) _this_cpu_generic_to_op((pcp), (val), +=) | ||
| 333 | # endif | ||
| 334 | # ifndef this_cpu_add_4 | ||
| 335 | # define this_cpu_add_4(pcp, val) _this_cpu_generic_to_op((pcp), (val), +=) | ||
| 336 | # endif | ||
| 337 | # ifndef this_cpu_add_8 | ||
| 338 | # define this_cpu_add_8(pcp, val) _this_cpu_generic_to_op((pcp), (val), +=) | ||
| 339 | # endif | ||
| 340 | # define this_cpu_add(pcp, val) __pcpu_size_call(this_cpu_add_, (pcp), (val)) | ||
| 341 | #endif | ||
| 342 | |||
| 343 | #ifndef this_cpu_sub | ||
| 344 | # define this_cpu_sub(pcp, val) this_cpu_add((pcp), -(typeof(pcp))(val)) | ||
| 345 | #endif | ||
| 346 | |||
| 347 | #ifndef this_cpu_inc | ||
| 348 | # define this_cpu_inc(pcp) this_cpu_add((pcp), 1) | ||
| 349 | #endif | ||
| 350 | |||
| 351 | #ifndef this_cpu_dec | ||
| 352 | # define this_cpu_dec(pcp) this_cpu_sub((pcp), 1) | ||
| 353 | #endif | ||
| 354 | |||
| 355 | #ifndef this_cpu_and | ||
| 356 | # ifndef this_cpu_and_1 | ||
| 357 | # define this_cpu_and_1(pcp, val) _this_cpu_generic_to_op((pcp), (val), &=) | ||
| 358 | # endif | ||
| 359 | # ifndef this_cpu_and_2 | ||
| 360 | # define this_cpu_and_2(pcp, val) _this_cpu_generic_to_op((pcp), (val), &=) | ||
| 361 | # endif | ||
| 362 | # ifndef this_cpu_and_4 | ||
| 363 | # define this_cpu_and_4(pcp, val) _this_cpu_generic_to_op((pcp), (val), &=) | ||
| 364 | # endif | ||
| 365 | # ifndef this_cpu_and_8 | ||
| 366 | # define this_cpu_and_8(pcp, val) _this_cpu_generic_to_op((pcp), (val), &=) | ||
| 367 | # endif | ||
| 368 | # define this_cpu_and(pcp, val) __pcpu_size_call(this_cpu_and_, (pcp), (val)) | ||
| 369 | #endif | ||
| 370 | |||
| 371 | #ifndef this_cpu_or | ||
| 372 | # ifndef this_cpu_or_1 | ||
| 373 | # define this_cpu_or_1(pcp, val) _this_cpu_generic_to_op((pcp), (val), |=) | ||
| 374 | # endif | ||
| 375 | # ifndef this_cpu_or_2 | ||
| 376 | # define this_cpu_or_2(pcp, val) _this_cpu_generic_to_op((pcp), (val), |=) | ||
| 377 | # endif | ||
| 378 | # ifndef this_cpu_or_4 | ||
| 379 | # define this_cpu_or_4(pcp, val) _this_cpu_generic_to_op((pcp), (val), |=) | ||
| 380 | # endif | ||
| 381 | # ifndef this_cpu_or_8 | ||
| 382 | # define this_cpu_or_8(pcp, val) _this_cpu_generic_to_op((pcp), (val), |=) | ||
| 383 | # endif | ||
| 384 | # define this_cpu_or(pcp, val) __pcpu_size_call(this_cpu_or_, (pcp), (val)) | ||
| 385 | #endif | ||
| 386 | |||
| 387 | #define _this_cpu_generic_add_return(pcp, val) \ | ||
| 388 | ({ \ | ||
| 389 | typeof(pcp) ret__; \ | ||
| 390 | unsigned long flags; \ | ||
| 391 | raw_local_irq_save(flags); \ | ||
| 392 | raw_cpu_add(pcp, val); \ | ||
| 393 | ret__ = raw_cpu_read(pcp); \ | ||
| 394 | raw_local_irq_restore(flags); \ | ||
| 395 | ret__; \ | ||
| 396 | }) | ||
| 397 | |||
| 398 | #ifndef this_cpu_add_return | ||
| 399 | # ifndef this_cpu_add_return_1 | ||
| 400 | # define this_cpu_add_return_1(pcp, val) _this_cpu_generic_add_return(pcp, val) | ||
| 401 | # endif | ||
| 402 | # ifndef this_cpu_add_return_2 | ||
| 403 | # define this_cpu_add_return_2(pcp, val) _this_cpu_generic_add_return(pcp, val) | ||
| 404 | # endif | ||
| 405 | # ifndef this_cpu_add_return_4 | ||
| 406 | # define this_cpu_add_return_4(pcp, val) _this_cpu_generic_add_return(pcp, val) | ||
| 407 | # endif | ||
| 408 | # ifndef this_cpu_add_return_8 | ||
| 409 | # define this_cpu_add_return_8(pcp, val) _this_cpu_generic_add_return(pcp, val) | ||
| 410 | # endif | ||
| 411 | # define this_cpu_add_return(pcp, val) __pcpu_size_call_return2(this_cpu_add_return_, pcp, val) | ||
| 412 | #endif | ||
| 413 | |||
| 414 | #define this_cpu_sub_return(pcp, val) this_cpu_add_return(pcp, -(typeof(pcp))(val)) | ||
| 415 | #define this_cpu_inc_return(pcp) this_cpu_add_return(pcp, 1) | ||
| 416 | #define this_cpu_dec_return(pcp) this_cpu_add_return(pcp, -1) | ||
| 417 | |||
| 418 | #define _this_cpu_generic_xchg(pcp, nval) \ | ||
| 419 | ({ typeof(pcp) ret__; \ | ||
| 420 | unsigned long flags; \ | ||
| 421 | raw_local_irq_save(flags); \ | ||
| 422 | ret__ = raw_cpu_read(pcp); \ | ||
| 423 | raw_cpu_write(pcp, nval); \ | ||
| 424 | raw_local_irq_restore(flags); \ | ||
| 425 | ret__; \ | ||
| 426 | }) | ||
| 427 | |||
| 428 | #ifndef this_cpu_xchg | ||
| 429 | # ifndef this_cpu_xchg_1 | ||
| 430 | # define this_cpu_xchg_1(pcp, nval) _this_cpu_generic_xchg(pcp, nval) | ||
| 431 | # endif | ||
| 432 | # ifndef this_cpu_xchg_2 | ||
| 433 | # define this_cpu_xchg_2(pcp, nval) _this_cpu_generic_xchg(pcp, nval) | ||
| 434 | # endif | ||
| 435 | # ifndef this_cpu_xchg_4 | ||
| 436 | # define this_cpu_xchg_4(pcp, nval) _this_cpu_generic_xchg(pcp, nval) | ||
| 437 | # endif | ||
| 438 | # ifndef this_cpu_xchg_8 | ||
| 439 | # define this_cpu_xchg_8(pcp, nval) _this_cpu_generic_xchg(pcp, nval) | ||
| 440 | # endif | ||
| 441 | # define this_cpu_xchg(pcp, nval) \ | ||
| 442 | __pcpu_size_call_return2(this_cpu_xchg_, (pcp), nval) | ||
| 443 | #endif | ||
| 444 | |||
| 445 | #define _this_cpu_generic_cmpxchg(pcp, oval, nval) \ | ||
| 446 | ({ \ | ||
| 447 | typeof(pcp) ret__; \ | ||
| 448 | unsigned long flags; \ | ||
| 449 | raw_local_irq_save(flags); \ | ||
| 450 | ret__ = raw_cpu_read(pcp); \ | ||
| 451 | if (ret__ == (oval)) \ | ||
| 452 | raw_cpu_write(pcp, nval); \ | ||
| 453 | raw_local_irq_restore(flags); \ | ||
| 454 | ret__; \ | ||
| 455 | }) | ||
| 456 | |||
| 457 | #ifndef this_cpu_cmpxchg | ||
| 458 | # ifndef this_cpu_cmpxchg_1 | ||
| 459 | # define this_cpu_cmpxchg_1(pcp, oval, nval) _this_cpu_generic_cmpxchg(pcp, oval, nval) | ||
| 460 | # endif | ||
| 461 | # ifndef this_cpu_cmpxchg_2 | ||
| 462 | # define this_cpu_cmpxchg_2(pcp, oval, nval) _this_cpu_generic_cmpxchg(pcp, oval, nval) | ||
| 463 | # endif | ||
| 464 | # ifndef this_cpu_cmpxchg_4 | ||
| 465 | # define this_cpu_cmpxchg_4(pcp, oval, nval) _this_cpu_generic_cmpxchg(pcp, oval, nval) | ||
| 466 | # endif | ||
| 467 | # ifndef this_cpu_cmpxchg_8 | ||
| 468 | # define this_cpu_cmpxchg_8(pcp, oval, nval) _this_cpu_generic_cmpxchg(pcp, oval, nval) | ||
| 469 | # endif | ||
| 470 | # define this_cpu_cmpxchg(pcp, oval, nval) \ | ||
| 471 | __pcpu_size_call_return2(this_cpu_cmpxchg_, pcp, oval, nval) | ||
| 472 | #endif | ||
| 473 | |||
| 474 | /* | ||
| 475 | * cmpxchg_double replaces two adjacent scalars at once. The first | ||
| 476 | * two parameters are per cpu variables which have to be of the same | ||
| 477 | * size. A truth value is returned to indicate success or failure | ||
| 478 | * (since a double register result is difficult to handle). There is | ||
| 479 | * very limited hardware support for these operations, so only certain | ||
| 480 | * sizes may work. | ||
| 481 | */ | ||
| 482 | #define _this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \ | ||
| 483 | ({ \ | ||
| 484 | int ret__; \ | ||
| 485 | unsigned long flags; \ | ||
| 486 | raw_local_irq_save(flags); \ | ||
| 487 | ret__ = raw_cpu_generic_cmpxchg_double(pcp1, pcp2, \ | ||
| 488 | oval1, oval2, nval1, nval2); \ | ||
| 489 | raw_local_irq_restore(flags); \ | ||
| 490 | ret__; \ | ||
| 491 | }) | ||
| 492 | |||
| 493 | #ifndef this_cpu_cmpxchg_double | ||
| 494 | # ifndef this_cpu_cmpxchg_double_1 | ||
| 495 | # define this_cpu_cmpxchg_double_1(pcp1, pcp2, oval1, oval2, nval1, nval2) \ | ||
| 496 | _this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) | ||
| 497 | # endif | ||
| 498 | # ifndef this_cpu_cmpxchg_double_2 | ||
| 499 | # define this_cpu_cmpxchg_double_2(pcp1, pcp2, oval1, oval2, nval1, nval2) \ | ||
| 500 | _this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) | ||
| 501 | # endif | ||
| 502 | # ifndef this_cpu_cmpxchg_double_4 | ||
| 503 | # define this_cpu_cmpxchg_double_4(pcp1, pcp2, oval1, oval2, nval1, nval2) \ | ||
| 504 | _this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) | ||
| 505 | # endif | ||
| 506 | # ifndef this_cpu_cmpxchg_double_8 | ||
| 507 | # define this_cpu_cmpxchg_double_8(pcp1, pcp2, oval1, oval2, nval1, nval2) \ | ||
| 508 | _this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) | ||
| 509 | # endif | ||
| 510 | # define this_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \ | ||
| 511 | __pcpu_double_call_return_bool(this_cpu_cmpxchg_double_, (pcp1), (pcp2), (oval1), (oval2), (nval1), (nval2)) | ||
| 512 | #endif | ||
| 513 | |||
| 514 | /* | ||
| 515 | * Generic percpu operations for contexts where we do not want to do | ||
| 516 | * any checks for preemptiosn. | ||
| 517 | * | ||
| 518 | * If there is no other protection through preempt disable and/or | ||
| 519 | * disabling interupts then one of these RMW operations can show unexpected | ||
| 520 | * behavior because the execution thread was rescheduled on another processor | ||
| 521 | * or an interrupt occurred and the same percpu variable was modified from | ||
| 522 | * the interrupt context. | ||
| 523 | */ | ||
| 524 | #ifndef raw_cpu_read | ||
| 525 | # ifndef raw_cpu_read_1 | ||
| 526 | # define raw_cpu_read_1(pcp) (*raw_cpu_ptr(&(pcp))) | ||
| 527 | # endif | ||
| 528 | # ifndef raw_cpu_read_2 | ||
| 529 | # define raw_cpu_read_2(pcp) (*raw_cpu_ptr(&(pcp))) | ||
| 530 | # endif | ||
| 531 | # ifndef raw_cpu_read_4 | ||
| 532 | # define raw_cpu_read_4(pcp) (*raw_cpu_ptr(&(pcp))) | ||
| 533 | # endif | ||
| 534 | # ifndef raw_cpu_read_8 | ||
| 535 | # define raw_cpu_read_8(pcp) (*raw_cpu_ptr(&(pcp))) | ||
| 536 | # endif | ||
| 537 | # define raw_cpu_read(pcp) __pcpu_size_call_return(raw_cpu_read_, (pcp)) | ||
| 538 | #endif | ||
| 539 | |||
| 540 | #define raw_cpu_generic_to_op(pcp, val, op) \ | ||
| 541 | do { \ | ||
| 542 | *raw_cpu_ptr(&(pcp)) op val; \ | ||
| 543 | } while (0) | ||
| 544 | |||
| 545 | |||
| 546 | #ifndef raw_cpu_write | ||
| 547 | # ifndef raw_cpu_write_1 | ||
| 548 | # define raw_cpu_write_1(pcp, val) raw_cpu_generic_to_op((pcp), (val), =) | ||
| 549 | # endif | ||
| 550 | # ifndef raw_cpu_write_2 | ||
| 551 | # define raw_cpu_write_2(pcp, val) raw_cpu_generic_to_op((pcp), (val), =) | ||
| 552 | # endif | ||
| 553 | # ifndef raw_cpu_write_4 | ||
| 554 | # define raw_cpu_write_4(pcp, val) raw_cpu_generic_to_op((pcp), (val), =) | ||
| 555 | # endif | ||
| 556 | # ifndef raw_cpu_write_8 | ||
| 557 | # define raw_cpu_write_8(pcp, val) raw_cpu_generic_to_op((pcp), (val), =) | ||
| 558 | # endif | ||
| 559 | # define raw_cpu_write(pcp, val) __pcpu_size_call(raw_cpu_write_, (pcp), (val)) | ||
| 560 | #endif | ||
| 561 | |||
| 562 | #ifndef raw_cpu_add | ||
| 563 | # ifndef raw_cpu_add_1 | ||
| 564 | # define raw_cpu_add_1(pcp, val) raw_cpu_generic_to_op((pcp), (val), +=) | ||
| 565 | # endif | ||
| 566 | # ifndef raw_cpu_add_2 | ||
| 567 | # define raw_cpu_add_2(pcp, val) raw_cpu_generic_to_op((pcp), (val), +=) | ||
| 568 | # endif | ||
| 569 | # ifndef raw_cpu_add_4 | ||
| 570 | # define raw_cpu_add_4(pcp, val) raw_cpu_generic_to_op((pcp), (val), +=) | ||
| 571 | # endif | ||
| 572 | # ifndef raw_cpu_add_8 | ||
| 573 | # define raw_cpu_add_8(pcp, val) raw_cpu_generic_to_op((pcp), (val), +=) | ||
| 574 | # endif | ||
| 575 | # define raw_cpu_add(pcp, val) __pcpu_size_call(raw_cpu_add_, (pcp), (val)) | ||
| 576 | #endif | ||
| 577 | |||
| 578 | #ifndef raw_cpu_sub | ||
| 579 | # define raw_cpu_sub(pcp, val) raw_cpu_add((pcp), -(val)) | ||
| 580 | #endif | ||
| 581 | |||
| 582 | #ifndef raw_cpu_inc | ||
| 583 | # define raw_cpu_inc(pcp) raw_cpu_add((pcp), 1) | ||
| 584 | #endif | ||
| 585 | |||
| 586 | #ifndef raw_cpu_dec | ||
| 587 | # define raw_cpu_dec(pcp) raw_cpu_sub((pcp), 1) | ||
| 588 | #endif | ||
| 589 | |||
| 590 | #ifndef raw_cpu_and | ||
| 591 | # ifndef raw_cpu_and_1 | ||
| 592 | # define raw_cpu_and_1(pcp, val) raw_cpu_generic_to_op((pcp), (val), &=) | ||
| 593 | # endif | ||
| 594 | # ifndef raw_cpu_and_2 | ||
| 595 | # define raw_cpu_and_2(pcp, val) raw_cpu_generic_to_op((pcp), (val), &=) | ||
| 596 | # endif | ||
| 597 | # ifndef raw_cpu_and_4 | ||
| 598 | # define raw_cpu_and_4(pcp, val) raw_cpu_generic_to_op((pcp), (val), &=) | ||
| 599 | # endif | ||
| 600 | # ifndef raw_cpu_and_8 | ||
| 601 | # define raw_cpu_and_8(pcp, val) raw_cpu_generic_to_op((pcp), (val), &=) | ||
| 602 | # endif | ||
| 603 | # define raw_cpu_and(pcp, val) __pcpu_size_call(raw_cpu_and_, (pcp), (val)) | ||
| 604 | #endif | ||
| 605 | |||
| 606 | #ifndef raw_cpu_or | ||
| 607 | # ifndef raw_cpu_or_1 | ||
| 608 | # define raw_cpu_or_1(pcp, val) raw_cpu_generic_to_op((pcp), (val), |=) | ||
| 609 | # endif | ||
| 610 | # ifndef raw_cpu_or_2 | ||
| 611 | # define raw_cpu_or_2(pcp, val) raw_cpu_generic_to_op((pcp), (val), |=) | ||
| 612 | # endif | ||
| 613 | # ifndef raw_cpu_or_4 | ||
| 614 | # define raw_cpu_or_4(pcp, val) raw_cpu_generic_to_op((pcp), (val), |=) | ||
| 615 | # endif | ||
| 616 | # ifndef raw_cpu_or_8 | ||
| 617 | # define raw_cpu_or_8(pcp, val) raw_cpu_generic_to_op((pcp), (val), |=) | ||
| 618 | # endif | ||
| 619 | # define raw_cpu_or(pcp, val) __pcpu_size_call(raw_cpu_or_, (pcp), (val)) | ||
| 620 | #endif | ||
| 621 | |||
| 622 | #define raw_cpu_generic_add_return(pcp, val) \ | ||
| 623 | ({ \ | ||
| 624 | raw_cpu_add(pcp, val); \ | ||
| 625 | raw_cpu_read(pcp); \ | ||
| 626 | }) | ||
| 627 | |||
| 628 | #ifndef raw_cpu_add_return | ||
| 629 | # ifndef raw_cpu_add_return_1 | ||
| 630 | # define raw_cpu_add_return_1(pcp, val) raw_cpu_generic_add_return(pcp, val) | ||
| 631 | # endif | ||
| 632 | # ifndef raw_cpu_add_return_2 | ||
| 633 | # define raw_cpu_add_return_2(pcp, val) raw_cpu_generic_add_return(pcp, val) | ||
| 634 | # endif | ||
| 635 | # ifndef raw_cpu_add_return_4 | ||
| 636 | # define raw_cpu_add_return_4(pcp, val) raw_cpu_generic_add_return(pcp, val) | ||
| 637 | # endif | ||
| 638 | # ifndef raw_cpu_add_return_8 | ||
| 639 | # define raw_cpu_add_return_8(pcp, val) raw_cpu_generic_add_return(pcp, val) | ||
| 640 | # endif | ||
| 641 | # define raw_cpu_add_return(pcp, val) \ | ||
| 642 | __pcpu_size_call_return2(raw_cpu_add_return_, pcp, val) | ||
| 643 | #endif | ||
| 644 | |||
| 645 | #define raw_cpu_sub_return(pcp, val) raw_cpu_add_return(pcp, -(typeof(pcp))(val)) | ||
| 646 | #define raw_cpu_inc_return(pcp) raw_cpu_add_return(pcp, 1) | ||
| 647 | #define raw_cpu_dec_return(pcp) raw_cpu_add_return(pcp, -1) | ||
| 648 | |||
| 649 | #define raw_cpu_generic_xchg(pcp, nval) \ | ||
| 650 | ({ typeof(pcp) ret__; \ | ||
| 651 | ret__ = raw_cpu_read(pcp); \ | ||
| 652 | raw_cpu_write(pcp, nval); \ | ||
| 653 | ret__; \ | ||
| 654 | }) | ||
| 655 | |||
| 656 | #ifndef raw_cpu_xchg | ||
| 657 | # ifndef raw_cpu_xchg_1 | ||
| 658 | # define raw_cpu_xchg_1(pcp, nval) raw_cpu_generic_xchg(pcp, nval) | ||
| 659 | # endif | ||
| 660 | # ifndef raw_cpu_xchg_2 | ||
| 661 | # define raw_cpu_xchg_2(pcp, nval) raw_cpu_generic_xchg(pcp, nval) | ||
| 662 | # endif | ||
| 663 | # ifndef raw_cpu_xchg_4 | ||
| 664 | # define raw_cpu_xchg_4(pcp, nval) raw_cpu_generic_xchg(pcp, nval) | ||
| 665 | # endif | ||
| 666 | # ifndef raw_cpu_xchg_8 | ||
| 667 | # define raw_cpu_xchg_8(pcp, nval) raw_cpu_generic_xchg(pcp, nval) | ||
| 668 | # endif | ||
| 669 | # define raw_cpu_xchg(pcp, nval) \ | ||
| 670 | __pcpu_size_call_return2(raw_cpu_xchg_, (pcp), nval) | ||
| 671 | #endif | ||
| 672 | |||
| 673 | #define raw_cpu_generic_cmpxchg(pcp, oval, nval) \ | ||
| 674 | ({ \ | ||
| 675 | typeof(pcp) ret__; \ | ||
| 676 | ret__ = raw_cpu_read(pcp); \ | ||
| 677 | if (ret__ == (oval)) \ | ||
| 678 | raw_cpu_write(pcp, nval); \ | ||
| 679 | ret__; \ | ||
| 680 | }) | ||
| 681 | |||
| 682 | #ifndef raw_cpu_cmpxchg | ||
| 683 | # ifndef raw_cpu_cmpxchg_1 | ||
| 684 | # define raw_cpu_cmpxchg_1(pcp, oval, nval) raw_cpu_generic_cmpxchg(pcp, oval, nval) | ||
| 685 | # endif | ||
| 686 | # ifndef raw_cpu_cmpxchg_2 | ||
| 687 | # define raw_cpu_cmpxchg_2(pcp, oval, nval) raw_cpu_generic_cmpxchg(pcp, oval, nval) | ||
| 688 | # endif | ||
| 689 | # ifndef raw_cpu_cmpxchg_4 | ||
| 690 | # define raw_cpu_cmpxchg_4(pcp, oval, nval) raw_cpu_generic_cmpxchg(pcp, oval, nval) | ||
| 691 | # endif | ||
| 692 | # ifndef raw_cpu_cmpxchg_8 | ||
| 693 | # define raw_cpu_cmpxchg_8(pcp, oval, nval) raw_cpu_generic_cmpxchg(pcp, oval, nval) | ||
| 694 | # endif | ||
| 695 | # define raw_cpu_cmpxchg(pcp, oval, nval) \ | ||
| 696 | __pcpu_size_call_return2(raw_cpu_cmpxchg_, pcp, oval, nval) | ||
| 697 | #endif | ||
| 698 | |||
| 699 | #define raw_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \ | ||
| 700 | ({ \ | ||
| 701 | int __ret = 0; \ | ||
| 702 | if (raw_cpu_read(pcp1) == (oval1) && \ | ||
| 703 | raw_cpu_read(pcp2) == (oval2)) { \ | ||
| 704 | raw_cpu_write(pcp1, (nval1)); \ | ||
| 705 | raw_cpu_write(pcp2, (nval2)); \ | ||
| 706 | __ret = 1; \ | ||
| 707 | } \ | ||
| 708 | (__ret); \ | ||
| 709 | }) | ||
| 710 | |||
| 711 | #ifndef raw_cpu_cmpxchg_double | ||
| 712 | # ifndef raw_cpu_cmpxchg_double_1 | ||
| 713 | # define raw_cpu_cmpxchg_double_1(pcp1, pcp2, oval1, oval2, nval1, nval2) \ | ||
| 714 | raw_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) | ||
| 715 | # endif | ||
| 716 | # ifndef raw_cpu_cmpxchg_double_2 | ||
| 717 | # define raw_cpu_cmpxchg_double_2(pcp1, pcp2, oval1, oval2, nval1, nval2) \ | ||
| 718 | raw_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) | ||
| 719 | # endif | ||
| 720 | # ifndef raw_cpu_cmpxchg_double_4 | ||
| 721 | # define raw_cpu_cmpxchg_double_4(pcp1, pcp2, oval1, oval2, nval1, nval2) \ | ||
| 722 | raw_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) | ||
| 723 | # endif | ||
| 724 | # ifndef raw_cpu_cmpxchg_double_8 | ||
| 725 | # define raw_cpu_cmpxchg_double_8(pcp1, pcp2, oval1, oval2, nval1, nval2) \ | ||
| 726 | raw_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) | ||
| 727 | # endif | ||
| 728 | # define raw_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \ | ||
| 729 | __pcpu_double_call_return_bool(raw_cpu_cmpxchg_double_, (pcp1), (pcp2), (oval1), (oval2), (nval1), (nval2)) | ||
| 730 | #endif | ||
| 731 | |||
| 732 | /* | ||
| 733 | * Generic percpu operations for context that are safe from preemption/interrupts. | ||
| 734 | */ | ||
| 735 | #ifndef __this_cpu_read | ||
| 736 | # define __this_cpu_read(pcp) \ | ||
| 737 | (__this_cpu_preempt_check("read"),__pcpu_size_call_return(raw_cpu_read_, (pcp))) | ||
| 738 | #endif | ||
| 739 | |||
| 740 | #ifndef __this_cpu_write | ||
| 741 | # define __this_cpu_write(pcp, val) \ | ||
| 742 | do { __this_cpu_preempt_check("write"); \ | ||
| 743 | __pcpu_size_call(raw_cpu_write_, (pcp), (val)); \ | ||
| 744 | } while (0) | ||
| 745 | #endif | ||
| 746 | |||
| 747 | #ifndef __this_cpu_add | ||
| 748 | # define __this_cpu_add(pcp, val) \ | ||
| 749 | do { __this_cpu_preempt_check("add"); \ | ||
| 750 | __pcpu_size_call(raw_cpu_add_, (pcp), (val)); \ | ||
| 751 | } while (0) | ||
| 752 | #endif | ||
| 753 | |||
| 754 | #ifndef __this_cpu_sub | ||
| 755 | # define __this_cpu_sub(pcp, val) __this_cpu_add((pcp), -(typeof(pcp))(val)) | ||
| 756 | #endif | ||
| 757 | |||
| 758 | #ifndef __this_cpu_inc | ||
| 759 | # define __this_cpu_inc(pcp) __this_cpu_add((pcp), 1) | ||
| 760 | #endif | ||
| 761 | |||
| 762 | #ifndef __this_cpu_dec | ||
| 763 | # define __this_cpu_dec(pcp) __this_cpu_sub((pcp), 1) | ||
| 764 | #endif | ||
| 765 | |||
| 766 | #ifndef __this_cpu_and | ||
| 767 | # define __this_cpu_and(pcp, val) \ | ||
| 768 | do { __this_cpu_preempt_check("and"); \ | ||
| 769 | __pcpu_size_call(raw_cpu_and_, (pcp), (val)); \ | ||
| 770 | } while (0) | ||
| 771 | |||
| 772 | #endif | ||
| 773 | |||
| 774 | #ifndef __this_cpu_or | ||
| 775 | # define __this_cpu_or(pcp, val) \ | ||
| 776 | do { __this_cpu_preempt_check("or"); \ | ||
| 777 | __pcpu_size_call(raw_cpu_or_, (pcp), (val)); \ | ||
| 778 | } while (0) | ||
| 779 | #endif | ||
| 780 | |||
| 781 | #ifndef __this_cpu_add_return | ||
| 782 | # define __this_cpu_add_return(pcp, val) \ | ||
| 783 | (__this_cpu_preempt_check("add_return"),__pcpu_size_call_return2(raw_cpu_add_return_, pcp, val)) | ||
| 784 | #endif | ||
| 785 | |||
| 786 | #define __this_cpu_sub_return(pcp, val) __this_cpu_add_return(pcp, -(typeof(pcp))(val)) | ||
| 787 | #define __this_cpu_inc_return(pcp) __this_cpu_add_return(pcp, 1) | ||
| 788 | #define __this_cpu_dec_return(pcp) __this_cpu_add_return(pcp, -1) | ||
| 789 | |||
| 790 | #ifndef __this_cpu_xchg | ||
| 791 | # define __this_cpu_xchg(pcp, nval) \ | ||
| 792 | (__this_cpu_preempt_check("xchg"),__pcpu_size_call_return2(raw_cpu_xchg_, (pcp), nval)) | ||
| 793 | #endif | ||
| 794 | |||
| 795 | #ifndef __this_cpu_cmpxchg | ||
| 796 | # define __this_cpu_cmpxchg(pcp, oval, nval) \ | ||
| 797 | (__this_cpu_preempt_check("cmpxchg"),__pcpu_size_call_return2(raw_cpu_cmpxchg_, pcp, oval, nval)) | ||
| 798 | #endif | ||
| 799 | |||
| 800 | #ifndef __this_cpu_cmpxchg_double | ||
| 801 | # define __this_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \ | ||
| 802 | (__this_cpu_preempt_check("cmpxchg_double"),__pcpu_double_call_return_bool(raw_cpu_cmpxchg_double_, (pcp1), (pcp2), (oval1), (oval2), (nval1), (nval2))) | ||
| 803 | #endif | ||
| 804 | |||
| 805 | #endif /* __LINUX_PERCPU_H */ | 132 | #endif /* __LINUX_PERCPU_H */ |
diff --git a/include/linux/phy.h b/include/linux/phy.h index 68041446c450..ed39956b5613 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h | |||
| @@ -545,6 +545,24 @@ struct phy_driver { | |||
| 545 | */ | 545 | */ |
| 546 | void (*link_change_notify)(struct phy_device *dev); | 546 | void (*link_change_notify)(struct phy_device *dev); |
| 547 | 547 | ||
| 548 | /* A function provided by a phy specific driver to override the | ||
| 549 | * the PHY driver framework support for reading a MMD register | ||
| 550 | * from the PHY. If not supported, return -1. This function is | ||
| 551 | * optional for PHY specific drivers, if not provided then the | ||
| 552 | * default MMD read function is used by the PHY framework. | ||
| 553 | */ | ||
| 554 | int (*read_mmd_indirect)(struct phy_device *dev, int ptrad, | ||
| 555 | int devnum, int regnum); | ||
| 556 | |||
| 557 | /* A function provided by a phy specific driver to override the | ||
| 558 | * the PHY driver framework support for writing a MMD register | ||
| 559 | * from the PHY. This function is optional for PHY specific drivers, | ||
| 560 | * if not provided then the default MMD read function is used by | ||
| 561 | * the PHY framework. | ||
| 562 | */ | ||
| 563 | void (*write_mmd_indirect)(struct phy_device *dev, int ptrad, | ||
| 564 | int devnum, int regnum, u32 val); | ||
| 565 | |||
| 548 | struct device_driver driver; | 566 | struct device_driver driver; |
| 549 | }; | 567 | }; |
| 550 | #define to_phy_driver(d) container_of(d, struct phy_driver, driver) | 568 | #define to_phy_driver(d) container_of(d, struct phy_driver, driver) |
diff --git a/include/linux/phy/omap_control_phy.h b/include/linux/phy/omap_control_phy.h index 5450403c7546..e9e6cfbfbb58 100644 --- a/include/linux/phy/omap_control_phy.h +++ b/include/linux/phy/omap_control_phy.h | |||
| @@ -23,6 +23,7 @@ enum omap_control_phy_type { | |||
| 23 | OMAP_CTRL_TYPE_OTGHS = 1, /* Mailbox OTGHS_CONTROL */ | 23 | OMAP_CTRL_TYPE_OTGHS = 1, /* Mailbox OTGHS_CONTROL */ |
| 24 | OMAP_CTRL_TYPE_USB2, /* USB2_PHY, power down in CONTROL_DEV_CONF */ | 24 | OMAP_CTRL_TYPE_USB2, /* USB2_PHY, power down in CONTROL_DEV_CONF */ |
| 25 | OMAP_CTRL_TYPE_PIPE3, /* PIPE3 PHY, DPLL & seperate Rx/Tx power */ | 25 | OMAP_CTRL_TYPE_PIPE3, /* PIPE3 PHY, DPLL & seperate Rx/Tx power */ |
| 26 | OMAP_CTRL_TYPE_PCIE, /* RX TX control of ACSPCIE */ | ||
| 26 | OMAP_CTRL_TYPE_DRA7USB2, /* USB2 PHY, power and power_aux e.g. DRA7 */ | 27 | OMAP_CTRL_TYPE_DRA7USB2, /* USB2 PHY, power and power_aux e.g. DRA7 */ |
| 27 | OMAP_CTRL_TYPE_AM437USB2, /* USB2 PHY, power e.g. AM437x */ | 28 | OMAP_CTRL_TYPE_AM437USB2, /* USB2 PHY, power e.g. AM437x */ |
| 28 | }; | 29 | }; |
| @@ -33,6 +34,7 @@ struct omap_control_phy { | |||
| 33 | u32 __iomem *otghs_control; | 34 | u32 __iomem *otghs_control; |
| 34 | u32 __iomem *power; | 35 | u32 __iomem *power; |
| 35 | u32 __iomem *power_aux; | 36 | u32 __iomem *power_aux; |
| 37 | u32 __iomem *pcie_pcs; | ||
| 36 | 38 | ||
| 37 | struct clk *sys_clk; | 39 | struct clk *sys_clk; |
| 38 | 40 | ||
| @@ -63,6 +65,9 @@ enum omap_control_usb_mode { | |||
| 63 | #define OMAP_CTRL_PIPE3_PHY_TX_RX_POWERON 0x3 | 65 | #define OMAP_CTRL_PIPE3_PHY_TX_RX_POWERON 0x3 |
| 64 | #define OMAP_CTRL_PIPE3_PHY_TX_RX_POWEROFF 0x0 | 66 | #define OMAP_CTRL_PIPE3_PHY_TX_RX_POWEROFF 0x0 |
| 65 | 67 | ||
| 68 | #define OMAP_CTRL_PCIE_PCS_MASK 0xff | ||
| 69 | #define OMAP_CTRL_PCIE_PCS_DELAY_COUNT_SHIFT 0x8 | ||
| 70 | |||
| 66 | #define OMAP_CTRL_USB2_PHY_PD BIT(28) | 71 | #define OMAP_CTRL_USB2_PHY_PD BIT(28) |
| 67 | 72 | ||
| 68 | #define AM437X_CTRL_USB2_PHY_PD BIT(0) | 73 | #define AM437X_CTRL_USB2_PHY_PD BIT(0) |
| @@ -74,6 +79,7 @@ enum omap_control_usb_mode { | |||
| 74 | void omap_control_phy_power(struct device *dev, int on); | 79 | void omap_control_phy_power(struct device *dev, int on); |
| 75 | void omap_control_usb_set_mode(struct device *dev, | 80 | void omap_control_usb_set_mode(struct device *dev, |
| 76 | enum omap_control_usb_mode mode); | 81 | enum omap_control_usb_mode mode); |
| 82 | void omap_control_pcie_pcs(struct device *dev, u8 id, u8 delay); | ||
| 77 | #else | 83 | #else |
| 78 | 84 | ||
| 79 | static inline void omap_control_phy_power(struct device *dev, int on) | 85 | static inline void omap_control_phy_power(struct device *dev, int on) |
| @@ -84,6 +90,10 @@ static inline void omap_control_usb_set_mode(struct device *dev, | |||
| 84 | enum omap_control_usb_mode mode) | 90 | enum omap_control_usb_mode mode) |
| 85 | { | 91 | { |
| 86 | } | 92 | } |
| 93 | |||
| 94 | static inline void omap_control_pcie_pcs(struct device *dev, u8 id, u8 delay) | ||
| 95 | { | ||
| 96 | } | ||
| 87 | #endif | 97 | #endif |
| 88 | 98 | ||
| 89 | #endif /* __OMAP_CONTROL_PHY_H__ */ | 99 | #endif /* __OMAP_CONTROL_PHY_H__ */ |
diff --git a/include/linux/phy/phy.h b/include/linux/phy/phy.h index 2760744cb2a7..8cb6f815475b 100644 --- a/include/linux/phy/phy.h +++ b/include/linux/phy/phy.h | |||
| @@ -18,6 +18,7 @@ | |||
| 18 | #include <linux/of.h> | 18 | #include <linux/of.h> |
| 19 | #include <linux/device.h> | 19 | #include <linux/device.h> |
| 20 | #include <linux/pm_runtime.h> | 20 | #include <linux/pm_runtime.h> |
| 21 | #include <linux/regulator/consumer.h> | ||
| 21 | 22 | ||
| 22 | struct phy; | 23 | struct phy; |
| 23 | 24 | ||
| @@ -65,6 +66,7 @@ struct phy { | |||
| 65 | int init_count; | 66 | int init_count; |
| 66 | int power_count; | 67 | int power_count; |
| 67 | struct phy_attrs attrs; | 68 | struct phy_attrs attrs; |
| 69 | struct regulator *pwr; | ||
| 68 | }; | 70 | }; |
| 69 | 71 | ||
| 70 | /** | 72 | /** |
| @@ -156,9 +158,10 @@ void devm_phy_put(struct device *dev, struct phy *phy); | |||
| 156 | struct phy *of_phy_get(struct device_node *np, const char *con_id); | 158 | struct phy *of_phy_get(struct device_node *np, const char *con_id); |
| 157 | struct phy *of_phy_simple_xlate(struct device *dev, | 159 | struct phy *of_phy_simple_xlate(struct device *dev, |
| 158 | struct of_phandle_args *args); | 160 | struct of_phandle_args *args); |
| 159 | struct phy *phy_create(struct device *dev, const struct phy_ops *ops, | 161 | struct phy *phy_create(struct device *dev, struct device_node *node, |
| 160 | struct phy_init_data *init_data); | 162 | const struct phy_ops *ops, |
| 161 | struct phy *devm_phy_create(struct device *dev, | 163 | struct phy_init_data *init_data); |
| 164 | struct phy *devm_phy_create(struct device *dev, struct device_node *node, | ||
| 162 | const struct phy_ops *ops, struct phy_init_data *init_data); | 165 | const struct phy_ops *ops, struct phy_init_data *init_data); |
| 163 | void phy_destroy(struct phy *phy); | 166 | void phy_destroy(struct phy *phy); |
| 164 | void devm_phy_destroy(struct device *dev, struct phy *phy); | 167 | void devm_phy_destroy(struct device *dev, struct phy *phy); |
| @@ -297,13 +300,17 @@ static inline struct phy *of_phy_simple_xlate(struct device *dev, | |||
| 297 | } | 300 | } |
| 298 | 301 | ||
| 299 | static inline struct phy *phy_create(struct device *dev, | 302 | static inline struct phy *phy_create(struct device *dev, |
| 300 | const struct phy_ops *ops, struct phy_init_data *init_data) | 303 | struct device_node *node, |
| 304 | const struct phy_ops *ops, | ||
| 305 | struct phy_init_data *init_data) | ||
| 301 | { | 306 | { |
| 302 | return ERR_PTR(-ENOSYS); | 307 | return ERR_PTR(-ENOSYS); |
| 303 | } | 308 | } |
| 304 | 309 | ||
| 305 | static inline struct phy *devm_phy_create(struct device *dev, | 310 | static inline struct phy *devm_phy_create(struct device *dev, |
| 306 | const struct phy_ops *ops, struct phy_init_data *init_data) | 311 | struct device_node *node, |
| 312 | const struct phy_ops *ops, | ||
| 313 | struct phy_init_data *init_data) | ||
| 307 | { | 314 | { |
| 308 | return ERR_PTR(-ENOSYS); | 315 | return ERR_PTR(-ENOSYS); |
| 309 | } | 316 | } |
diff --git a/include/linux/platform_data/ad7291.h b/include/linux/platform_data/ad7291.h new file mode 100644 index 000000000000..bbd89fa51188 --- /dev/null +++ b/include/linux/platform_data/ad7291.h | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | #ifndef __IIO_AD7291_H__ | ||
| 2 | #define __IIO_AD7291_H__ | ||
| 3 | |||
| 4 | /** | ||
| 5 | * struct ad7291_platform_data - AD7291 platform data | ||
| 6 | * @use_external_ref: Whether to use an external or internal reference voltage | ||
| 7 | */ | ||
| 8 | struct ad7291_platform_data { | ||
| 9 | bool use_external_ref; | ||
| 10 | }; | ||
| 11 | |||
| 12 | #endif | ||
diff --git a/include/linux/platform_data/asoc-s3c.h b/include/linux/platform_data/asoc-s3c.h index 709c6f7e2f8c..a6591c693ebb 100644 --- a/include/linux/platform_data/asoc-s3c.h +++ b/include/linux/platform_data/asoc-s3c.h | |||
| @@ -15,15 +15,6 @@ | |||
| 15 | #define S3C64XX_AC97_GPE 1 | 15 | #define S3C64XX_AC97_GPE 1 |
| 16 | extern void s3c64xx_ac97_setup_gpio(int); | 16 | extern void s3c64xx_ac97_setup_gpio(int); |
| 17 | 17 | ||
| 18 | /* | ||
| 19 | * The machine init code calls s5p*_spdif_setup_gpio with | ||
| 20 | * one of these defines in order to select appropriate bank | ||
| 21 | * of GPIO for S/PDIF pins | ||
| 22 | */ | ||
| 23 | #define S5PC100_SPDIF_GPD 0 | ||
| 24 | #define S5PC100_SPDIF_GPG3 1 | ||
| 25 | extern void s5pc100_spdif_setup_gpio(int); | ||
| 26 | |||
| 27 | struct samsung_i2s { | 18 | struct samsung_i2s { |
| 28 | /* If the Primary DAI has 5.1 Channels */ | 19 | /* If the Primary DAI has 5.1 Channels */ |
| 29 | #define QUIRK_PRI_6CHAN (1 << 0) | 20 | #define QUIRK_PRI_6CHAN (1 << 0) |
diff --git a/include/linux/platform_data/ata-samsung_cf.h b/include/linux/platform_data/ata-samsung_cf.h index c2049e3d7444..748e71642c4a 100644 --- a/include/linux/platform_data/ata-samsung_cf.h +++ b/include/linux/platform_data/ata-samsung_cf.h | |||
| @@ -29,7 +29,6 @@ extern void s3c_ide_set_platdata(struct s3c_ide_platdata *pdata); | |||
| 29 | 29 | ||
| 30 | /* architecture-specific IDE configuration */ | 30 | /* architecture-specific IDE configuration */ |
| 31 | extern void s3c64xx_ide_setup_gpio(void); | 31 | extern void s3c64xx_ide_setup_gpio(void); |
| 32 | extern void s5pc100_ide_setup_gpio(void); | ||
| 33 | extern void s5pv210_ide_setup_gpio(void); | 32 | extern void s5pv210_ide_setup_gpio(void); |
| 34 | 33 | ||
| 35 | #endif /*__ATA_SAMSUNG_CF_H */ | 34 | #endif /*__ATA_SAMSUNG_CF_H */ |
diff --git a/include/linux/platform_data/dma-imx.h b/include/linux/platform_data/dma-imx.h index bcbc6c3c14c0..d05542aafa3e 100644 --- a/include/linux/platform_data/dma-imx.h +++ b/include/linux/platform_data/dma-imx.h | |||
| @@ -50,6 +50,7 @@ enum imx_dma_prio { | |||
| 50 | 50 | ||
| 51 | struct imx_dma_data { | 51 | struct imx_dma_data { |
| 52 | int dma_request; /* DMA request line */ | 52 | int dma_request; /* DMA request line */ |
| 53 | int dma_request2; /* secondary DMA request line */ | ||
| 53 | enum sdma_peripheral_type peripheral_type; | 54 | enum sdma_peripheral_type peripheral_type; |
| 54 | int priority; | 55 | int priority; |
| 55 | }; | 56 | }; |
diff --git a/include/linux/platform_data/dsp-omap.h b/include/linux/platform_data/dsp-omap.h deleted file mode 100644 index 5927709b1908..000000000000 --- a/include/linux/platform_data/dsp-omap.h +++ /dev/null | |||
| @@ -1,34 +0,0 @@ | |||
| 1 | #ifndef __OMAP_DSP_H__ | ||
| 2 | #define __OMAP_DSP_H__ | ||
| 3 | |||
| 4 | #include <linux/types.h> | ||
| 5 | |||
| 6 | struct omap_dsp_platform_data { | ||
| 7 | void (*dsp_set_min_opp) (u8 opp_id); | ||
| 8 | u8 (*dsp_get_opp) (void); | ||
| 9 | void (*cpu_set_freq) (unsigned long f); | ||
| 10 | unsigned long (*cpu_get_freq) (void); | ||
| 11 | unsigned long mpu_speed[6]; | ||
| 12 | |||
| 13 | /* functions to write and read PRCM registers */ | ||
| 14 | void (*dsp_prm_write)(u32, s16 , u16); | ||
| 15 | u32 (*dsp_prm_read)(s16 , u16); | ||
| 16 | u32 (*dsp_prm_rmw_bits)(u32, u32, s16, s16); | ||
| 17 | void (*dsp_cm_write)(u32, s16 , u16); | ||
| 18 | u32 (*dsp_cm_read)(s16 , u16); | ||
| 19 | u32 (*dsp_cm_rmw_bits)(u32, u32, s16, s16); | ||
| 20 | |||
| 21 | void (*set_bootaddr)(u32); | ||
| 22 | void (*set_bootmode)(u8); | ||
| 23 | |||
| 24 | phys_addr_t phys_mempool_base; | ||
| 25 | phys_addr_t phys_mempool_size; | ||
| 26 | }; | ||
| 27 | |||
| 28 | #if defined(CONFIG_TIDSPBRIDGE) || defined(CONFIG_TIDSPBRIDGE_MODULE) | ||
| 29 | extern void omap_dsp_reserve_sdram_memblock(void); | ||
| 30 | #else | ||
| 31 | static inline void omap_dsp_reserve_sdram_memblock(void) { } | ||
| 32 | #endif | ||
| 33 | |||
| 34 | #endif | ||
diff --git a/include/linux/platform_data/iommu-omap.h b/include/linux/platform_data/iommu-omap.h index 5b429c43a297..54a0a9582fad 100644 --- a/include/linux/platform_data/iommu-omap.h +++ b/include/linux/platform_data/iommu-omap.h | |||
| @@ -31,14 +31,10 @@ struct omap_iommu_arch_data { | |||
| 31 | 31 | ||
| 32 | /** | 32 | /** |
| 33 | * struct omap_mmu_dev_attr - OMAP mmu device attributes for omap_hwmod | 33 | * struct omap_mmu_dev_attr - OMAP mmu device attributes for omap_hwmod |
| 34 | * @da_start: device address where the va space starts. | ||
| 35 | * @da_end: device address where the va space ends. | ||
| 36 | * @nr_tlb_entries: number of entries supported by the translation | 34 | * @nr_tlb_entries: number of entries supported by the translation |
| 37 | * look-aside buffer (TLB). | 35 | * look-aside buffer (TLB). |
| 38 | */ | 36 | */ |
| 39 | struct omap_mmu_dev_attr { | 37 | struct omap_mmu_dev_attr { |
| 40 | u32 da_start; | ||
| 41 | u32 da_end; | ||
| 42 | int nr_tlb_entries; | 38 | int nr_tlb_entries; |
| 43 | }; | 39 | }; |
| 44 | 40 | ||
| @@ -46,8 +42,6 @@ struct iommu_platform_data { | |||
| 46 | const char *name; | 42 | const char *name; |
| 47 | const char *reset_name; | 43 | const char *reset_name; |
| 48 | int nr_tlb_entries; | 44 | int nr_tlb_entries; |
| 49 | u32 da_start; | ||
| 50 | u32 da_end; | ||
| 51 | 45 | ||
| 52 | int (*assert_reset)(struct platform_device *pdev, const char *name); | 46 | int (*assert_reset)(struct platform_device *pdev, const char *name); |
| 53 | int (*deassert_reset)(struct platform_device *pdev, const char *name); | 47 | int (*deassert_reset)(struct platform_device *pdev, const char *name); |
diff --git a/include/linux/platform_data/ntc_thermistor.h b/include/linux/platform_data/ntc_thermistor.h index c7285b575462..0a6de4ca4930 100644 --- a/include/linux/platform_data/ntc_thermistor.h +++ b/include/linux/platform_data/ntc_thermistor.h | |||
| @@ -26,6 +26,7 @@ struct iio_channel; | |||
| 26 | enum ntc_thermistor_type { | 26 | enum ntc_thermistor_type { |
| 27 | TYPE_NCPXXWB473, | 27 | TYPE_NCPXXWB473, |
| 28 | TYPE_NCPXXWL333, | 28 | TYPE_NCPXXWL333, |
| 29 | TYPE_B57330V2103, | ||
| 29 | }; | 30 | }; |
| 30 | 31 | ||
| 31 | struct ntc_thermistor_platform_data { | 32 | struct ntc_thermistor_platform_data { |
diff --git a/include/linux/platform_data/st21nfcb.h b/include/linux/platform_data/st21nfcb.h new file mode 100644 index 000000000000..2d11f1f5efab --- /dev/null +++ b/include/linux/platform_data/st21nfcb.h | |||
| @@ -0,0 +1,32 @@ | |||
| 1 | /* | ||
| 2 | * Driver include for the ST21NFCB NFC chip. | ||
| 3 | * | ||
| 4 | * Copyright (C) 2014 STMicroelectronics SAS. All rights reserved. | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or modify it | ||
| 7 | * under the terms and conditions of the GNU General Public License, | ||
| 8 | * version 2, as published by the Free Software Foundation. | ||
| 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, see <http://www.gnu.org/licenses/>. | ||
| 17 | */ | ||
| 18 | |||
| 19 | #ifndef _ST21NFCB_NCI_H_ | ||
| 20 | #define _ST21NFCB_NCI_H_ | ||
| 21 | |||
| 22 | #include <linux/i2c.h> | ||
| 23 | |||
| 24 | #define ST21NFCB_NCI_DRIVER_NAME "st21nfcb_nci" | ||
| 25 | |||
| 26 | struct st21nfcb_nfc_platform_data { | ||
| 27 | unsigned int gpio_irq; | ||
| 28 | unsigned int gpio_reset; | ||
| 29 | unsigned int irq_polarity; | ||
| 30 | }; | ||
| 31 | |||
| 32 | #endif /* _ST21NFCA_HCI_H_ */ | ||
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h index 16f6654082dd..153d303af7eb 100644 --- a/include/linux/platform_device.h +++ b/include/linux/platform_device.h | |||
| @@ -28,6 +28,7 @@ struct platform_device { | |||
| 28 | struct resource *resource; | 28 | struct resource *resource; |
| 29 | 29 | ||
| 30 | const struct platform_device_id *id_entry; | 30 | const struct platform_device_id *id_entry; |
| 31 | char *driver_override; /* Driver name to force a match */ | ||
| 31 | 32 | ||
| 32 | /* MFD cell pointer */ | 33 | /* MFD cell pointer */ |
| 33 | struct mfd_cell *mfd_cell; | 34 | struct mfd_cell *mfd_cell; |
diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h index 43fd6716f662..367f49b9a1c9 100644 --- a/include/linux/pm_runtime.h +++ b/include/linux/pm_runtime.h | |||
| @@ -24,11 +24,20 @@ | |||
| 24 | #define RPM_AUTO 0x08 /* Use autosuspend_delay */ | 24 | #define RPM_AUTO 0x08 /* Use autosuspend_delay */ |
| 25 | 25 | ||
| 26 | #ifdef CONFIG_PM | 26 | #ifdef CONFIG_PM |
| 27 | extern struct workqueue_struct *pm_wq; | ||
| 28 | |||
| 29 | static inline bool queue_pm_work(struct work_struct *work) | ||
| 30 | { | ||
| 31 | return queue_work(pm_wq, work); | ||
| 32 | } | ||
| 33 | |||
| 27 | extern int pm_generic_runtime_suspend(struct device *dev); | 34 | extern int pm_generic_runtime_suspend(struct device *dev); |
| 28 | extern int pm_generic_runtime_resume(struct device *dev); | 35 | extern int pm_generic_runtime_resume(struct device *dev); |
| 29 | extern int pm_runtime_force_suspend(struct device *dev); | 36 | extern int pm_runtime_force_suspend(struct device *dev); |
| 30 | extern int pm_runtime_force_resume(struct device *dev); | 37 | extern int pm_runtime_force_resume(struct device *dev); |
| 31 | #else | 38 | #else |
| 39 | static inline bool queue_pm_work(struct work_struct *work) { return false; } | ||
| 40 | |||
| 32 | static inline int pm_generic_runtime_suspend(struct device *dev) { return 0; } | 41 | static inline int pm_generic_runtime_suspend(struct device *dev) { return 0; } |
| 33 | static inline int pm_generic_runtime_resume(struct device *dev) { return 0; } | 42 | static inline int pm_generic_runtime_resume(struct device *dev) { return 0; } |
| 34 | static inline int pm_runtime_force_suspend(struct device *dev) { return 0; } | 43 | static inline int pm_runtime_force_suspend(struct device *dev) { return 0; } |
| @@ -37,8 +46,6 @@ static inline int pm_runtime_force_resume(struct device *dev) { return 0; } | |||
| 37 | 46 | ||
| 38 | #ifdef CONFIG_PM_RUNTIME | 47 | #ifdef CONFIG_PM_RUNTIME |
| 39 | 48 | ||
| 40 | extern struct workqueue_struct *pm_wq; | ||
| 41 | |||
| 42 | extern int __pm_runtime_idle(struct device *dev, int rpmflags); | 49 | extern int __pm_runtime_idle(struct device *dev, int rpmflags); |
| 43 | extern int __pm_runtime_suspend(struct device *dev, int rpmflags); | 50 | extern int __pm_runtime_suspend(struct device *dev, int rpmflags); |
| 44 | extern int __pm_runtime_resume(struct device *dev, int rpmflags); | 51 | extern int __pm_runtime_resume(struct device *dev, int rpmflags); |
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h index f2b76aeaf4e4..f3dea41dbcd2 100644 --- a/include/linux/power_supply.h +++ b/include/linux/power_supply.h | |||
| @@ -120,6 +120,7 @@ enum power_supply_property { | |||
| 120 | POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX, | 120 | POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX, |
| 121 | POWER_SUPPLY_PROP_CHARGE_CONTROL_LIMIT, | 121 | POWER_SUPPLY_PROP_CHARGE_CONTROL_LIMIT, |
| 122 | POWER_SUPPLY_PROP_CHARGE_CONTROL_LIMIT_MAX, | 122 | POWER_SUPPLY_PROP_CHARGE_CONTROL_LIMIT_MAX, |
| 123 | POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT, | ||
| 123 | POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN, | 124 | POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN, |
| 124 | POWER_SUPPLY_PROP_ENERGY_EMPTY_DESIGN, | 125 | POWER_SUPPLY_PROP_ENERGY_EMPTY_DESIGN, |
| 125 | POWER_SUPPLY_PROP_ENERGY_FULL, | 126 | POWER_SUPPLY_PROP_ENERGY_FULL, |
| @@ -131,6 +132,8 @@ enum power_supply_property { | |||
| 131 | POWER_SUPPLY_PROP_CAPACITY_ALERT_MAX, /* in percents! */ | 132 | POWER_SUPPLY_PROP_CAPACITY_ALERT_MAX, /* in percents! */ |
| 132 | POWER_SUPPLY_PROP_CAPACITY_LEVEL, | 133 | POWER_SUPPLY_PROP_CAPACITY_LEVEL, |
| 133 | POWER_SUPPLY_PROP_TEMP, | 134 | POWER_SUPPLY_PROP_TEMP, |
| 135 | POWER_SUPPLY_PROP_TEMP_MAX, | ||
| 136 | POWER_SUPPLY_PROP_TEMP_MIN, | ||
| 134 | POWER_SUPPLY_PROP_TEMP_ALERT_MIN, | 137 | POWER_SUPPLY_PROP_TEMP_ALERT_MIN, |
| 135 | POWER_SUPPLY_PROP_TEMP_ALERT_MAX, | 138 | POWER_SUPPLY_PROP_TEMP_ALERT_MAX, |
| 136 | POWER_SUPPLY_PROP_TEMP_AMBIENT, | 139 | POWER_SUPPLY_PROP_TEMP_AMBIENT, |
| @@ -142,6 +145,7 @@ enum power_supply_property { | |||
| 142 | POWER_SUPPLY_PROP_TIME_TO_FULL_AVG, | 145 | POWER_SUPPLY_PROP_TIME_TO_FULL_AVG, |
| 143 | POWER_SUPPLY_PROP_TYPE, /* use power_supply.type instead */ | 146 | POWER_SUPPLY_PROP_TYPE, /* use power_supply.type instead */ |
| 144 | POWER_SUPPLY_PROP_SCOPE, | 147 | POWER_SUPPLY_PROP_SCOPE, |
| 148 | POWER_SUPPLY_PROP_CHARGE_TERM_CURRENT, | ||
| 145 | /* Properties of type `const char *' */ | 149 | /* Properties of type `const char *' */ |
| 146 | POWER_SUPPLY_PROP_MODEL_NAME, | 150 | POWER_SUPPLY_PROP_MODEL_NAME, |
| 147 | POWER_SUPPLY_PROP_MANUFACTURER, | 151 | POWER_SUPPLY_PROP_MANUFACTURER, |
diff --git a/include/linux/ptp_classify.h b/include/linux/ptp_classify.h index 7dfed71d76a6..159c987b1853 100644 --- a/include/linux/ptp_classify.h +++ b/include/linux/ptp_classify.h | |||
| @@ -33,8 +33,8 @@ | |||
| 33 | #define PTP_CLASS_IPV4 0x10 /* event in an IPV4 UDP packet */ | 33 | #define PTP_CLASS_IPV4 0x10 /* event in an IPV4 UDP packet */ |
| 34 | #define PTP_CLASS_IPV6 0x20 /* event in an IPV6 UDP packet */ | 34 | #define PTP_CLASS_IPV6 0x20 /* event in an IPV6 UDP packet */ |
| 35 | #define PTP_CLASS_L2 0x30 /* event in a L2 packet */ | 35 | #define PTP_CLASS_L2 0x30 /* event in a L2 packet */ |
| 36 | #define PTP_CLASS_VLAN 0x40 /* event in a VLAN tagged L2 packet */ | 36 | #define PTP_CLASS_PMASK 0x30 /* mask for the packet type field */ |
| 37 | #define PTP_CLASS_PMASK 0xf0 /* mask for the packet type field */ | 37 | #define PTP_CLASS_VLAN 0x40 /* event in a VLAN tagged packet */ |
| 38 | 38 | ||
| 39 | #define PTP_CLASS_V1_IPV4 (PTP_CLASS_V1 | PTP_CLASS_IPV4) | 39 | #define PTP_CLASS_V1_IPV4 (PTP_CLASS_V1 | PTP_CLASS_IPV4) |
| 40 | #define PTP_CLASS_V1_IPV6 (PTP_CLASS_V1 | PTP_CLASS_IPV6) /* probably DNE */ | 40 | #define PTP_CLASS_V1_IPV6 (PTP_CLASS_V1 | PTP_CLASS_IPV6) /* probably DNE */ |
| @@ -54,7 +54,6 @@ | |||
| 54 | #define IP6_HLEN 40 | 54 | #define IP6_HLEN 40 |
| 55 | #define UDP_HLEN 8 | 55 | #define UDP_HLEN 8 |
| 56 | #define OFF_IHL 14 | 56 | #define OFF_IHL 14 |
| 57 | #define OFF_PTP6 (ETH_HLEN + IP6_HLEN + UDP_HLEN) | ||
| 58 | #define IPV4_HLEN(data) (((struct iphdr *)(data + OFF_IHL))->ihl << 2) | 57 | #define IPV4_HLEN(data) (((struct iphdr *)(data + OFF_IHL))->ihl << 2) |
| 59 | 58 | ||
| 60 | #if defined(CONFIG_NET_PTP_CLASSIFY) | 59 | #if defined(CONFIG_NET_PTP_CLASSIFY) |
diff --git a/include/linux/ras.h b/include/linux/ras.h new file mode 100644 index 000000000000..2aceeafd6fe5 --- /dev/null +++ b/include/linux/ras.h | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | #ifndef __RAS_H__ | ||
| 2 | #define __RAS_H__ | ||
| 3 | |||
| 4 | #ifdef CONFIG_DEBUG_FS | ||
| 5 | int ras_userspace_consumers(void); | ||
| 6 | void ras_debugfs_init(void); | ||
| 7 | int ras_add_daemon_trace(void); | ||
| 8 | #else | ||
| 9 | static inline int ras_userspace_consumers(void) { return 0; } | ||
| 10 | static inline void ras_debugfs_init(void) { return; } | ||
| 11 | static inline int ras_add_daemon_trace(void) { return 0; } | ||
| 12 | #endif | ||
| 13 | |||
| 14 | #endif | ||
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h index 6a94cc8b1ca0..d231aa17b1d7 100644 --- a/include/linux/rcupdate.h +++ b/include/linux/rcupdate.h | |||
| @@ -826,15 +826,14 @@ static inline void rcu_preempt_sleep_check(void) | |||
| 826 | * read-side critical section that would block in a !PREEMPT kernel. | 826 | * read-side critical section that would block in a !PREEMPT kernel. |
| 827 | * But if you want the full story, read on! | 827 | * But if you want the full story, read on! |
| 828 | * | 828 | * |
| 829 | * In non-preemptible RCU implementations (TREE_RCU and TINY_RCU), it | 829 | * In non-preemptible RCU implementations (TREE_RCU and TINY_RCU), |
| 830 | * is illegal to block while in an RCU read-side critical section. In | 830 | * it is illegal to block while in an RCU read-side critical section. |
| 831 | * preemptible RCU implementations (TREE_PREEMPT_RCU and TINY_PREEMPT_RCU) | 831 | * In preemptible RCU implementations (TREE_PREEMPT_RCU) in CONFIG_PREEMPT |
| 832 | * in CONFIG_PREEMPT kernel builds, RCU read-side critical sections may | 832 | * kernel builds, RCU read-side critical sections may be preempted, |
| 833 | * be preempted, but explicit blocking is illegal. Finally, in preemptible | 833 | * but explicit blocking is illegal. Finally, in preemptible RCU |
| 834 | * RCU implementations in real-time (with -rt patchset) kernel builds, | 834 | * implementations in real-time (with -rt patchset) kernel builds, RCU |
| 835 | * RCU read-side critical sections may be preempted and they may also | 835 | * read-side critical sections may be preempted and they may also block, but |
| 836 | * block, but only when acquiring spinlocks that are subject to priority | 836 | * only when acquiring spinlocks that are subject to priority inheritance. |
| 837 | * inheritance. | ||
| 838 | */ | 837 | */ |
| 839 | static inline void rcu_read_lock(void) | 838 | static inline void rcu_read_lock(void) |
| 840 | { | 839 | { |
| @@ -858,6 +857,34 @@ static inline void rcu_read_lock(void) | |||
| 858 | /** | 857 | /** |
| 859 | * rcu_read_unlock() - marks the end of an RCU read-side critical section. | 858 | * rcu_read_unlock() - marks the end of an RCU read-side critical section. |
| 860 | * | 859 | * |
| 860 | * In most situations, rcu_read_unlock() is immune from deadlock. | ||
| 861 | * However, in kernels built with CONFIG_RCU_BOOST, rcu_read_unlock() | ||
| 862 | * is responsible for deboosting, which it does via rt_mutex_unlock(). | ||
| 863 | * Unfortunately, this function acquires the scheduler's runqueue and | ||
| 864 | * priority-inheritance spinlocks. This means that deadlock could result | ||
| 865 | * if the caller of rcu_read_unlock() already holds one of these locks or | ||
| 866 | * any lock that is ever acquired while holding them. | ||
| 867 | * | ||
| 868 | * That said, RCU readers are never priority boosted unless they were | ||
| 869 | * preempted. Therefore, one way to avoid deadlock is to make sure | ||
| 870 | * that preemption never happens within any RCU read-side critical | ||
| 871 | * section whose outermost rcu_read_unlock() is called with one of | ||
| 872 | * rt_mutex_unlock()'s locks held. Such preemption can be avoided in | ||
| 873 | * a number of ways, for example, by invoking preempt_disable() before | ||
| 874 | * critical section's outermost rcu_read_lock(). | ||
| 875 | * | ||
| 876 | * Given that the set of locks acquired by rt_mutex_unlock() might change | ||
| 877 | * at any time, a somewhat more future-proofed approach is to make sure | ||
| 878 | * that that preemption never happens within any RCU read-side critical | ||
| 879 | * section whose outermost rcu_read_unlock() is called with irqs disabled. | ||
| 880 | * This approach relies on the fact that rt_mutex_unlock() currently only | ||
| 881 | * acquires irq-disabled locks. | ||
| 882 | * | ||
| 883 | * The second of these two approaches is best in most situations, | ||
| 884 | * however, the first approach can also be useful, at least to those | ||
| 885 | * developers willing to keep abreast of the set of locks acquired by | ||
| 886 | * rt_mutex_unlock(). | ||
| 887 | * | ||
| 861 | * See rcu_read_lock() for more information. | 888 | * See rcu_read_lock() for more information. |
| 862 | */ | 889 | */ |
| 863 | static inline void rcu_read_unlock(void) | 890 | static inline void rcu_read_unlock(void) |
diff --git a/include/linux/regmap.h b/include/linux/regmap.h index 7b0e4b425cdf..c5ed83f49c4e 100644 --- a/include/linux/regmap.h +++ b/include/linux/regmap.h | |||
| @@ -396,6 +396,7 @@ void regmap_exit(struct regmap *map); | |||
| 396 | int regmap_reinit_cache(struct regmap *map, | 396 | int regmap_reinit_cache(struct regmap *map, |
| 397 | const struct regmap_config *config); | 397 | const struct regmap_config *config); |
| 398 | struct regmap *dev_get_regmap(struct device *dev, const char *name); | 398 | struct regmap *dev_get_regmap(struct device *dev, const char *name); |
| 399 | struct device *regmap_get_device(struct regmap *map); | ||
| 399 | int regmap_write(struct regmap *map, unsigned int reg, unsigned int val); | 400 | int regmap_write(struct regmap *map, unsigned int reg, unsigned int val); |
| 400 | int regmap_write_async(struct regmap *map, unsigned int reg, unsigned int val); | 401 | int regmap_write_async(struct regmap *map, unsigned int reg, unsigned int val); |
| 401 | int regmap_raw_write(struct regmap *map, unsigned int reg, | 402 | int regmap_raw_write(struct regmap *map, unsigned int reg, |
| @@ -729,6 +730,12 @@ static inline struct regmap *dev_get_regmap(struct device *dev, | |||
| 729 | return NULL; | 730 | return NULL; |
| 730 | } | 731 | } |
| 731 | 732 | ||
| 733 | static inline struct device *regmap_get_device(struct regmap *map) | ||
| 734 | { | ||
| 735 | WARN_ONCE(1, "regmap API is disabled"); | ||
| 736 | return NULL; | ||
| 737 | } | ||
| 738 | |||
| 732 | #endif | 739 | #endif |
| 733 | 740 | ||
| 734 | #endif | 741 | #endif |
diff --git a/include/linux/regulator/ab8500.h b/include/linux/regulator/ab8500.h index 75307447cef9..d8ecefaf63ca 100644 --- a/include/linux/regulator/ab8500.h +++ b/include/linux/regulator/ab8500.h | |||
| @@ -322,18 +322,4 @@ struct ab8500_regulator_platform_data { | |||
| 322 | struct regulator_init_data *ext_regulator; | 322 | struct regulator_init_data *ext_regulator; |
| 323 | }; | 323 | }; |
| 324 | 324 | ||
| 325 | #ifdef CONFIG_REGULATOR_AB8500_DEBUG | ||
| 326 | int ab8500_regulator_debug_init(struct platform_device *pdev); | ||
| 327 | int ab8500_regulator_debug_exit(struct platform_device *pdev); | ||
| 328 | #else | ||
| 329 | static inline int ab8500_regulator_debug_init(struct platform_device *pdev) | ||
| 330 | { | ||
| 331 | return 0; | ||
| 332 | } | ||
| 333 | static inline int ab8500_regulator_debug_exit(struct platform_device *pdev) | ||
| 334 | { | ||
| 335 | return 0; | ||
| 336 | } | ||
| 337 | #endif | ||
| 338 | |||
| 339 | #endif | 325 | #endif |
diff --git a/include/linux/regulator/act8865.h b/include/linux/regulator/act8865.h index 49206c1b4905..b6c4909b33af 100644 --- a/include/linux/regulator/act8865.h +++ b/include/linux/regulator/act8865.h | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * act8865.h -- Voltage regulation for the active-semi act8865 | 2 | * act8865.h -- Voltage regulation for active-semi act88xx PMUs |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2013 Atmel Corporation. | 4 | * Copyright (C) 2013 Atmel Corporation. |
| 5 | * | 5 | * |
| @@ -29,6 +29,27 @@ enum { | |||
| 29 | ACT8865_REG_NUM, | 29 | ACT8865_REG_NUM, |
| 30 | }; | 30 | }; |
| 31 | 31 | ||
| 32 | enum { | ||
| 33 | ACT8846_ID_REG1, | ||
| 34 | ACT8846_ID_REG2, | ||
| 35 | ACT8846_ID_REG3, | ||
| 36 | ACT8846_ID_REG4, | ||
| 37 | ACT8846_ID_REG5, | ||
| 38 | ACT8846_ID_REG6, | ||
| 39 | ACT8846_ID_REG7, | ||
| 40 | ACT8846_ID_REG8, | ||
| 41 | ACT8846_ID_REG9, | ||
| 42 | ACT8846_ID_REG10, | ||
| 43 | ACT8846_ID_REG11, | ||
| 44 | ACT8846_ID_REG12, | ||
| 45 | ACT8846_REG_NUM, | ||
| 46 | }; | ||
| 47 | |||
| 48 | enum { | ||
| 49 | ACT8865, | ||
| 50 | ACT8846, | ||
| 51 | }; | ||
| 52 | |||
| 32 | /** | 53 | /** |
| 33 | * act8865_regulator_data - regulator data | 54 | * act8865_regulator_data - regulator data |
| 34 | * @id: regulator id | 55 | * @id: regulator id |
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h index 14ec18d5e18b..f8a8733068a7 100644 --- a/include/linux/regulator/consumer.h +++ b/include/linux/regulator/consumer.h | |||
| @@ -37,6 +37,7 @@ | |||
| 37 | 37 | ||
| 38 | struct device; | 38 | struct device; |
| 39 | struct notifier_block; | 39 | struct notifier_block; |
| 40 | struct regmap; | ||
| 40 | 41 | ||
| 41 | /* | 42 | /* |
| 42 | * Regulator operating modes. | 43 | * Regulator operating modes. |
| @@ -215,6 +216,13 @@ int regulator_set_optimum_mode(struct regulator *regulator, int load_uA); | |||
| 215 | 216 | ||
| 216 | int regulator_allow_bypass(struct regulator *regulator, bool allow); | 217 | int regulator_allow_bypass(struct regulator *regulator, bool allow); |
| 217 | 218 | ||
| 219 | struct regmap *regulator_get_regmap(struct regulator *regulator); | ||
| 220 | int regulator_get_hardware_vsel_register(struct regulator *regulator, | ||
| 221 | unsigned *vsel_reg, | ||
| 222 | unsigned *vsel_mask); | ||
| 223 | int regulator_list_hardware_vsel(struct regulator *regulator, | ||
| 224 | unsigned selector); | ||
| 225 | |||
| 218 | /* regulator notifier block */ | 226 | /* regulator notifier block */ |
| 219 | int regulator_register_notifier(struct regulator *regulator, | 227 | int regulator_register_notifier(struct regulator *regulator, |
| 220 | struct notifier_block *nb); | 228 | struct notifier_block *nb); |
| @@ -457,6 +465,24 @@ static inline int regulator_allow_bypass(struct regulator *regulator, | |||
| 457 | return 0; | 465 | return 0; |
| 458 | } | 466 | } |
| 459 | 467 | ||
| 468 | static inline struct regmap *regulator_get_regmap(struct regulator *regulator) | ||
| 469 | { | ||
| 470 | return ERR_PTR(-EOPNOTSUPP); | ||
| 471 | } | ||
| 472 | |||
| 473 | static inline int regulator_get_hardware_vsel_register(struct regulator *regulator, | ||
| 474 | unsigned *vsel_reg, | ||
| 475 | unsigned *vsel_mask) | ||
| 476 | { | ||
| 477 | return -EOPNOTSUPP; | ||
| 478 | } | ||
| 479 | |||
| 480 | static inline int regulator_list_hardware_vsel(struct regulator *regulator, | ||
| 481 | unsigned selector) | ||
| 482 | { | ||
| 483 | return -EOPNOTSUPP; | ||
| 484 | } | ||
| 485 | |||
| 460 | static inline int regulator_register_notifier(struct regulator *regulator, | 486 | static inline int regulator_register_notifier(struct regulator *regulator, |
| 461 | struct notifier_block *nb) | 487 | struct notifier_block *nb) |
| 462 | { | 488 | { |
diff --git a/include/linux/regulator/da9211.h b/include/linux/regulator/da9211.h new file mode 100644 index 000000000000..0981ce0e72cc --- /dev/null +++ b/include/linux/regulator/da9211.h | |||
| @@ -0,0 +1,32 @@ | |||
| 1 | /* | ||
| 2 | * da9211.h - Regulator device driver for DA9211 | ||
| 3 | * Copyright (C) 2014 Dialog Semiconductor Ltd. | ||
| 4 | * | ||
| 5 | * This library is free software; you can redistribute it and/or | ||
| 6 | * modify it under the terms of the GNU Library General Public | ||
| 7 | * License as published by the Free Software Foundation; either | ||
| 8 | * version 2 of the License, or (at your option) any later version. | ||
| 9 | * | ||
| 10 | * This library 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 GNU | ||
| 13 | * Library General Public License for more details. | ||
| 14 | */ | ||
| 15 | |||
| 16 | #ifndef __LINUX_REGULATOR_DA9211_H | ||
| 17 | #define __LINUX_REGULATOR_DA9211_H | ||
| 18 | |||
| 19 | #include <linux/regulator/machine.h> | ||
| 20 | |||
| 21 | #define DA9211_MAX_REGULATORS 2 | ||
| 22 | |||
| 23 | struct da9211_pdata { | ||
| 24 | /* | ||
| 25 | * Number of buck | ||
| 26 | * 1 : 4 phase 1 buck | ||
| 27 | * 2 : 2 phase 2 buck | ||
| 28 | */ | ||
| 29 | int num_buck; | ||
| 30 | struct regulator_init_data *init_data; | ||
| 31 | }; | ||
| 32 | #endif | ||
diff --git a/include/linux/reservation.h b/include/linux/reservation.h index 813dae960ebd..5a0b64cf68b4 100644 --- a/include/linux/reservation.h +++ b/include/linux/reservation.h | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | * Copyright (C) 2012 Texas Instruments | 6 | * Copyright (C) 2012 Texas Instruments |
| 7 | * | 7 | * |
| 8 | * Authors: | 8 | * Authors: |
| 9 | * Rob Clark <rob.clark@linaro.org> | 9 | * Rob Clark <robdclark@gmail.com> |
| 10 | * Maarten Lankhorst <maarten.lankhorst@canonical.com> | 10 | * Maarten Lankhorst <maarten.lankhorst@canonical.com> |
| 11 | * Thomas Hellstrom <thellstrom-at-vmware-dot-com> | 11 | * Thomas Hellstrom <thellstrom-at-vmware-dot-com> |
| 12 | * | 12 | * |
| @@ -40,23 +40,103 @@ | |||
| 40 | #define _LINUX_RESERVATION_H | 40 | #define _LINUX_RESERVATION_H |
| 41 | 41 | ||
| 42 | #include <linux/ww_mutex.h> | 42 | #include <linux/ww_mutex.h> |
| 43 | #include <linux/fence.h> | ||
| 44 | #include <linux/slab.h> | ||
| 45 | #include <linux/seqlock.h> | ||
| 46 | #include <linux/rcupdate.h> | ||
| 43 | 47 | ||
| 44 | extern struct ww_class reservation_ww_class; | 48 | extern struct ww_class reservation_ww_class; |
| 49 | extern struct lock_class_key reservation_seqcount_class; | ||
| 50 | extern const char reservation_seqcount_string[]; | ||
| 51 | |||
| 52 | struct reservation_object_list { | ||
| 53 | struct rcu_head rcu; | ||
| 54 | u32 shared_count, shared_max; | ||
| 55 | struct fence __rcu *shared[]; | ||
| 56 | }; | ||
| 45 | 57 | ||
| 46 | struct reservation_object { | 58 | struct reservation_object { |
| 47 | struct ww_mutex lock; | 59 | struct ww_mutex lock; |
| 60 | seqcount_t seq; | ||
| 61 | |||
| 62 | struct fence __rcu *fence_excl; | ||
| 63 | struct reservation_object_list __rcu *fence; | ||
| 64 | struct reservation_object_list *staged; | ||
| 48 | }; | 65 | }; |
| 49 | 66 | ||
| 67 | #define reservation_object_held(obj) lockdep_is_held(&(obj)->lock.base) | ||
| 68 | #define reservation_object_assert_held(obj) \ | ||
| 69 | lockdep_assert_held(&(obj)->lock.base) | ||
| 70 | |||
| 50 | static inline void | 71 | static inline void |
| 51 | reservation_object_init(struct reservation_object *obj) | 72 | reservation_object_init(struct reservation_object *obj) |
| 52 | { | 73 | { |
| 53 | ww_mutex_init(&obj->lock, &reservation_ww_class); | 74 | ww_mutex_init(&obj->lock, &reservation_ww_class); |
| 75 | |||
| 76 | __seqcount_init(&obj->seq, reservation_seqcount_string, &reservation_seqcount_class); | ||
| 77 | RCU_INIT_POINTER(obj->fence, NULL); | ||
| 78 | RCU_INIT_POINTER(obj->fence_excl, NULL); | ||
| 79 | obj->staged = NULL; | ||
| 54 | } | 80 | } |
| 55 | 81 | ||
| 56 | static inline void | 82 | static inline void |
| 57 | reservation_object_fini(struct reservation_object *obj) | 83 | reservation_object_fini(struct reservation_object *obj) |
| 58 | { | 84 | { |
| 85 | int i; | ||
| 86 | struct reservation_object_list *fobj; | ||
| 87 | struct fence *excl; | ||
| 88 | |||
| 89 | /* | ||
| 90 | * This object should be dead and all references must have | ||
| 91 | * been released to it, so no need to be protected with rcu. | ||
| 92 | */ | ||
| 93 | excl = rcu_dereference_protected(obj->fence_excl, 1); | ||
| 94 | if (excl) | ||
| 95 | fence_put(excl); | ||
| 96 | |||
| 97 | fobj = rcu_dereference_protected(obj->fence, 1); | ||
| 98 | if (fobj) { | ||
| 99 | for (i = 0; i < fobj->shared_count; ++i) | ||
| 100 | fence_put(rcu_dereference_protected(fobj->shared[i], 1)); | ||
| 101 | |||
| 102 | kfree(fobj); | ||
| 103 | } | ||
| 104 | kfree(obj->staged); | ||
| 105 | |||
| 59 | ww_mutex_destroy(&obj->lock); | 106 | ww_mutex_destroy(&obj->lock); |
| 60 | } | 107 | } |
| 61 | 108 | ||
| 109 | static inline struct reservation_object_list * | ||
| 110 | reservation_object_get_list(struct reservation_object *obj) | ||
| 111 | { | ||
| 112 | return rcu_dereference_protected(obj->fence, | ||
| 113 | reservation_object_held(obj)); | ||
| 114 | } | ||
| 115 | |||
| 116 | static inline struct fence * | ||
| 117 | reservation_object_get_excl(struct reservation_object *obj) | ||
| 118 | { | ||
| 119 | return rcu_dereference_protected(obj->fence_excl, | ||
| 120 | reservation_object_held(obj)); | ||
| 121 | } | ||
| 122 | |||
| 123 | int reservation_object_reserve_shared(struct reservation_object *obj); | ||
| 124 | void reservation_object_add_shared_fence(struct reservation_object *obj, | ||
| 125 | struct fence *fence); | ||
| 126 | |||
| 127 | void reservation_object_add_excl_fence(struct reservation_object *obj, | ||
| 128 | struct fence *fence); | ||
| 129 | |||
| 130 | int reservation_object_get_fences_rcu(struct reservation_object *obj, | ||
| 131 | struct fence **pfence_excl, | ||
| 132 | unsigned *pshared_count, | ||
| 133 | struct fence ***pshared); | ||
| 134 | |||
| 135 | long reservation_object_wait_timeout_rcu(struct reservation_object *obj, | ||
| 136 | bool wait_all, bool intr, | ||
| 137 | unsigned long timeout); | ||
| 138 | |||
| 139 | bool reservation_object_test_signaled_rcu(struct reservation_object *obj, | ||
| 140 | bool test_all); | ||
| 141 | |||
| 62 | #endif /* _LINUX_RESERVATION_H */ | 142 | #endif /* _LINUX_RESERVATION_H */ |
diff --git a/include/linux/rhashtable.h b/include/linux/rhashtable.h new file mode 100644 index 000000000000..9cda293c867d --- /dev/null +++ b/include/linux/rhashtable.h | |||
| @@ -0,0 +1,213 @@ | |||
| 1 | /* | ||
| 2 | * Resizable, Scalable, Concurrent Hash Table | ||
| 3 | * | ||
| 4 | * Copyright (c) 2014 Thomas Graf <tgraf@suug.ch> | ||
| 5 | * Copyright (c) 2008-2014 Patrick McHardy <kaber@trash.net> | ||
| 6 | * | ||
| 7 | * Based on the following paper by Josh Triplett, Paul E. McKenney | ||
| 8 | * and Jonathan Walpole: | ||
| 9 | * https://www.usenix.org/legacy/event/atc11/tech/final_files/Triplett.pdf | ||
| 10 | * | ||
| 11 | * Code partially derived from nft_hash | ||
| 12 | * | ||
| 13 | * This program is free software; you can redistribute it and/or modify | ||
| 14 | * it under the terms of the GNU General Public License version 2 as | ||
| 15 | * published by the Free Software Foundation. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #ifndef _LINUX_RHASHTABLE_H | ||
| 19 | #define _LINUX_RHASHTABLE_H | ||
| 20 | |||
| 21 | #include <linux/rculist.h> | ||
| 22 | |||
| 23 | struct rhash_head { | ||
| 24 | struct rhash_head *next; | ||
| 25 | }; | ||
| 26 | |||
| 27 | #define INIT_HASH_HEAD(ptr) ((ptr)->next = NULL) | ||
| 28 | |||
| 29 | struct bucket_table { | ||
| 30 | size_t size; | ||
| 31 | struct rhash_head __rcu *buckets[]; | ||
| 32 | }; | ||
| 33 | |||
| 34 | typedef u32 (*rht_hashfn_t)(const void *data, u32 len, u32 seed); | ||
| 35 | typedef u32 (*rht_obj_hashfn_t)(const void *data, u32 seed); | ||
| 36 | |||
| 37 | struct rhashtable; | ||
| 38 | |||
| 39 | /** | ||
| 40 | * struct rhashtable_params - Hash table construction parameters | ||
| 41 | * @nelem_hint: Hint on number of elements, should be 75% of desired size | ||
| 42 | * @key_len: Length of key | ||
| 43 | * @key_offset: Offset of key in struct to be hashed | ||
| 44 | * @head_offset: Offset of rhash_head in struct to be hashed | ||
| 45 | * @hash_rnd: Seed to use while hashing | ||
| 46 | * @max_shift: Maximum number of shifts while expanding | ||
| 47 | * @hashfn: Function to hash key | ||
| 48 | * @obj_hashfn: Function to hash object | ||
| 49 | * @grow_decision: If defined, may return true if table should expand | ||
| 50 | * @shrink_decision: If defined, may return true if table should shrink | ||
| 51 | * @mutex_is_held: Must return true if protecting mutex is held | ||
| 52 | */ | ||
| 53 | struct rhashtable_params { | ||
| 54 | size_t nelem_hint; | ||
| 55 | size_t key_len; | ||
| 56 | size_t key_offset; | ||
| 57 | size_t head_offset; | ||
| 58 | u32 hash_rnd; | ||
| 59 | size_t max_shift; | ||
| 60 | rht_hashfn_t hashfn; | ||
| 61 | rht_obj_hashfn_t obj_hashfn; | ||
| 62 | bool (*grow_decision)(const struct rhashtable *ht, | ||
| 63 | size_t new_size); | ||
| 64 | bool (*shrink_decision)(const struct rhashtable *ht, | ||
| 65 | size_t new_size); | ||
| 66 | int (*mutex_is_held)(void); | ||
| 67 | }; | ||
| 68 | |||
| 69 | /** | ||
| 70 | * struct rhashtable - Hash table handle | ||
| 71 | * @tbl: Bucket table | ||
| 72 | * @nelems: Number of elements in table | ||
| 73 | * @shift: Current size (1 << shift) | ||
| 74 | * @p: Configuration parameters | ||
| 75 | */ | ||
| 76 | struct rhashtable { | ||
| 77 | struct bucket_table __rcu *tbl; | ||
| 78 | size_t nelems; | ||
| 79 | size_t shift; | ||
| 80 | struct rhashtable_params p; | ||
| 81 | }; | ||
| 82 | |||
| 83 | #ifdef CONFIG_PROVE_LOCKING | ||
| 84 | int lockdep_rht_mutex_is_held(const struct rhashtable *ht); | ||
| 85 | #else | ||
| 86 | static inline int lockdep_rht_mutex_is_held(const struct rhashtable *ht) | ||
| 87 | { | ||
| 88 | return 1; | ||
| 89 | } | ||
| 90 | #endif /* CONFIG_PROVE_LOCKING */ | ||
| 91 | |||
| 92 | int rhashtable_init(struct rhashtable *ht, struct rhashtable_params *params); | ||
| 93 | |||
| 94 | u32 rhashtable_hashfn(const struct rhashtable *ht, const void *key, u32 len); | ||
| 95 | u32 rhashtable_obj_hashfn(const struct rhashtable *ht, void *ptr); | ||
| 96 | |||
| 97 | void rhashtable_insert(struct rhashtable *ht, struct rhash_head *node, gfp_t); | ||
| 98 | bool rhashtable_remove(struct rhashtable *ht, struct rhash_head *node, gfp_t); | ||
| 99 | void rhashtable_remove_pprev(struct rhashtable *ht, struct rhash_head *obj, | ||
| 100 | struct rhash_head **pprev, gfp_t flags); | ||
| 101 | |||
| 102 | bool rht_grow_above_75(const struct rhashtable *ht, size_t new_size); | ||
| 103 | bool rht_shrink_below_30(const struct rhashtable *ht, size_t new_size); | ||
| 104 | |||
| 105 | int rhashtable_expand(struct rhashtable *ht, gfp_t flags); | ||
| 106 | int rhashtable_shrink(struct rhashtable *ht, gfp_t flags); | ||
| 107 | |||
| 108 | void *rhashtable_lookup(const struct rhashtable *ht, const void *key); | ||
| 109 | void *rhashtable_lookup_compare(const struct rhashtable *ht, u32 hash, | ||
| 110 | bool (*compare)(void *, void *), void *arg); | ||
| 111 | |||
| 112 | void rhashtable_destroy(const struct rhashtable *ht); | ||
| 113 | |||
| 114 | #define rht_dereference(p, ht) \ | ||
| 115 | rcu_dereference_protected(p, lockdep_rht_mutex_is_held(ht)) | ||
| 116 | |||
| 117 | #define rht_dereference_rcu(p, ht) \ | ||
| 118 | rcu_dereference_check(p, lockdep_rht_mutex_is_held(ht)) | ||
| 119 | |||
| 120 | /* Internal, use rht_obj() instead */ | ||
| 121 | #define rht_entry(ptr, type, member) container_of(ptr, type, member) | ||
| 122 | #define rht_entry_safe(ptr, type, member) \ | ||
| 123 | ({ \ | ||
| 124 | typeof(ptr) __ptr = (ptr); \ | ||
| 125 | __ptr ? rht_entry(__ptr, type, member) : NULL; \ | ||
| 126 | }) | ||
| 127 | #define rht_entry_safe_rcu(ptr, type, member) \ | ||
| 128 | ({ \ | ||
| 129 | typeof(*ptr) __rcu *__ptr = (typeof(*ptr) __rcu __force *)ptr; \ | ||
| 130 | __ptr ? container_of((typeof(ptr))rcu_dereference_raw(__ptr), type, member) : NULL; \ | ||
| 131 | }) | ||
| 132 | |||
| 133 | #define rht_next_entry_safe(pos, ht, member) \ | ||
| 134 | ({ \ | ||
| 135 | pos ? rht_entry_safe(rht_dereference((pos)->member.next, ht), \ | ||
| 136 | typeof(*(pos)), member) : NULL; \ | ||
| 137 | }) | ||
| 138 | |||
| 139 | /** | ||
| 140 | * rht_for_each - iterate over hash chain | ||
| 141 | * @pos: &struct rhash_head to use as a loop cursor. | ||
| 142 | * @head: head of the hash chain (struct rhash_head *) | ||
| 143 | * @ht: pointer to your struct rhashtable | ||
| 144 | */ | ||
| 145 | #define rht_for_each(pos, head, ht) \ | ||
| 146 | for (pos = rht_dereference(head, ht); \ | ||
| 147 | pos; \ | ||
| 148 | pos = rht_dereference((pos)->next, ht)) | ||
| 149 | |||
| 150 | /** | ||
| 151 | * rht_for_each_entry - iterate over hash chain of given type | ||
| 152 | * @pos: type * to use as a loop cursor. | ||
| 153 | * @head: head of the hash chain (struct rhash_head *) | ||
| 154 | * @ht: pointer to your struct rhashtable | ||
| 155 | * @member: name of the rhash_head within the hashable struct. | ||
| 156 | */ | ||
| 157 | #define rht_for_each_entry(pos, head, ht, member) \ | ||
| 158 | for (pos = rht_entry_safe(rht_dereference(head, ht), \ | ||
| 159 | typeof(*(pos)), member); \ | ||
| 160 | pos; \ | ||
| 161 | pos = rht_next_entry_safe(pos, ht, member)) | ||
| 162 | |||
| 163 | /** | ||
| 164 | * rht_for_each_entry_safe - safely iterate over hash chain of given type | ||
| 165 | * @pos: type * to use as a loop cursor. | ||
| 166 | * @n: type * to use for temporary next object storage | ||
| 167 | * @head: head of the hash chain (struct rhash_head *) | ||
| 168 | * @ht: pointer to your struct rhashtable | ||
| 169 | * @member: name of the rhash_head within the hashable struct. | ||
| 170 | * | ||
| 171 | * This hash chain list-traversal primitive allows for the looped code to | ||
| 172 | * remove the loop cursor from the list. | ||
| 173 | */ | ||
| 174 | #define rht_for_each_entry_safe(pos, n, head, ht, member) \ | ||
| 175 | for (pos = rht_entry_safe(rht_dereference(head, ht), \ | ||
| 176 | typeof(*(pos)), member), \ | ||
| 177 | n = rht_next_entry_safe(pos, ht, member); \ | ||
| 178 | pos; \ | ||
| 179 | pos = n, \ | ||
| 180 | n = rht_next_entry_safe(pos, ht, member)) | ||
| 181 | |||
| 182 | /** | ||
| 183 | * rht_for_each_rcu - iterate over rcu hash chain | ||
| 184 | * @pos: &struct rhash_head to use as a loop cursor. | ||
| 185 | * @head: head of the hash chain (struct rhash_head *) | ||
| 186 | * @ht: pointer to your struct rhashtable | ||
| 187 | * | ||
| 188 | * This hash chain list-traversal primitive may safely run concurrently with | ||
| 189 | * the _rcu fkht mutation primitives such as rht_insert() as long as the | ||
| 190 | * traversal is guarded by rcu_read_lock(). | ||
| 191 | */ | ||
| 192 | #define rht_for_each_rcu(pos, head, ht) \ | ||
| 193 | for (pos = rht_dereference_rcu(head, ht); \ | ||
| 194 | pos; \ | ||
| 195 | pos = rht_dereference_rcu((pos)->next, ht)) | ||
| 196 | |||
| 197 | /** | ||
| 198 | * rht_for_each_entry_rcu - iterate over rcu hash chain of given type | ||
| 199 | * @pos: type * to use as a loop cursor. | ||
| 200 | * @head: head of the hash chain (struct rhash_head *) | ||
| 201 | * @member: name of the rhash_head within the hashable struct. | ||
| 202 | * | ||
| 203 | * This hash chain list-traversal primitive may safely run concurrently with | ||
| 204 | * the _rcu fkht mutation primitives such as rht_insert() as long as the | ||
| 205 | * traversal is guarded by rcu_read_lock(). | ||
| 206 | */ | ||
| 207 | #define rht_for_each_entry_rcu(pos, head, member) \ | ||
| 208 | for (pos = rht_entry_safe_rcu(head, typeof(*(pos)), member); \ | ||
| 209 | pos; \ | ||
| 210 | pos = rht_entry_safe_rcu((pos)->member.next, \ | ||
| 211 | typeof(*(pos)), member)) | ||
| 212 | |||
| 213 | #endif /* _LINUX_RHASHTABLE_H */ | ||
diff --git a/include/linux/rndis.h b/include/linux/rndis.h index 0c8dc7195cdb..93c0a64aefa6 100644 --- a/include/linux/rndis.h +++ b/include/linux/rndis.h | |||
| @@ -65,6 +65,7 @@ | |||
| 65 | #define RNDIS_STATUS_MEDIA_SPECIFIC_INDICATION 0x40010012 | 65 | #define RNDIS_STATUS_MEDIA_SPECIFIC_INDICATION 0x40010012 |
| 66 | #define RNDIS_STATUS_WW_INDICATION RDIA_SPECIFIC_INDICATION | 66 | #define RNDIS_STATUS_WW_INDICATION RDIA_SPECIFIC_INDICATION |
| 67 | #define RNDIS_STATUS_LINK_SPEED_CHANGE 0x40010013L | 67 | #define RNDIS_STATUS_LINK_SPEED_CHANGE 0x40010013L |
| 68 | #define RNDIS_STATUS_NETWORK_CHANGE 0x40010018 | ||
| 68 | 69 | ||
| 69 | #define RNDIS_STATUS_NOT_RESETTABLE 0x80010001 | 70 | #define RNDIS_STATUS_NOT_RESETTABLE 0x80010001 |
| 70 | #define RNDIS_STATUS_SOFT_ERRORS 0x80010003 | 71 | #define RNDIS_STATUS_SOFT_ERRORS 0x80010003 |
diff --git a/include/linux/rtmutex.h b/include/linux/rtmutex.h index 3aed8d737e1a..1abba5ce2a2f 100644 --- a/include/linux/rtmutex.h +++ b/include/linux/rtmutex.h | |||
| @@ -90,11 +90,9 @@ extern void __rt_mutex_init(struct rt_mutex *lock, const char *name); | |||
| 90 | extern void rt_mutex_destroy(struct rt_mutex *lock); | 90 | extern void rt_mutex_destroy(struct rt_mutex *lock); |
| 91 | 91 | ||
| 92 | extern void rt_mutex_lock(struct rt_mutex *lock); | 92 | extern void rt_mutex_lock(struct rt_mutex *lock); |
| 93 | extern int rt_mutex_lock_interruptible(struct rt_mutex *lock, | 93 | extern int rt_mutex_lock_interruptible(struct rt_mutex *lock); |
| 94 | int detect_deadlock); | ||
| 95 | extern int rt_mutex_timed_lock(struct rt_mutex *lock, | 94 | extern int rt_mutex_timed_lock(struct rt_mutex *lock, |
| 96 | struct hrtimer_sleeper *timeout, | 95 | struct hrtimer_sleeper *timeout); |
| 97 | int detect_deadlock); | ||
| 98 | 96 | ||
| 99 | extern int rt_mutex_trylock(struct rt_mutex *lock); | 97 | extern int rt_mutex_trylock(struct rt_mutex *lock); |
| 100 | 98 | ||
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h index 953937ea5233..167bae7bdfa4 100644 --- a/include/linux/rtnetlink.h +++ b/include/linux/rtnetlink.h | |||
| @@ -78,6 +78,7 @@ extern void __rtnl_unlock(void); | |||
| 78 | extern int ndo_dflt_fdb_dump(struct sk_buff *skb, | 78 | extern int ndo_dflt_fdb_dump(struct sk_buff *skb, |
| 79 | struct netlink_callback *cb, | 79 | struct netlink_callback *cb, |
| 80 | struct net_device *dev, | 80 | struct net_device *dev, |
| 81 | struct net_device *filter_dev, | ||
| 81 | int idx); | 82 | int idx); |
| 82 | extern int ndo_dflt_fdb_add(struct ndmsg *ndm, | 83 | extern int ndo_dflt_fdb_add(struct ndmsg *ndm, |
| 83 | struct nlattr *tb[], | 84 | struct nlattr *tb[], |
diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h index a964f7285600..f4ec8bbcb372 100644 --- a/include/linux/scatterlist.h +++ b/include/linux/scatterlist.h | |||
| @@ -229,10 +229,10 @@ void sg_init_one(struct scatterlist *, const void *, unsigned int); | |||
| 229 | typedef struct scatterlist *(sg_alloc_fn)(unsigned int, gfp_t); | 229 | typedef struct scatterlist *(sg_alloc_fn)(unsigned int, gfp_t); |
| 230 | typedef void (sg_free_fn)(struct scatterlist *, unsigned int); | 230 | typedef void (sg_free_fn)(struct scatterlist *, unsigned int); |
| 231 | 231 | ||
| 232 | void __sg_free_table(struct sg_table *, unsigned int, sg_free_fn *); | 232 | void __sg_free_table(struct sg_table *, unsigned int, bool, sg_free_fn *); |
| 233 | void sg_free_table(struct sg_table *); | 233 | void sg_free_table(struct sg_table *); |
| 234 | int __sg_alloc_table(struct sg_table *, unsigned int, unsigned int, gfp_t, | 234 | int __sg_alloc_table(struct sg_table *, unsigned int, unsigned int, |
| 235 | sg_alloc_fn *); | 235 | struct scatterlist *, gfp_t, sg_alloc_fn *); |
| 236 | int sg_alloc_table(struct sg_table *, unsigned int, gfp_t); | 236 | int sg_alloc_table(struct sg_table *, unsigned int, gfp_t); |
| 237 | int sg_alloc_table_from_pages(struct sg_table *sgt, | 237 | int sg_alloc_table_from_pages(struct sg_table *sgt, |
| 238 | struct page **pages, unsigned int n_pages, | 238 | struct page **pages, unsigned int n_pages, |
diff --git a/include/linux/sched.h b/include/linux/sched.h index 0376b054a0d0..84729f7c472c 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
| @@ -168,8 +168,7 @@ extern int nr_processes(void); | |||
| 168 | extern unsigned long nr_running(void); | 168 | extern unsigned long nr_running(void); |
| 169 | extern unsigned long nr_iowait(void); | 169 | extern unsigned long nr_iowait(void); |
| 170 | extern unsigned long nr_iowait_cpu(int cpu); | 170 | extern unsigned long nr_iowait_cpu(int cpu); |
| 171 | extern unsigned long this_cpu_load(void); | 171 | extern void get_iowait_load(unsigned long *nr_waiters, unsigned long *load); |
| 172 | |||
| 173 | 172 | ||
| 174 | extern void calc_global_load(unsigned long ticks); | 173 | extern void calc_global_load(unsigned long ticks); |
| 175 | extern void update_cpu_load_nohz(void); | 174 | extern void update_cpu_load_nohz(void); |
| @@ -813,7 +812,7 @@ struct task_delay_info { | |||
| 813 | * associated with the operation is added to XXX_delay. | 812 | * associated with the operation is added to XXX_delay. |
| 814 | * XXX_delay contains the accumulated delay time in nanoseconds. | 813 | * XXX_delay contains the accumulated delay time in nanoseconds. |
| 815 | */ | 814 | */ |
| 816 | struct timespec blkio_start, blkio_end; /* Shared by blkio, swapin */ | 815 | u64 blkio_start; /* Shared by blkio, swapin */ |
| 817 | u64 blkio_delay; /* wait for sync block io completion */ | 816 | u64 blkio_delay; /* wait for sync block io completion */ |
| 818 | u64 swapin_delay; /* wait for swapin block io completion */ | 817 | u64 swapin_delay; /* wait for swapin block io completion */ |
| 819 | u32 blkio_count; /* total count of the number of sync block */ | 818 | u32 blkio_count; /* total count of the number of sync block */ |
| @@ -821,7 +820,7 @@ struct task_delay_info { | |||
| 821 | u32 swapin_count; /* total count of the number of swapin block */ | 820 | u32 swapin_count; /* total count of the number of swapin block */ |
| 822 | /* io operations performed */ | 821 | /* io operations performed */ |
| 823 | 822 | ||
| 824 | struct timespec freepages_start, freepages_end; | 823 | u64 freepages_start; |
| 825 | u64 freepages_delay; /* wait for memory reclaim */ | 824 | u64 freepages_delay; /* wait for memory reclaim */ |
| 826 | u32 freepages_count; /* total count of memory reclaim */ | 825 | u32 freepages_count; /* total count of memory reclaim */ |
| 827 | }; | 826 | }; |
| @@ -1270,9 +1269,6 @@ struct task_struct { | |||
| 1270 | #ifdef CONFIG_TREE_PREEMPT_RCU | 1269 | #ifdef CONFIG_TREE_PREEMPT_RCU |
| 1271 | struct rcu_node *rcu_blocked_node; | 1270 | struct rcu_node *rcu_blocked_node; |
| 1272 | #endif /* #ifdef CONFIG_TREE_PREEMPT_RCU */ | 1271 | #endif /* #ifdef CONFIG_TREE_PREEMPT_RCU */ |
| 1273 | #ifdef CONFIG_RCU_BOOST | ||
| 1274 | struct rt_mutex *rcu_boost_mutex; | ||
| 1275 | #endif /* #ifdef CONFIG_RCU_BOOST */ | ||
| 1276 | 1272 | ||
| 1277 | #if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT) | 1273 | #if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT) |
| 1278 | struct sched_info sched_info; | 1274 | struct sched_info sched_info; |
| @@ -1307,13 +1303,12 @@ struct task_struct { | |||
| 1307 | * execve */ | 1303 | * execve */ |
| 1308 | unsigned in_iowait:1; | 1304 | unsigned in_iowait:1; |
| 1309 | 1305 | ||
| 1310 | /* task may not gain privileges */ | ||
| 1311 | unsigned no_new_privs:1; | ||
| 1312 | |||
| 1313 | /* Revert to default priority/policy when forking */ | 1306 | /* Revert to default priority/policy when forking */ |
| 1314 | unsigned sched_reset_on_fork:1; | 1307 | unsigned sched_reset_on_fork:1; |
| 1315 | unsigned sched_contributes_to_load:1; | 1308 | unsigned sched_contributes_to_load:1; |
| 1316 | 1309 | ||
| 1310 | unsigned long atomic_flags; /* Flags needing atomic access. */ | ||
| 1311 | |||
| 1317 | pid_t pid; | 1312 | pid_t pid; |
| 1318 | pid_t tgid; | 1313 | pid_t tgid; |
| 1319 | 1314 | ||
| @@ -1367,8 +1362,8 @@ struct task_struct { | |||
| 1367 | } vtime_snap_whence; | 1362 | } vtime_snap_whence; |
| 1368 | #endif | 1363 | #endif |
| 1369 | unsigned long nvcsw, nivcsw; /* context switch counts */ | 1364 | unsigned long nvcsw, nivcsw; /* context switch counts */ |
| 1370 | struct timespec start_time; /* monotonic time */ | 1365 | u64 start_time; /* monotonic time in nsec */ |
| 1371 | struct timespec real_start_time; /* boot based time */ | 1366 | u64 real_start_time; /* boot based time in nsec */ |
| 1372 | /* mm fault and swap info: this can arguably be seen as either mm-specific or thread-specific */ | 1367 | /* mm fault and swap info: this can arguably be seen as either mm-specific or thread-specific */ |
| 1373 | unsigned long min_flt, maj_flt; | 1368 | unsigned long min_flt, maj_flt; |
| 1374 | 1369 | ||
| @@ -1440,8 +1435,6 @@ struct task_struct { | |||
| 1440 | struct rb_node *pi_waiters_leftmost; | 1435 | struct rb_node *pi_waiters_leftmost; |
| 1441 | /* Deadlock detection and priority inheritance handling */ | 1436 | /* Deadlock detection and priority inheritance handling */ |
| 1442 | struct rt_mutex_waiter *pi_blocked_on; | 1437 | struct rt_mutex_waiter *pi_blocked_on; |
| 1443 | /* Top pi_waiters task */ | ||
| 1444 | struct task_struct *pi_top_task; | ||
| 1445 | #endif | 1438 | #endif |
| 1446 | 1439 | ||
| 1447 | #ifdef CONFIG_DEBUG_MUTEXES | 1440 | #ifdef CONFIG_DEBUG_MUTEXES |
| @@ -1967,6 +1960,19 @@ static inline void memalloc_noio_restore(unsigned int flags) | |||
| 1967 | current->flags = (current->flags & ~PF_MEMALLOC_NOIO) | flags; | 1960 | current->flags = (current->flags & ~PF_MEMALLOC_NOIO) | flags; |
| 1968 | } | 1961 | } |
| 1969 | 1962 | ||
| 1963 | /* Per-process atomic flags. */ | ||
| 1964 | #define PFA_NO_NEW_PRIVS 0x00000001 /* May not gain new privileges. */ | ||
| 1965 | |||
| 1966 | static inline bool task_no_new_privs(struct task_struct *p) | ||
| 1967 | { | ||
| 1968 | return test_bit(PFA_NO_NEW_PRIVS, &p->atomic_flags); | ||
| 1969 | } | ||
| 1970 | |||
| 1971 | static inline void task_set_no_new_privs(struct task_struct *p) | ||
| 1972 | { | ||
| 1973 | set_bit(PFA_NO_NEW_PRIVS, &p->atomic_flags); | ||
| 1974 | } | ||
| 1975 | |||
| 1970 | /* | 1976 | /* |
| 1971 | * task->jobctl flags | 1977 | * task->jobctl flags |
| 1972 | */ | 1978 | */ |
| @@ -2009,9 +2015,6 @@ static inline void rcu_copy_process(struct task_struct *p) | |||
| 2009 | #ifdef CONFIG_TREE_PREEMPT_RCU | 2015 | #ifdef CONFIG_TREE_PREEMPT_RCU |
| 2010 | p->rcu_blocked_node = NULL; | 2016 | p->rcu_blocked_node = NULL; |
| 2011 | #endif /* #ifdef CONFIG_TREE_PREEMPT_RCU */ | 2017 | #endif /* #ifdef CONFIG_TREE_PREEMPT_RCU */ |
| 2012 | #ifdef CONFIG_RCU_BOOST | ||
| 2013 | p->rcu_boost_mutex = NULL; | ||
| 2014 | #endif /* #ifdef CONFIG_RCU_BOOST */ | ||
| 2015 | INIT_LIST_HEAD(&p->rcu_node_entry); | 2018 | INIT_LIST_HEAD(&p->rcu_node_entry); |
| 2016 | } | 2019 | } |
| 2017 | 2020 | ||
| @@ -2788,7 +2791,7 @@ static inline bool __must_check current_set_polling_and_test(void) | |||
| 2788 | 2791 | ||
| 2789 | /* | 2792 | /* |
| 2790 | * Polling state must be visible before we test NEED_RESCHED, | 2793 | * Polling state must be visible before we test NEED_RESCHED, |
| 2791 | * paired by resched_task() | 2794 | * paired by resched_curr() |
| 2792 | */ | 2795 | */ |
| 2793 | smp_mb__after_atomic(); | 2796 | smp_mb__after_atomic(); |
| 2794 | 2797 | ||
| @@ -2806,7 +2809,7 @@ static inline bool __must_check current_clr_polling_and_test(void) | |||
| 2806 | 2809 | ||
| 2807 | /* | 2810 | /* |
| 2808 | * Polling state must be visible before we test NEED_RESCHED, | 2811 | * Polling state must be visible before we test NEED_RESCHED, |
| 2809 | * paired by resched_task() | 2812 | * paired by resched_curr() |
| 2810 | */ | 2813 | */ |
| 2811 | smp_mb__after_atomic(); | 2814 | smp_mb__after_atomic(); |
| 2812 | 2815 | ||
| @@ -2838,7 +2841,7 @@ static inline void current_clr_polling(void) | |||
| 2838 | * TIF_NEED_RESCHED and the IPI handler, scheduler_ipi(), will also | 2841 | * TIF_NEED_RESCHED and the IPI handler, scheduler_ipi(), will also |
| 2839 | * fold. | 2842 | * fold. |
| 2840 | */ | 2843 | */ |
| 2841 | smp_mb(); /* paired with resched_task() */ | 2844 | smp_mb(); /* paired with resched_curr() */ |
| 2842 | 2845 | ||
| 2843 | preempt_fold_need_resched(); | 2846 | preempt_fold_need_resched(); |
| 2844 | } | 2847 | } |
diff --git a/include/linux/seccomp.h b/include/linux/seccomp.h index 4054b0994071..5d586a45a319 100644 --- a/include/linux/seccomp.h +++ b/include/linux/seccomp.h | |||
| @@ -3,6 +3,8 @@ | |||
| 3 | 3 | ||
| 4 | #include <uapi/linux/seccomp.h> | 4 | #include <uapi/linux/seccomp.h> |
| 5 | 5 | ||
| 6 | #define SECCOMP_FILTER_FLAG_MASK (SECCOMP_FILTER_FLAG_TSYNC) | ||
| 7 | |||
| 6 | #ifdef CONFIG_SECCOMP | 8 | #ifdef CONFIG_SECCOMP |
| 7 | 9 | ||
| 8 | #include <linux/thread_info.h> | 10 | #include <linux/thread_info.h> |
| @@ -14,11 +16,11 @@ struct seccomp_filter; | |||
| 14 | * | 16 | * |
| 15 | * @mode: indicates one of the valid values above for controlled | 17 | * @mode: indicates one of the valid values above for controlled |
| 16 | * system calls available to a process. | 18 | * system calls available to a process. |
| 17 | * @filter: The metadata and ruleset for determining what system calls | 19 | * @filter: must always point to a valid seccomp-filter or NULL as it is |
| 18 | * are allowed for a task. | 20 | * accessed without locking during system call entry. |
| 19 | * | 21 | * |
| 20 | * @filter must only be accessed from the context of current as there | 22 | * @filter must only be accessed from the context of current as there |
| 21 | * is no locking. | 23 | * is no read locking. |
| 22 | */ | 24 | */ |
| 23 | struct seccomp { | 25 | struct seccomp { |
| 24 | int mode; | 26 | int mode; |
diff --git a/include/linux/security.h b/include/linux/security.h index 9c6b9722ff48..623f90e5f38d 100644 --- a/include/linux/security.h +++ b/include/linux/security.h | |||
| @@ -702,6 +702,15 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
| 702 | * @inode points to the inode to use as a reference. | 702 | * @inode points to the inode to use as a reference. |
| 703 | * The current task must be the one that nominated @inode. | 703 | * The current task must be the one that nominated @inode. |
| 704 | * Return 0 if successful. | 704 | * Return 0 if successful. |
| 705 | * @kernel_fw_from_file: | ||
| 706 | * Load firmware from userspace (not called for built-in firmware). | ||
| 707 | * @file contains the file structure pointing to the file containing | ||
| 708 | * the firmware to load. This argument will be NULL if the firmware | ||
| 709 | * was loaded via the uevent-triggered blob-based interface exposed | ||
| 710 | * by CONFIG_FW_LOADER_USER_HELPER. | ||
| 711 | * @buf pointer to buffer containing firmware contents. | ||
| 712 | * @size length of the firmware contents. | ||
| 713 | * Return 0 if permission is granted. | ||
| 705 | * @kernel_module_request: | 714 | * @kernel_module_request: |
| 706 | * Ability to trigger the kernel to automatically upcall to userspace for | 715 | * Ability to trigger the kernel to automatically upcall to userspace for |
| 707 | * userspace to load a kernel module with the given name. | 716 | * userspace to load a kernel module with the given name. |
| @@ -1565,6 +1574,7 @@ struct security_operations { | |||
| 1565 | void (*cred_transfer)(struct cred *new, const struct cred *old); | 1574 | void (*cred_transfer)(struct cred *new, const struct cred *old); |
| 1566 | int (*kernel_act_as)(struct cred *new, u32 secid); | 1575 | int (*kernel_act_as)(struct cred *new, u32 secid); |
| 1567 | int (*kernel_create_files_as)(struct cred *new, struct inode *inode); | 1576 | int (*kernel_create_files_as)(struct cred *new, struct inode *inode); |
| 1577 | int (*kernel_fw_from_file)(struct file *file, char *buf, size_t size); | ||
| 1568 | int (*kernel_module_request)(char *kmod_name); | 1578 | int (*kernel_module_request)(char *kmod_name); |
| 1569 | int (*kernel_module_from_file)(struct file *file); | 1579 | int (*kernel_module_from_file)(struct file *file); |
| 1570 | int (*task_fix_setuid) (struct cred *new, const struct cred *old, | 1580 | int (*task_fix_setuid) (struct cred *new, const struct cred *old, |
| @@ -1837,6 +1847,7 @@ int security_prepare_creds(struct cred *new, const struct cred *old, gfp_t gfp); | |||
| 1837 | void security_transfer_creds(struct cred *new, const struct cred *old); | 1847 | void security_transfer_creds(struct cred *new, const struct cred *old); |
| 1838 | int security_kernel_act_as(struct cred *new, u32 secid); | 1848 | int security_kernel_act_as(struct cred *new, u32 secid); |
| 1839 | int security_kernel_create_files_as(struct cred *new, struct inode *inode); | 1849 | int security_kernel_create_files_as(struct cred *new, struct inode *inode); |
| 1850 | int security_kernel_fw_from_file(struct file *file, char *buf, size_t size); | ||
| 1840 | int security_kernel_module_request(char *kmod_name); | 1851 | int security_kernel_module_request(char *kmod_name); |
| 1841 | int security_kernel_module_from_file(struct file *file); | 1852 | int security_kernel_module_from_file(struct file *file); |
| 1842 | int security_task_fix_setuid(struct cred *new, const struct cred *old, | 1853 | int security_task_fix_setuid(struct cred *new, const struct cred *old, |
| @@ -2363,6 +2374,12 @@ static inline int security_kernel_create_files_as(struct cred *cred, | |||
| 2363 | return 0; | 2374 | return 0; |
| 2364 | } | 2375 | } |
| 2365 | 2376 | ||
| 2377 | static inline int security_kernel_fw_from_file(struct file *file, | ||
| 2378 | char *buf, size_t size) | ||
| 2379 | { | ||
| 2380 | return 0; | ||
| 2381 | } | ||
| 2382 | |||
| 2366 | static inline int security_kernel_module_request(char *kmod_name) | 2383 | static inline int security_kernel_module_request(char *kmod_name) |
| 2367 | { | 2384 | { |
| 2368 | return 0; | 2385 | return 0; |
diff --git a/include/linux/seqlock.h b/include/linux/seqlock.h index 535f158977b9..cc359636cfa3 100644 --- a/include/linux/seqlock.h +++ b/include/linux/seqlock.h | |||
| @@ -117,6 +117,22 @@ repeat: | |||
| 117 | } | 117 | } |
| 118 | 118 | ||
| 119 | /** | 119 | /** |
| 120 | * raw_read_seqcount - Read the raw seqcount | ||
| 121 | * @s: pointer to seqcount_t | ||
| 122 | * Returns: count to be passed to read_seqcount_retry | ||
| 123 | * | ||
| 124 | * raw_read_seqcount opens a read critical section of the given | ||
| 125 | * seqcount without any lockdep checking and without checking or | ||
| 126 | * masking the LSB. Calling code is responsible for handling that. | ||
| 127 | */ | ||
| 128 | static inline unsigned raw_read_seqcount(const seqcount_t *s) | ||
| 129 | { | ||
| 130 | unsigned ret = ACCESS_ONCE(s->sequence); | ||
| 131 | smp_rmb(); | ||
| 132 | return ret; | ||
| 133 | } | ||
| 134 | |||
| 135 | /** | ||
| 120 | * raw_read_seqcount_begin - start seq-read critical section w/o lockdep | 136 | * raw_read_seqcount_begin - start seq-read critical section w/o lockdep |
| 121 | * @s: pointer to seqcount_t | 137 | * @s: pointer to seqcount_t |
| 122 | * Returns: count to be passed to read_seqcount_retry | 138 | * Returns: count to be passed to read_seqcount_retry |
| @@ -164,8 +180,6 @@ static inline unsigned read_seqcount_begin(const seqcount_t *s) | |||
| 164 | static inline unsigned raw_seqcount_begin(const seqcount_t *s) | 180 | static inline unsigned raw_seqcount_begin(const seqcount_t *s) |
| 165 | { | 181 | { |
| 166 | unsigned ret = ACCESS_ONCE(s->sequence); | 182 | unsigned ret = ACCESS_ONCE(s->sequence); |
| 167 | |||
| 168 | seqcount_lockdep_reader_access(s); | ||
| 169 | smp_rmb(); | 183 | smp_rmb(); |
| 170 | return ret & ~1; | 184 | return ret & ~1; |
| 171 | } | 185 | } |
| @@ -220,6 +234,17 @@ static inline void raw_write_seqcount_end(seqcount_t *s) | |||
| 220 | } | 234 | } |
| 221 | 235 | ||
| 222 | /* | 236 | /* |
| 237 | * raw_write_seqcount_latch - redirect readers to even/odd copy | ||
| 238 | * @s: pointer to seqcount_t | ||
| 239 | */ | ||
| 240 | static inline void raw_write_seqcount_latch(seqcount_t *s) | ||
| 241 | { | ||
| 242 | smp_wmb(); /* prior stores before incrementing "sequence" */ | ||
| 243 | s->sequence++; | ||
| 244 | smp_wmb(); /* increment "sequence" before following stores */ | ||
| 245 | } | ||
| 246 | |||
| 247 | /* | ||
| 223 | * Sequence counter only version assumes that callers are using their | 248 | * Sequence counter only version assumes that callers are using their |
| 224 | * own mutexing. | 249 | * own mutexing. |
| 225 | */ | 250 | */ |
diff --git a/include/linux/seqno-fence.h b/include/linux/seqno-fence.h new file mode 100644 index 000000000000..3d6003de4b0d --- /dev/null +++ b/include/linux/seqno-fence.h | |||
| @@ -0,0 +1,116 @@ | |||
| 1 | /* | ||
| 2 | * seqno-fence, using a dma-buf to synchronize fencing | ||
| 3 | * | ||
| 4 | * Copyright (C) 2012 Texas Instruments | ||
| 5 | * Copyright (C) 2012 Canonical Ltd | ||
| 6 | * Authors: | ||
| 7 | * Rob Clark <robdclark@gmail.com> | ||
| 8 | * Maarten Lankhorst <maarten.lankhorst@canonical.com> | ||
| 9 | * | ||
| 10 | * This program is free software; you can redistribute it and/or modify it | ||
| 11 | * under the terms of the GNU General Public License version 2 as published by | ||
| 12 | * the Free Software Foundation. | ||
| 13 | * | ||
| 14 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
| 15 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| 16 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
| 17 | * more details. | ||
| 18 | */ | ||
| 19 | |||
| 20 | #ifndef __LINUX_SEQNO_FENCE_H | ||
| 21 | #define __LINUX_SEQNO_FENCE_H | ||
| 22 | |||
| 23 | #include <linux/fence.h> | ||
| 24 | #include <linux/dma-buf.h> | ||
| 25 | |||
| 26 | enum seqno_fence_condition { | ||
| 27 | SEQNO_FENCE_WAIT_GEQUAL, | ||
| 28 | SEQNO_FENCE_WAIT_NONZERO | ||
| 29 | }; | ||
| 30 | |||
| 31 | struct seqno_fence { | ||
| 32 | struct fence base; | ||
| 33 | |||
| 34 | const struct fence_ops *ops; | ||
| 35 | struct dma_buf *sync_buf; | ||
| 36 | uint32_t seqno_ofs; | ||
| 37 | enum seqno_fence_condition condition; | ||
| 38 | }; | ||
| 39 | |||
| 40 | extern const struct fence_ops seqno_fence_ops; | ||
| 41 | |||
| 42 | /** | ||
| 43 | * to_seqno_fence - cast a fence to a seqno_fence | ||
| 44 | * @fence: fence to cast to a seqno_fence | ||
| 45 | * | ||
| 46 | * Returns NULL if the fence is not a seqno_fence, | ||
| 47 | * or the seqno_fence otherwise. | ||
| 48 | */ | ||
| 49 | static inline struct seqno_fence * | ||
| 50 | to_seqno_fence(struct fence *fence) | ||
| 51 | { | ||
| 52 | if (fence->ops != &seqno_fence_ops) | ||
| 53 | return NULL; | ||
| 54 | return container_of(fence, struct seqno_fence, base); | ||
| 55 | } | ||
| 56 | |||
| 57 | /** | ||
| 58 | * seqno_fence_init - initialize a seqno fence | ||
| 59 | * @fence: seqno_fence to initialize | ||
| 60 | * @lock: pointer to spinlock to use for fence | ||
| 61 | * @sync_buf: buffer containing the memory location to signal on | ||
| 62 | * @context: the execution context this fence is a part of | ||
| 63 | * @seqno_ofs: the offset within @sync_buf | ||
| 64 | * @seqno: the sequence # to signal on | ||
| 65 | * @ops: the fence_ops for operations on this seqno fence | ||
| 66 | * | ||
| 67 | * This function initializes a struct seqno_fence with passed parameters, | ||
| 68 | * and takes a reference on sync_buf which is released on fence destruction. | ||
| 69 | * | ||
| 70 | * A seqno_fence is a dma_fence which can complete in software when | ||
| 71 | * enable_signaling is called, but it also completes when | ||
| 72 | * (s32)((sync_buf)[seqno_ofs] - seqno) >= 0 is true | ||
| 73 | * | ||
| 74 | * The seqno_fence will take a refcount on the sync_buf until it's | ||
| 75 | * destroyed, but actual lifetime of sync_buf may be longer if one of the | ||
| 76 | * callers take a reference to it. | ||
| 77 | * | ||
| 78 | * Certain hardware have instructions to insert this type of wait condition | ||
| 79 | * in the command stream, so no intervention from software would be needed. | ||
| 80 | * This type of fence can be destroyed before completed, however a reference | ||
| 81 | * on the sync_buf dma-buf can be taken. It is encouraged to re-use the same | ||
| 82 | * dma-buf for sync_buf, since mapping or unmapping the sync_buf to the | ||
| 83 | * device's vm can be expensive. | ||
| 84 | * | ||
| 85 | * It is recommended for creators of seqno_fence to call fence_signal | ||
| 86 | * before destruction. This will prevent possible issues from wraparound at | ||
| 87 | * time of issue vs time of check, since users can check fence_is_signaled | ||
| 88 | * before submitting instructions for the hardware to wait on the fence. | ||
| 89 | * However, when ops.enable_signaling is not called, it doesn't have to be | ||
| 90 | * done as soon as possible, just before there's any real danger of seqno | ||
| 91 | * wraparound. | ||
| 92 | */ | ||
| 93 | static inline void | ||
| 94 | seqno_fence_init(struct seqno_fence *fence, spinlock_t *lock, | ||
| 95 | struct dma_buf *sync_buf, uint32_t context, | ||
| 96 | uint32_t seqno_ofs, uint32_t seqno, | ||
| 97 | enum seqno_fence_condition cond, | ||
| 98 | const struct fence_ops *ops) | ||
| 99 | { | ||
| 100 | BUG_ON(!fence || !sync_buf || !ops); | ||
| 101 | BUG_ON(!ops->wait || !ops->enable_signaling || | ||
| 102 | !ops->get_driver_name || !ops->get_timeline_name); | ||
| 103 | |||
| 104 | /* | ||
| 105 | * ops is used in fence_init for get_driver_name, so needs to be | ||
| 106 | * initialized first | ||
| 107 | */ | ||
| 108 | fence->ops = ops; | ||
| 109 | fence_init(&fence->base, &seqno_fence_ops, lock, context, seqno); | ||
| 110 | get_dma_buf(sync_buf); | ||
| 111 | fence->sync_buf = sync_buf; | ||
| 112 | fence->seqno_ofs = seqno_ofs; | ||
| 113 | fence->condition = cond; | ||
| 114 | } | ||
| 115 | |||
| 116 | #endif /* __LINUX_SEQNO_FENCE_H */ | ||
diff --git a/include/linux/serial_8250.h b/include/linux/serial_8250.h index af47a8af6024..f93649e22c43 100644 --- a/include/linux/serial_8250.h +++ b/include/linux/serial_8250.h | |||
| @@ -74,8 +74,10 @@ struct uart_8250_port { | |||
| 74 | struct list_head list; /* ports on this IRQ */ | 74 | struct list_head list; /* ports on this IRQ */ |
| 75 | unsigned short capabilities; /* port capabilities */ | 75 | unsigned short capabilities; /* port capabilities */ |
| 76 | unsigned short bugs; /* port bugs */ | 76 | unsigned short bugs; /* port bugs */ |
| 77 | bool fifo_bug; /* min RX trigger if enabled */ | ||
| 77 | unsigned int tx_loadsz; /* transmit fifo load size */ | 78 | unsigned int tx_loadsz; /* transmit fifo load size */ |
| 78 | unsigned char acr; | 79 | unsigned char acr; |
| 80 | unsigned char fcr; | ||
| 79 | unsigned char ier; | 81 | unsigned char ier; |
| 80 | unsigned char lcr; | 82 | unsigned char lcr; |
| 81 | unsigned char mcr; | 83 | unsigned char mcr; |
| @@ -100,6 +102,11 @@ struct uart_8250_port { | |||
| 100 | void (*dl_write)(struct uart_8250_port *, int); | 102 | void (*dl_write)(struct uart_8250_port *, int); |
| 101 | }; | 103 | }; |
| 102 | 104 | ||
| 105 | static inline struct uart_8250_port *up_to_u8250p(struct uart_port *up) | ||
| 106 | { | ||
| 107 | return container_of(up, struct uart_8250_port, port); | ||
| 108 | } | ||
| 109 | |||
| 103 | int serial8250_register_8250_port(struct uart_8250_port *); | 110 | int serial8250_register_8250_port(struct uart_8250_port *); |
| 104 | void serial8250_unregister_port(int line); | 111 | void serial8250_unregister_port(int line); |
| 105 | void serial8250_suspend_port(int line); | 112 | void serial8250_suspend_port(int line); |
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index 5bbb809ee197..cf3a1e789bf5 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h | |||
| @@ -199,6 +199,8 @@ struct uart_port { | |||
| 199 | unsigned char suspended; | 199 | unsigned char suspended; |
| 200 | unsigned char irq_wake; | 200 | unsigned char irq_wake; |
| 201 | unsigned char unused[2]; | 201 | unsigned char unused[2]; |
| 202 | struct attribute_group *attr_group; /* port specific attributes */ | ||
| 203 | const struct attribute_group **tty_groups; /* all attributes (serial core use only) */ | ||
| 202 | void *private_data; /* generic platform data pointer */ | 204 | void *private_data; /* generic platform data pointer */ |
| 203 | }; | 205 | }; |
| 204 | 206 | ||
diff --git a/include/linux/sfi_acpi.h b/include/linux/sfi_acpi.h index 4723bbfa1c26..a6e555cbe05c 100644 --- a/include/linux/sfi_acpi.h +++ b/include/linux/sfi_acpi.h | |||
| @@ -63,8 +63,6 @@ | |||
| 63 | #include <linux/sfi.h> | 63 | #include <linux/sfi.h> |
| 64 | 64 | ||
| 65 | #ifdef CONFIG_SFI | 65 | #ifdef CONFIG_SFI |
| 66 | #include <acpi/acpi.h> /* FIXME: inclusion should be removed */ | ||
| 67 | |||
| 68 | extern int sfi_acpi_table_parse(char *signature, char *oem_id, | 66 | extern int sfi_acpi_table_parse(char *signature, char *oem_id, |
| 69 | char *oem_table_id, | 67 | char *oem_table_id, |
| 70 | int (*handler)(struct acpi_table_header *)); | 68 | int (*handler)(struct acpi_table_header *)); |
| @@ -78,7 +76,6 @@ static inline int __init acpi_sfi_table_parse(char *signature, | |||
| 78 | return sfi_acpi_table_parse(signature, NULL, NULL, handler); | 76 | return sfi_acpi_table_parse(signature, NULL, NULL, handler); |
| 79 | } | 77 | } |
| 80 | #else /* !CONFIG_SFI */ | 78 | #else /* !CONFIG_SFI */ |
| 81 | |||
| 82 | static inline int sfi_acpi_table_parse(char *signature, char *oem_id, | 79 | static inline int sfi_acpi_table_parse(char *signature, char *oem_id, |
| 83 | char *oem_table_id, | 80 | char *oem_table_id, |
| 84 | int (*handler)(struct acpi_table_header *)) | 81 | int (*handler)(struct acpi_table_header *)) |
diff --git a/include/linux/sh_timer.h b/include/linux/sh_timer.h index 8e1e036d6d45..64638b058076 100644 --- a/include/linux/sh_timer.h +++ b/include/linux/sh_timer.h | |||
| @@ -2,11 +2,6 @@ | |||
| 2 | #define __SH_TIMER_H__ | 2 | #define __SH_TIMER_H__ |
| 3 | 3 | ||
| 4 | struct sh_timer_config { | 4 | struct sh_timer_config { |
| 5 | char *name; | ||
| 6 | long channel_offset; | ||
| 7 | int timer_bit; | ||
| 8 | unsigned long clockevent_rating; | ||
| 9 | unsigned long clocksource_rating; | ||
| 10 | unsigned int channels_mask; | 5 | unsigned int channels_mask; |
| 11 | }; | 6 | }; |
| 12 | 7 | ||
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index ec89301ada41..11c270551d25 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
| @@ -112,8 +112,7 @@ | |||
| 112 | #define CHECKSUM_COMPLETE 2 | 112 | #define CHECKSUM_COMPLETE 2 |
| 113 | #define CHECKSUM_PARTIAL 3 | 113 | #define CHECKSUM_PARTIAL 3 |
| 114 | 114 | ||
| 115 | #define SKB_DATA_ALIGN(X) (((X) + (SMP_CACHE_BYTES - 1)) & \ | 115 | #define SKB_DATA_ALIGN(X) ALIGN(X, SMP_CACHE_BYTES) |
| 116 | ~(SMP_CACHE_BYTES - 1)) | ||
| 117 | #define SKB_WITH_OVERHEAD(X) \ | 116 | #define SKB_WITH_OVERHEAD(X) \ |
| 118 | ((X) - SKB_DATA_ALIGN(sizeof(struct skb_shared_info))) | 117 | ((X) - SKB_DATA_ALIGN(sizeof(struct skb_shared_info))) |
| 119 | #define SKB_MAX_ORDER(X, ORDER) \ | 118 | #define SKB_MAX_ORDER(X, ORDER) \ |
| @@ -211,18 +210,9 @@ static inline void skb_frag_size_sub(skb_frag_t *frag, int delta) | |||
| 211 | * struct skb_shared_hwtstamps - hardware time stamps | 210 | * struct skb_shared_hwtstamps - hardware time stamps |
| 212 | * @hwtstamp: hardware time stamp transformed into duration | 211 | * @hwtstamp: hardware time stamp transformed into duration |
| 213 | * since arbitrary point in time | 212 | * since arbitrary point in time |
| 214 | * @syststamp: hwtstamp transformed to system time base | ||
| 215 | * | 213 | * |
| 216 | * Software time stamps generated by ktime_get_real() are stored in | 214 | * Software time stamps generated by ktime_get_real() are stored in |
| 217 | * skb->tstamp. The relation between the different kinds of time | 215 | * skb->tstamp. |
| 218 | * stamps is as follows: | ||
| 219 | * | ||
| 220 | * syststamp and tstamp can be compared against each other in | ||
| 221 | * arbitrary combinations. The accuracy of a | ||
| 222 | * syststamp/tstamp/"syststamp from other device" comparison is | ||
| 223 | * limited by the accuracy of the transformation into system time | ||
| 224 | * base. This depends on the device driver and its underlying | ||
| 225 | * hardware. | ||
| 226 | * | 216 | * |
| 227 | * hwtstamps can only be compared against other hwtstamps from | 217 | * hwtstamps can only be compared against other hwtstamps from |
| 228 | * the same device. | 218 | * the same device. |
| @@ -232,7 +222,6 @@ static inline void skb_frag_size_sub(skb_frag_t *frag, int delta) | |||
| 232 | */ | 222 | */ |
| 233 | struct skb_shared_hwtstamps { | 223 | struct skb_shared_hwtstamps { |
| 234 | ktime_t hwtstamp; | 224 | ktime_t hwtstamp; |
| 235 | ktime_t syststamp; | ||
| 236 | }; | 225 | }; |
| 237 | 226 | ||
| 238 | /* Definitions for tx_flags in struct skb_shared_info */ | 227 | /* Definitions for tx_flags in struct skb_shared_info */ |
| @@ -240,7 +229,7 @@ enum { | |||
| 240 | /* generate hardware time stamp */ | 229 | /* generate hardware time stamp */ |
| 241 | SKBTX_HW_TSTAMP = 1 << 0, | 230 | SKBTX_HW_TSTAMP = 1 << 0, |
| 242 | 231 | ||
| 243 | /* generate software time stamp */ | 232 | /* generate software time stamp when queueing packet to NIC */ |
| 244 | SKBTX_SW_TSTAMP = 1 << 1, | 233 | SKBTX_SW_TSTAMP = 1 << 1, |
| 245 | 234 | ||
| 246 | /* device driver is going to provide hardware time stamp */ | 235 | /* device driver is going to provide hardware time stamp */ |
| @@ -258,8 +247,19 @@ enum { | |||
| 258 | * all frags to avoid possible bad checksum | 247 | * all frags to avoid possible bad checksum |
| 259 | */ | 248 | */ |
| 260 | SKBTX_SHARED_FRAG = 1 << 5, | 249 | SKBTX_SHARED_FRAG = 1 << 5, |
| 250 | |||
| 251 | /* generate software time stamp when entering packet scheduling */ | ||
| 252 | SKBTX_SCHED_TSTAMP = 1 << 6, | ||
| 253 | |||
| 254 | /* generate software timestamp on peer data acknowledgment */ | ||
| 255 | SKBTX_ACK_TSTAMP = 1 << 7, | ||
| 261 | }; | 256 | }; |
| 262 | 257 | ||
| 258 | #define SKBTX_ANY_SW_TSTAMP (SKBTX_SW_TSTAMP | \ | ||
| 259 | SKBTX_SCHED_TSTAMP | \ | ||
| 260 | SKBTX_ACK_TSTAMP) | ||
| 261 | #define SKBTX_ANY_TSTAMP (SKBTX_HW_TSTAMP | SKBTX_ANY_SW_TSTAMP) | ||
| 262 | |||
| 263 | /* | 263 | /* |
| 264 | * The callback notifies userspace to release buffers when skb DMA is done in | 264 | * The callback notifies userspace to release buffers when skb DMA is done in |
| 265 | * lower device, the skb last reference should be 0 when calling this. | 265 | * lower device, the skb last reference should be 0 when calling this. |
| @@ -286,6 +286,7 @@ struct skb_shared_info { | |||
| 286 | unsigned short gso_type; | 286 | unsigned short gso_type; |
| 287 | struct sk_buff *frag_list; | 287 | struct sk_buff *frag_list; |
| 288 | struct skb_shared_hwtstamps hwtstamps; | 288 | struct skb_shared_hwtstamps hwtstamps; |
| 289 | u32 tskey; | ||
| 289 | __be32 ip6_frag_id; | 290 | __be32 ip6_frag_id; |
| 290 | 291 | ||
| 291 | /* | 292 | /* |
| @@ -455,6 +456,7 @@ static inline u32 skb_mstamp_us_delta(const struct skb_mstamp *t1, | |||
| 455 | * @ooo_okay: allow the mapping of a socket to a queue to be changed | 456 | * @ooo_okay: allow the mapping of a socket to a queue to be changed |
| 456 | * @l4_hash: indicate hash is a canonical 4-tuple hash over transport | 457 | * @l4_hash: indicate hash is a canonical 4-tuple hash over transport |
| 457 | * ports. | 458 | * ports. |
| 459 | * @sw_hash: indicates hash was computed in software stack | ||
| 458 | * @wifi_acked_valid: wifi_acked was set | 460 | * @wifi_acked_valid: wifi_acked was set |
| 459 | * @wifi_acked: whether frame was acked on wifi or not | 461 | * @wifi_acked: whether frame was acked on wifi or not |
| 460 | * @no_fcs: Request NIC to treat last 4 bytes as Ethernet FCS | 462 | * @no_fcs: Request NIC to treat last 4 bytes as Ethernet FCS |
| @@ -562,6 +564,7 @@ struct sk_buff { | |||
| 562 | __u8 pfmemalloc:1; | 564 | __u8 pfmemalloc:1; |
| 563 | __u8 ooo_okay:1; | 565 | __u8 ooo_okay:1; |
| 564 | __u8 l4_hash:1; | 566 | __u8 l4_hash:1; |
| 567 | __u8 sw_hash:1; | ||
| 565 | __u8 wifi_acked_valid:1; | 568 | __u8 wifi_acked_valid:1; |
| 566 | __u8 wifi_acked:1; | 569 | __u8 wifi_acked:1; |
| 567 | __u8 no_fcs:1; | 570 | __u8 no_fcs:1; |
| @@ -575,7 +578,7 @@ struct sk_buff { | |||
| 575 | __u8 encap_hdr_csum:1; | 578 | __u8 encap_hdr_csum:1; |
| 576 | __u8 csum_valid:1; | 579 | __u8 csum_valid:1; |
| 577 | __u8 csum_complete_sw:1; | 580 | __u8 csum_complete_sw:1; |
| 578 | /* 3/5 bit hole (depending on ndisc_nodetype presence) */ | 581 | /* 2/4 bit hole (depending on ndisc_nodetype presence) */ |
| 579 | kmemcheck_bitfield_end(flags2); | 582 | kmemcheck_bitfield_end(flags2); |
| 580 | 583 | ||
| 581 | #if defined CONFIG_NET_DMA || defined CONFIG_NET_RX_BUSY_POLL | 584 | #if defined CONFIG_NET_DMA || defined CONFIG_NET_RX_BUSY_POLL |
| @@ -830,13 +833,14 @@ static inline void | |||
| 830 | skb_set_hash(struct sk_buff *skb, __u32 hash, enum pkt_hash_types type) | 833 | skb_set_hash(struct sk_buff *skb, __u32 hash, enum pkt_hash_types type) |
| 831 | { | 834 | { |
| 832 | skb->l4_hash = (type == PKT_HASH_TYPE_L4); | 835 | skb->l4_hash = (type == PKT_HASH_TYPE_L4); |
| 836 | skb->sw_hash = 0; | ||
| 833 | skb->hash = hash; | 837 | skb->hash = hash; |
| 834 | } | 838 | } |
| 835 | 839 | ||
| 836 | void __skb_get_hash(struct sk_buff *skb); | 840 | void __skb_get_hash(struct sk_buff *skb); |
| 837 | static inline __u32 skb_get_hash(struct sk_buff *skb) | 841 | static inline __u32 skb_get_hash(struct sk_buff *skb) |
| 838 | { | 842 | { |
| 839 | if (!skb->l4_hash) | 843 | if (!skb->l4_hash && !skb->sw_hash) |
| 840 | __skb_get_hash(skb); | 844 | __skb_get_hash(skb); |
| 841 | 845 | ||
| 842 | return skb->hash; | 846 | return skb->hash; |
| @@ -850,6 +854,7 @@ static inline __u32 skb_get_hash_raw(const struct sk_buff *skb) | |||
| 850 | static inline void skb_clear_hash(struct sk_buff *skb) | 854 | static inline void skb_clear_hash(struct sk_buff *skb) |
| 851 | { | 855 | { |
| 852 | skb->hash = 0; | 856 | skb->hash = 0; |
| 857 | skb->sw_hash = 0; | ||
| 853 | skb->l4_hash = 0; | 858 | skb->l4_hash = 0; |
| 854 | } | 859 | } |
| 855 | 860 | ||
| @@ -862,6 +867,7 @@ static inline void skb_clear_hash_if_not_l4(struct sk_buff *skb) | |||
| 862 | static inline void skb_copy_hash(struct sk_buff *to, const struct sk_buff *from) | 867 | static inline void skb_copy_hash(struct sk_buff *to, const struct sk_buff *from) |
| 863 | { | 868 | { |
| 864 | to->hash = from->hash; | 869 | to->hash = from->hash; |
| 870 | to->sw_hash = from->sw_hash; | ||
| 865 | to->l4_hash = from->l4_hash; | 871 | to->l4_hash = from->l4_hash; |
| 866 | }; | 872 | }; |
| 867 | 873 | ||
| @@ -2697,6 +2703,10 @@ static inline bool skb_defer_rx_timestamp(struct sk_buff *skb) | |||
| 2697 | void skb_complete_tx_timestamp(struct sk_buff *skb, | 2703 | void skb_complete_tx_timestamp(struct sk_buff *skb, |
| 2698 | struct skb_shared_hwtstamps *hwtstamps); | 2704 | struct skb_shared_hwtstamps *hwtstamps); |
| 2699 | 2705 | ||
| 2706 | void __skb_tstamp_tx(struct sk_buff *orig_skb, | ||
| 2707 | struct skb_shared_hwtstamps *hwtstamps, | ||
| 2708 | struct sock *sk, int tstype); | ||
| 2709 | |||
| 2700 | /** | 2710 | /** |
| 2701 | * skb_tstamp_tx - queue clone of skb with send time stamps | 2711 | * skb_tstamp_tx - queue clone of skb with send time stamps |
| 2702 | * @orig_skb: the original outgoing packet | 2712 | * @orig_skb: the original outgoing packet |
| @@ -3005,7 +3015,7 @@ static inline bool skb_rx_queue_recorded(const struct sk_buff *skb) | |||
| 3005 | return skb->queue_mapping != 0; | 3015 | return skb->queue_mapping != 0; |
| 3006 | } | 3016 | } |
| 3007 | 3017 | ||
| 3008 | u16 __skb_tx_hash(const struct net_device *dev, const struct sk_buff *skb, | 3018 | u16 __skb_tx_hash(const struct net_device *dev, struct sk_buff *skb, |
| 3009 | unsigned int num_tx_queues); | 3019 | unsigned int num_tx_queues); |
| 3010 | 3020 | ||
| 3011 | static inline struct sec_path *skb_sec_path(struct sk_buff *skb) | 3021 | static inline struct sec_path *skb_sec_path(struct sk_buff *skb) |
diff --git a/include/linux/spi/cc2520.h b/include/linux/spi/cc2520.h new file mode 100644 index 000000000000..85b8ee67e937 --- /dev/null +++ b/include/linux/spi/cc2520.h | |||
| @@ -0,0 +1,26 @@ | |||
| 1 | /* Header file for cc2520 radio driver | ||
| 2 | * | ||
| 3 | * Copyright (C) 2014 Varka Bhadram <varkab@cdac.in> | ||
| 4 | * Md.Jamal Mohiuddin <mjmohiuddin@cdac.in> | ||
| 5 | * P Sowjanya <sowjanyap@cdac.in> | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or modify | ||
| 8 | * it under the terms of the GNU General Public License as published by | ||
| 9 | * the Free Software Foundation; either version 2 of the License, or | ||
| 10 | * (at your option) any later version. | ||
| 11 | * | ||
| 12 | */ | ||
| 13 | |||
| 14 | #ifndef __CC2520_H | ||
| 15 | #define __CC2520_H | ||
| 16 | |||
| 17 | struct cc2520_platform_data { | ||
| 18 | int fifo; | ||
| 19 | int fifop; | ||
| 20 | int cca; | ||
| 21 | int sfd; | ||
| 22 | int reset; | ||
| 23 | int vreg; | ||
| 24 | }; | ||
| 25 | |||
| 26 | #endif | ||
diff --git a/include/linux/spi/sh_msiof.h b/include/linux/spi/sh_msiof.h index 2e8db3d2d2e5..88a14d81c49e 100644 --- a/include/linux/spi/sh_msiof.h +++ b/include/linux/spi/sh_msiof.h | |||
| @@ -5,6 +5,8 @@ struct sh_msiof_spi_info { | |||
| 5 | int tx_fifo_override; | 5 | int tx_fifo_override; |
| 6 | int rx_fifo_override; | 6 | int rx_fifo_override; |
| 7 | u16 num_chipselect; | 7 | u16 num_chipselect; |
| 8 | unsigned int dma_tx_id; | ||
| 9 | unsigned int dma_rx_id; | ||
| 8 | }; | 10 | }; |
| 9 | 11 | ||
| 10 | #endif /* __SPI_SH_MSIOF_H__ */ | 12 | #endif /* __SPI_SH_MSIOF_H__ */ |
diff --git a/include/linux/ssb/ssb_regs.h b/include/linux/ssb/ssb_regs.h index f9f931c89e3e..f7b9100686c3 100644 --- a/include/linux/ssb/ssb_regs.h +++ b/include/linux/ssb/ssb_regs.h | |||
| @@ -345,6 +345,43 @@ | |||
| 345 | #define SSB_SPROM4_TXPID5GH2_SHIFT 0 | 345 | #define SSB_SPROM4_TXPID5GH2_SHIFT 0 |
| 346 | #define SSB_SPROM4_TXPID5GH3 0xFF00 | 346 | #define SSB_SPROM4_TXPID5GH3 0xFF00 |
| 347 | #define SSB_SPROM4_TXPID5GH3_SHIFT 8 | 347 | #define SSB_SPROM4_TXPID5GH3_SHIFT 8 |
| 348 | |||
| 349 | /* There are 4 blocks with power info sharing the same layout */ | ||
| 350 | #define SSB_SPROM4_PWR_INFO_CORE0 0x0080 | ||
| 351 | #define SSB_SPROM4_PWR_INFO_CORE1 0x00AE | ||
| 352 | #define SSB_SPROM4_PWR_INFO_CORE2 0x00DC | ||
| 353 | #define SSB_SPROM4_PWR_INFO_CORE3 0x010A | ||
| 354 | |||
| 355 | #define SSB_SPROM4_2G_MAXP_ITSSI 0x00 /* 2 GHz ITSSI and 2 GHz Max Power */ | ||
| 356 | #define SSB_SPROM4_2G_MAXP 0x00FF | ||
| 357 | #define SSB_SPROM4_2G_ITSSI 0xFF00 | ||
| 358 | #define SSB_SPROM4_2G_ITSSI_SHIFT 8 | ||
| 359 | #define SSB_SPROM4_2G_PA_0 0x02 /* 2 GHz power amp */ | ||
| 360 | #define SSB_SPROM4_2G_PA_1 0x04 | ||
| 361 | #define SSB_SPROM4_2G_PA_2 0x06 | ||
| 362 | #define SSB_SPROM4_2G_PA_3 0x08 | ||
| 363 | #define SSB_SPROM4_5G_MAXP_ITSSI 0x0A /* 5 GHz ITSSI and 5.3 GHz Max Power */ | ||
| 364 | #define SSB_SPROM4_5G_MAXP 0x00FF | ||
| 365 | #define SSB_SPROM4_5G_ITSSI 0xFF00 | ||
| 366 | #define SSB_SPROM4_5G_ITSSI_SHIFT 8 | ||
| 367 | #define SSB_SPROM4_5GHL_MAXP 0x0C /* 5.2 GHz and 5.8 GHz Max Power */ | ||
| 368 | #define SSB_SPROM4_5GH_MAXP 0x00FF | ||
| 369 | #define SSB_SPROM4_5GL_MAXP 0xFF00 | ||
| 370 | #define SSB_SPROM4_5GL_MAXP_SHIFT 8 | ||
| 371 | #define SSB_SPROM4_5G_PA_0 0x0E /* 5.3 GHz power amp */ | ||
| 372 | #define SSB_SPROM4_5G_PA_1 0x10 | ||
| 373 | #define SSB_SPROM4_5G_PA_2 0x12 | ||
| 374 | #define SSB_SPROM4_5G_PA_3 0x14 | ||
| 375 | #define SSB_SPROM4_5GL_PA_0 0x16 /* 5.2 GHz power amp */ | ||
| 376 | #define SSB_SPROM4_5GL_PA_1 0x18 | ||
| 377 | #define SSB_SPROM4_5GL_PA_2 0x1A | ||
| 378 | #define SSB_SPROM4_5GL_PA_3 0x1C | ||
| 379 | #define SSB_SPROM4_5GH_PA_0 0x1E /* 5.8 GHz power amp */ | ||
| 380 | #define SSB_SPROM4_5GH_PA_1 0x20 | ||
| 381 | #define SSB_SPROM4_5GH_PA_2 0x22 | ||
| 382 | #define SSB_SPROM4_5GH_PA_3 0x24 | ||
| 383 | |||
| 384 | /* TODO: Make it deprecated */ | ||
| 348 | #define SSB_SPROM4_MAXP_BG 0x0080 /* Max Power BG in path 1 */ | 385 | #define SSB_SPROM4_MAXP_BG 0x0080 /* Max Power BG in path 1 */ |
| 349 | #define SSB_SPROM4_MAXP_BG_MASK 0x00FF /* Mask for Max Power BG */ | 386 | #define SSB_SPROM4_MAXP_BG_MASK 0x00FF /* Mask for Max Power BG */ |
| 350 | #define SSB_SPROM4_ITSSI_BG 0xFF00 /* Mask for path 1 itssi_bg */ | 387 | #define SSB_SPROM4_ITSSI_BG 0xFF00 /* Mask for path 1 itssi_bg */ |
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h index 6f27d4f957bd..cd63851b57f2 100644 --- a/include/linux/stmmac.h +++ b/include/linux/stmmac.h | |||
| @@ -112,6 +112,8 @@ struct plat_stmmacenet_data { | |||
| 112 | int riwt_off; | 112 | int riwt_off; |
| 113 | int max_speed; | 113 | int max_speed; |
| 114 | int maxmtu; | 114 | int maxmtu; |
| 115 | int multicast_filter_bins; | ||
| 116 | int unicast_filter_entries; | ||
| 115 | void (*fix_mac_speed)(void *priv, unsigned int speed); | 117 | void (*fix_mac_speed)(void *priv, unsigned int speed); |
| 116 | void (*bus_setup)(void __iomem *ioaddr); | 118 | void (*bus_setup)(void __iomem *ioaddr); |
| 117 | void *(*setup)(struct platform_device *pdev); | 119 | void *(*setup)(struct platform_device *pdev); |
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h index ad7dbe2cfecd..1a8959944c5f 100644 --- a/include/linux/sunrpc/sched.h +++ b/include/linux/sunrpc/sched.h | |||
| @@ -236,7 +236,7 @@ void * rpc_malloc(struct rpc_task *, size_t); | |||
| 236 | void rpc_free(void *); | 236 | void rpc_free(void *); |
| 237 | int rpciod_up(void); | 237 | int rpciod_up(void); |
| 238 | void rpciod_down(void); | 238 | void rpciod_down(void); |
| 239 | int __rpc_wait_for_completion_task(struct rpc_task *task, int (*)(void *)); | 239 | int __rpc_wait_for_completion_task(struct rpc_task *task, wait_bit_action_f *); |
| 240 | #ifdef RPC_DEBUG | 240 | #ifdef RPC_DEBUG |
| 241 | struct net; | 241 | struct net; |
| 242 | void rpc_show_tasks(struct net *); | 242 | void rpc_show_tasks(struct net *); |
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h index b0881a0ed322..701daff5d899 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h | |||
| @@ -866,4 +866,9 @@ asmlinkage long sys_process_vm_writev(pid_t pid, | |||
| 866 | asmlinkage long sys_kcmp(pid_t pid1, pid_t pid2, int type, | 866 | asmlinkage long sys_kcmp(pid_t pid1, pid_t pid2, int type, |
| 867 | unsigned long idx1, unsigned long idx2); | 867 | unsigned long idx1, unsigned long idx2); |
| 868 | asmlinkage long sys_finit_module(int fd, const char __user *uargs, int flags); | 868 | asmlinkage long sys_finit_module(int fd, const char __user *uargs, int flags); |
| 869 | asmlinkage long sys_seccomp(unsigned int op, unsigned int flags, | ||
| 870 | const char __user *uargs); | ||
| 871 | asmlinkage long sys_getrandom(char __user *buf, size_t count, | ||
| 872 | unsigned int flags); | ||
| 873 | |||
| 869 | #endif | 874 | #endif |
diff --git a/include/linux/tcp.h b/include/linux/tcp.h index a0513210798f..fa5258f322e7 100644 --- a/include/linux/tcp.h +++ b/include/linux/tcp.h | |||
| @@ -111,10 +111,7 @@ struct tcp_request_sock_ops; | |||
| 111 | 111 | ||
| 112 | struct tcp_request_sock { | 112 | struct tcp_request_sock { |
| 113 | struct inet_request_sock req; | 113 | struct inet_request_sock req; |
| 114 | #ifdef CONFIG_TCP_MD5SIG | ||
| 115 | /* Only used by TCP MD5 Signature so far. */ | ||
| 116 | const struct tcp_request_sock_ops *af_specific; | 114 | const struct tcp_request_sock_ops *af_specific; |
| 117 | #endif | ||
| 118 | struct sock *listener; /* needed for TFO */ | 115 | struct sock *listener; /* needed for TFO */ |
| 119 | u32 rcv_isn; | 116 | u32 rcv_isn; |
| 120 | u32 snt_isn; | 117 | u32 snt_isn; |
diff --git a/include/linux/tick.h b/include/linux/tick.h index b84773cb9f4c..059052306831 100644 --- a/include/linux/tick.h +++ b/include/linux/tick.h | |||
| @@ -12,6 +12,7 @@ | |||
| 12 | #include <linux/hrtimer.h> | 12 | #include <linux/hrtimer.h> |
| 13 | #include <linux/context_tracking_state.h> | 13 | #include <linux/context_tracking_state.h> |
| 14 | #include <linux/cpumask.h> | 14 | #include <linux/cpumask.h> |
| 15 | #include <linux/sched.h> | ||
| 15 | 16 | ||
| 16 | #ifdef CONFIG_GENERIC_CLOCKEVENTS | 17 | #ifdef CONFIG_GENERIC_CLOCKEVENTS |
| 17 | 18 | ||
| @@ -162,6 +163,7 @@ static inline u64 get_cpu_iowait_time_us(int cpu, u64 *unused) { return -1; } | |||
| 162 | #ifdef CONFIG_NO_HZ_FULL | 163 | #ifdef CONFIG_NO_HZ_FULL |
| 163 | extern bool tick_nohz_full_running; | 164 | extern bool tick_nohz_full_running; |
| 164 | extern cpumask_var_t tick_nohz_full_mask; | 165 | extern cpumask_var_t tick_nohz_full_mask; |
| 166 | extern cpumask_var_t housekeeping_mask; | ||
| 165 | 167 | ||
| 166 | static inline bool tick_nohz_full_enabled(void) | 168 | static inline bool tick_nohz_full_enabled(void) |
| 167 | { | 169 | { |
| @@ -181,7 +183,13 @@ static inline bool tick_nohz_full_cpu(int cpu) | |||
| 181 | 183 | ||
| 182 | extern void tick_nohz_init(void); | 184 | extern void tick_nohz_init(void); |
| 183 | extern void __tick_nohz_full_check(void); | 185 | extern void __tick_nohz_full_check(void); |
| 184 | extern void tick_nohz_full_kick(void); | 186 | extern void tick_nohz_full_kick_cpu(int cpu); |
| 187 | |||
| 188 | static inline void tick_nohz_full_kick(void) | ||
| 189 | { | ||
| 190 | tick_nohz_full_kick_cpu(smp_processor_id()); | ||
| 191 | } | ||
| 192 | |||
| 185 | extern void tick_nohz_full_kick_all(void); | 193 | extern void tick_nohz_full_kick_all(void); |
| 186 | extern void __tick_nohz_task_switch(struct task_struct *tsk); | 194 | extern void __tick_nohz_task_switch(struct task_struct *tsk); |
| 187 | #else | 195 | #else |
| @@ -189,11 +197,30 @@ static inline void tick_nohz_init(void) { } | |||
| 189 | static inline bool tick_nohz_full_enabled(void) { return false; } | 197 | static inline bool tick_nohz_full_enabled(void) { return false; } |
| 190 | static inline bool tick_nohz_full_cpu(int cpu) { return false; } | 198 | static inline bool tick_nohz_full_cpu(int cpu) { return false; } |
| 191 | static inline void __tick_nohz_full_check(void) { } | 199 | static inline void __tick_nohz_full_check(void) { } |
| 200 | static inline void tick_nohz_full_kick_cpu(int cpu) { } | ||
| 192 | static inline void tick_nohz_full_kick(void) { } | 201 | static inline void tick_nohz_full_kick(void) { } |
| 193 | static inline void tick_nohz_full_kick_all(void) { } | 202 | static inline void tick_nohz_full_kick_all(void) { } |
| 194 | static inline void __tick_nohz_task_switch(struct task_struct *tsk) { } | 203 | static inline void __tick_nohz_task_switch(struct task_struct *tsk) { } |
| 195 | #endif | 204 | #endif |
| 196 | 205 | ||
| 206 | static inline bool is_housekeeping_cpu(int cpu) | ||
| 207 | { | ||
| 208 | #ifdef CONFIG_NO_HZ_FULL | ||
| 209 | if (tick_nohz_full_enabled()) | ||
| 210 | return cpumask_test_cpu(cpu, housekeeping_mask); | ||
| 211 | #endif | ||
| 212 | return true; | ||
| 213 | } | ||
| 214 | |||
| 215 | static inline void housekeeping_affine(struct task_struct *t) | ||
| 216 | { | ||
| 217 | #ifdef CONFIG_NO_HZ_FULL | ||
| 218 | if (tick_nohz_full_enabled()) | ||
| 219 | set_cpus_allowed_ptr(t, housekeeping_mask); | ||
| 220 | |||
| 221 | #endif | ||
| 222 | } | ||
| 223 | |||
| 197 | static inline void tick_nohz_full_check(void) | 224 | static inline void tick_nohz_full_check(void) |
| 198 | { | 225 | { |
| 199 | if (tick_nohz_full_enabled()) | 226 | if (tick_nohz_full_enabled()) |
diff --git a/include/linux/time.h b/include/linux/time.h index d5d229b2e5af..8c42cf8d2444 100644 --- a/include/linux/time.h +++ b/include/linux/time.h | |||
| @@ -4,19 +4,10 @@ | |||
| 4 | # include <linux/cache.h> | 4 | # include <linux/cache.h> |
| 5 | # include <linux/seqlock.h> | 5 | # include <linux/seqlock.h> |
| 6 | # include <linux/math64.h> | 6 | # include <linux/math64.h> |
| 7 | #include <uapi/linux/time.h> | 7 | # include <linux/time64.h> |
| 8 | 8 | ||
| 9 | extern struct timezone sys_tz; | 9 | extern struct timezone sys_tz; |
| 10 | 10 | ||
| 11 | /* Parameters used to convert the timespec values: */ | ||
| 12 | #define MSEC_PER_SEC 1000L | ||
| 13 | #define USEC_PER_MSEC 1000L | ||
| 14 | #define NSEC_PER_USEC 1000L | ||
| 15 | #define NSEC_PER_MSEC 1000000L | ||
| 16 | #define USEC_PER_SEC 1000000L | ||
| 17 | #define NSEC_PER_SEC 1000000000L | ||
| 18 | #define FSEC_PER_SEC 1000000000000000LL | ||
| 19 | |||
| 20 | #define TIME_T_MAX (time_t)((1UL << ((sizeof(time_t) << 3) - 1)) - 1) | 11 | #define TIME_T_MAX (time_t)((1UL << ((sizeof(time_t) << 3) - 1)) - 1) |
| 21 | 12 | ||
| 22 | static inline int timespec_equal(const struct timespec *a, | 13 | static inline int timespec_equal(const struct timespec *a, |
| @@ -84,13 +75,6 @@ static inline struct timespec timespec_sub(struct timespec lhs, | |||
| 84 | return ts_delta; | 75 | return ts_delta; |
| 85 | } | 76 | } |
| 86 | 77 | ||
| 87 | #define KTIME_MAX ((s64)~((u64)1 << 63)) | ||
| 88 | #if (BITS_PER_LONG == 64) | ||
| 89 | # define KTIME_SEC_MAX (KTIME_MAX / NSEC_PER_SEC) | ||
| 90 | #else | ||
| 91 | # define KTIME_SEC_MAX LONG_MAX | ||
| 92 | #endif | ||
| 93 | |||
| 94 | /* | 78 | /* |
| 95 | * Returns true if the timespec is norm, false if denorm: | 79 | * Returns true if the timespec is norm, false if denorm: |
| 96 | */ | 80 | */ |
| @@ -115,27 +99,7 @@ static inline bool timespec_valid_strict(const struct timespec *ts) | |||
| 115 | return true; | 99 | return true; |
| 116 | } | 100 | } |
| 117 | 101 | ||
| 118 | extern bool persistent_clock_exist; | 102 | extern struct timespec timespec_trunc(struct timespec t, unsigned gran); |
| 119 | |||
| 120 | static inline bool has_persistent_clock(void) | ||
| 121 | { | ||
| 122 | return persistent_clock_exist; | ||
| 123 | } | ||
| 124 | |||
| 125 | extern void read_persistent_clock(struct timespec *ts); | ||
| 126 | extern void read_boot_clock(struct timespec *ts); | ||
| 127 | extern int persistent_clock_is_local; | ||
| 128 | extern int update_persistent_clock(struct timespec now); | ||
| 129 | void timekeeping_init(void); | ||
| 130 | extern int timekeeping_suspended; | ||
| 131 | |||
| 132 | unsigned long get_seconds(void); | ||
| 133 | struct timespec current_kernel_time(void); | ||
| 134 | struct timespec __current_kernel_time(void); /* does not take xtime_lock */ | ||
| 135 | struct timespec get_monotonic_coarse(void); | ||
| 136 | void get_xtime_and_monotonic_and_sleep_offset(struct timespec *xtim, | ||
| 137 | struct timespec *wtom, struct timespec *sleep); | ||
| 138 | void timekeeping_inject_sleeptime(struct timespec *delta); | ||
| 139 | 103 | ||
| 140 | #define CURRENT_TIME (current_kernel_time()) | 104 | #define CURRENT_TIME (current_kernel_time()) |
| 141 | #define CURRENT_TIME_SEC ((struct timespec) { get_seconds(), 0 }) | 105 | #define CURRENT_TIME_SEC ((struct timespec) { get_seconds(), 0 }) |
| @@ -153,33 +117,14 @@ void timekeeping_inject_sleeptime(struct timespec *delta); | |||
| 153 | extern u32 (*arch_gettimeoffset)(void); | 117 | extern u32 (*arch_gettimeoffset)(void); |
| 154 | #endif | 118 | #endif |
| 155 | 119 | ||
| 156 | extern void do_gettimeofday(struct timeval *tv); | ||
| 157 | extern int do_settimeofday(const struct timespec *tv); | ||
| 158 | extern int do_sys_settimeofday(const struct timespec *tv, | ||
| 159 | const struct timezone *tz); | ||
| 160 | #define do_posix_clock_monotonic_gettime(ts) ktime_get_ts(ts) | ||
| 161 | extern long do_utimes(int dfd, const char __user *filename, struct timespec *times, int flags); | ||
| 162 | struct itimerval; | 120 | struct itimerval; |
| 163 | extern int do_setitimer(int which, struct itimerval *value, | 121 | extern int do_setitimer(int which, struct itimerval *value, |
| 164 | struct itimerval *ovalue); | 122 | struct itimerval *ovalue); |
| 165 | extern unsigned int alarm_setitimer(unsigned int seconds); | ||
| 166 | extern int do_getitimer(int which, struct itimerval *value); | 123 | extern int do_getitimer(int which, struct itimerval *value); |
| 167 | extern int __getnstimeofday(struct timespec *tv); | ||
| 168 | extern void getnstimeofday(struct timespec *tv); | ||
| 169 | extern void getrawmonotonic(struct timespec *ts); | ||
| 170 | extern void getnstime_raw_and_real(struct timespec *ts_raw, | ||
| 171 | struct timespec *ts_real); | ||
| 172 | extern void getboottime(struct timespec *ts); | ||
| 173 | extern void monotonic_to_bootbased(struct timespec *ts); | ||
| 174 | extern void get_monotonic_boottime(struct timespec *ts); | ||
| 175 | 124 | ||
| 176 | extern struct timespec timespec_trunc(struct timespec t, unsigned gran); | 125 | extern unsigned int alarm_setitimer(unsigned int seconds); |
| 177 | extern int timekeeping_valid_for_hres(void); | 126 | |
| 178 | extern u64 timekeeping_max_deferment(void); | 127 | extern long do_utimes(int dfd, const char __user *filename, struct timespec *times, int flags); |
| 179 | extern int timekeeping_inject_offset(struct timespec *ts); | ||
| 180 | extern s32 timekeeping_get_tai_offset(void); | ||
| 181 | extern void timekeeping_set_tai_offset(s32 tai_offset); | ||
| 182 | extern void timekeeping_clocktai(struct timespec *ts); | ||
| 183 | 128 | ||
| 184 | struct tms; | 129 | struct tms; |
| 185 | extern void do_sys_times(struct tms *); | 130 | extern void do_sys_times(struct tms *); |
diff --git a/include/linux/time64.h b/include/linux/time64.h new file mode 100644 index 000000000000..a3831478d9cf --- /dev/null +++ b/include/linux/time64.h | |||
| @@ -0,0 +1,190 @@ | |||
| 1 | #ifndef _LINUX_TIME64_H | ||
| 2 | #define _LINUX_TIME64_H | ||
| 3 | |||
| 4 | #include <uapi/linux/time.h> | ||
| 5 | |||
| 6 | typedef __s64 time64_t; | ||
| 7 | |||
| 8 | /* | ||
| 9 | * This wants to go into uapi/linux/time.h once we agreed about the | ||
| 10 | * userspace interfaces. | ||
| 11 | */ | ||
| 12 | #if __BITS_PER_LONG == 64 | ||
| 13 | # define timespec64 timespec | ||
| 14 | #else | ||
| 15 | struct timespec64 { | ||
| 16 | time64_t tv_sec; /* seconds */ | ||
| 17 | long tv_nsec; /* nanoseconds */ | ||
| 18 | }; | ||
| 19 | #endif | ||
| 20 | |||
| 21 | /* Parameters used to convert the timespec values: */ | ||
| 22 | #define MSEC_PER_SEC 1000L | ||
| 23 | #define USEC_PER_MSEC 1000L | ||
| 24 | #define NSEC_PER_USEC 1000L | ||
| 25 | #define NSEC_PER_MSEC 1000000L | ||
| 26 | #define USEC_PER_SEC 1000000L | ||
| 27 | #define NSEC_PER_SEC 1000000000L | ||
| 28 | #define FSEC_PER_SEC 1000000000000000LL | ||
| 29 | |||
| 30 | /* Located here for timespec[64]_valid_strict */ | ||
| 31 | #define KTIME_MAX ((s64)~((u64)1 << 63)) | ||
| 32 | #define KTIME_SEC_MAX (KTIME_MAX / NSEC_PER_SEC) | ||
| 33 | |||
| 34 | #if __BITS_PER_LONG == 64 | ||
| 35 | |||
| 36 | static inline struct timespec timespec64_to_timespec(const struct timespec64 ts64) | ||
| 37 | { | ||
| 38 | return ts64; | ||
| 39 | } | ||
| 40 | |||
| 41 | static inline struct timespec64 timespec_to_timespec64(const struct timespec ts) | ||
| 42 | { | ||
| 43 | return ts; | ||
| 44 | } | ||
| 45 | |||
| 46 | # define timespec64_equal timespec_equal | ||
| 47 | # define timespec64_compare timespec_compare | ||
| 48 | # define set_normalized_timespec64 set_normalized_timespec | ||
| 49 | # define timespec64_add_safe timespec_add_safe | ||
| 50 | # define timespec64_add timespec_add | ||
| 51 | # define timespec64_sub timespec_sub | ||
| 52 | # define timespec64_valid timespec_valid | ||
| 53 | # define timespec64_valid_strict timespec_valid_strict | ||
| 54 | # define timespec64_to_ns timespec_to_ns | ||
| 55 | # define ns_to_timespec64 ns_to_timespec | ||
| 56 | # define timespec64_add_ns timespec_add_ns | ||
| 57 | |||
| 58 | #else | ||
| 59 | |||
| 60 | static inline struct timespec timespec64_to_timespec(const struct timespec64 ts64) | ||
| 61 | { | ||
| 62 | struct timespec ret; | ||
| 63 | |||
| 64 | ret.tv_sec = (time_t)ts64.tv_sec; | ||
| 65 | ret.tv_nsec = ts64.tv_nsec; | ||
| 66 | return ret; | ||
| 67 | } | ||
| 68 | |||
| 69 | static inline struct timespec64 timespec_to_timespec64(const struct timespec ts) | ||
| 70 | { | ||
| 71 | struct timespec64 ret; | ||
| 72 | |||
| 73 | ret.tv_sec = ts.tv_sec; | ||
| 74 | ret.tv_nsec = ts.tv_nsec; | ||
| 75 | return ret; | ||
| 76 | } | ||
| 77 | |||
| 78 | static inline int timespec64_equal(const struct timespec64 *a, | ||
| 79 | const struct timespec64 *b) | ||
| 80 | { | ||
| 81 | return (a->tv_sec == b->tv_sec) && (a->tv_nsec == b->tv_nsec); | ||
| 82 | } | ||
| 83 | |||
| 84 | /* | ||
| 85 | * lhs < rhs: return <0 | ||
| 86 | * lhs == rhs: return 0 | ||
| 87 | * lhs > rhs: return >0 | ||
| 88 | */ | ||
| 89 | static inline int timespec64_compare(const struct timespec64 *lhs, const struct timespec64 *rhs) | ||
| 90 | { | ||
| 91 | if (lhs->tv_sec < rhs->tv_sec) | ||
| 92 | return -1; | ||
| 93 | if (lhs->tv_sec > rhs->tv_sec) | ||
| 94 | return 1; | ||
| 95 | return lhs->tv_nsec - rhs->tv_nsec; | ||
| 96 | } | ||
| 97 | |||
| 98 | extern void set_normalized_timespec64(struct timespec64 *ts, time64_t sec, s64 nsec); | ||
| 99 | |||
| 100 | /* | ||
| 101 | * timespec64_add_safe assumes both values are positive and checks for | ||
| 102 | * overflow. It will return TIME_T_MAX if the returned value would be | ||
| 103 | * smaller then either of the arguments. | ||
| 104 | */ | ||
| 105 | extern struct timespec64 timespec64_add_safe(const struct timespec64 lhs, | ||
| 106 | const struct timespec64 rhs); | ||
| 107 | |||
| 108 | |||
| 109 | static inline struct timespec64 timespec64_add(struct timespec64 lhs, | ||
| 110 | struct timespec64 rhs) | ||
| 111 | { | ||
| 112 | struct timespec64 ts_delta; | ||
| 113 | set_normalized_timespec64(&ts_delta, lhs.tv_sec + rhs.tv_sec, | ||
| 114 | lhs.tv_nsec + rhs.tv_nsec); | ||
| 115 | return ts_delta; | ||
| 116 | } | ||
| 117 | |||
| 118 | /* | ||
| 119 | * sub = lhs - rhs, in normalized form | ||
| 120 | */ | ||
| 121 | static inline struct timespec64 timespec64_sub(struct timespec64 lhs, | ||
| 122 | struct timespec64 rhs) | ||
| 123 | { | ||
| 124 | struct timespec64 ts_delta; | ||
| 125 | set_normalized_timespec64(&ts_delta, lhs.tv_sec - rhs.tv_sec, | ||
| 126 | lhs.tv_nsec - rhs.tv_nsec); | ||
| 127 | return ts_delta; | ||
| 128 | } | ||
| 129 | |||
| 130 | /* | ||
| 131 | * Returns true if the timespec64 is norm, false if denorm: | ||
| 132 | */ | ||
| 133 | static inline bool timespec64_valid(const struct timespec64 *ts) | ||
| 134 | { | ||
| 135 | /* Dates before 1970 are bogus */ | ||
| 136 | if (ts->tv_sec < 0) | ||
| 137 | return false; | ||
| 138 | /* Can't have more nanoseconds then a second */ | ||
| 139 | if ((unsigned long)ts->tv_nsec >= NSEC_PER_SEC) | ||
| 140 | return false; | ||
| 141 | return true; | ||
| 142 | } | ||
| 143 | |||
| 144 | static inline bool timespec64_valid_strict(const struct timespec64 *ts) | ||
| 145 | { | ||
| 146 | if (!timespec64_valid(ts)) | ||
| 147 | return false; | ||
| 148 | /* Disallow values that could overflow ktime_t */ | ||
| 149 | if ((unsigned long long)ts->tv_sec >= KTIME_SEC_MAX) | ||
| 150 | return false; | ||
| 151 | return true; | ||
| 152 | } | ||
| 153 | |||
| 154 | /** | ||
| 155 | * timespec64_to_ns - Convert timespec64 to nanoseconds | ||
| 156 | * @ts: pointer to the timespec64 variable to be converted | ||
| 157 | * | ||
| 158 | * Returns the scalar nanosecond representation of the timespec64 | ||
| 159 | * parameter. | ||
| 160 | */ | ||
| 161 | static inline s64 timespec64_to_ns(const struct timespec64 *ts) | ||
| 162 | { | ||
| 163 | return ((s64) ts->tv_sec * NSEC_PER_SEC) + ts->tv_nsec; | ||
| 164 | } | ||
| 165 | |||
| 166 | /** | ||
| 167 | * ns_to_timespec64 - Convert nanoseconds to timespec64 | ||
| 168 | * @nsec: the nanoseconds value to be converted | ||
| 169 | * | ||
| 170 | * Returns the timespec64 representation of the nsec parameter. | ||
| 171 | */ | ||
| 172 | extern struct timespec64 ns_to_timespec64(const s64 nsec); | ||
| 173 | |||
| 174 | /** | ||
| 175 | * timespec64_add_ns - Adds nanoseconds to a timespec64 | ||
| 176 | * @a: pointer to timespec64 to be incremented | ||
| 177 | * @ns: unsigned nanoseconds value to be added | ||
| 178 | * | ||
| 179 | * This must always be inlined because its used from the x86-64 vdso, | ||
| 180 | * which cannot call other kernel functions. | ||
| 181 | */ | ||
| 182 | static __always_inline void timespec64_add_ns(struct timespec64 *a, u64 ns) | ||
| 183 | { | ||
| 184 | a->tv_sec += __iter_div_u64_rem(a->tv_nsec + ns, NSEC_PER_SEC, &ns); | ||
| 185 | a->tv_nsec = ns; | ||
| 186 | } | ||
| 187 | |||
| 188 | #endif | ||
| 189 | |||
| 190 | #endif /* _LINUX_TIME64_H */ | ||
diff --git a/include/linux/timekeeper_internal.h b/include/linux/timekeeper_internal.h index c1825eb436ed..95640dcd1899 100644 --- a/include/linux/timekeeper_internal.h +++ b/include/linux/timekeeper_internal.h | |||
| @@ -10,77 +10,100 @@ | |||
| 10 | #include <linux/jiffies.h> | 10 | #include <linux/jiffies.h> |
| 11 | #include <linux/time.h> | 11 | #include <linux/time.h> |
| 12 | 12 | ||
| 13 | /* Structure holding internal timekeeping values. */ | 13 | /** |
| 14 | struct timekeeper { | 14 | * struct tk_read_base - base structure for timekeeping readout |
| 15 | /* Current clocksource used for timekeeping. */ | 15 | * @clock: Current clocksource used for timekeeping. |
| 16 | * @read: Read function of @clock | ||
| 17 | * @mask: Bitmask for two's complement subtraction of non 64bit clocks | ||
| 18 | * @cycle_last: @clock cycle value at last update | ||
| 19 | * @mult: NTP adjusted multiplier for scaled math conversion | ||
| 20 | * @shift: Shift value for scaled math conversion | ||
| 21 | * @xtime_nsec: Shifted (fractional) nano seconds offset for readout | ||
| 22 | * @base_mono: ktime_t (nanoseconds) base time for readout | ||
| 23 | * | ||
| 24 | * This struct has size 56 byte on 64 bit. Together with a seqcount it | ||
| 25 | * occupies a single 64byte cache line. | ||
| 26 | * | ||
| 27 | * The struct is separate from struct timekeeper as it is also used | ||
| 28 | * for a fast NMI safe accessor to clock monotonic. | ||
| 29 | */ | ||
| 30 | struct tk_read_base { | ||
| 16 | struct clocksource *clock; | 31 | struct clocksource *clock; |
| 17 | /* NTP adjusted clock multiplier */ | 32 | cycle_t (*read)(struct clocksource *cs); |
| 33 | cycle_t mask; | ||
| 34 | cycle_t cycle_last; | ||
| 18 | u32 mult; | 35 | u32 mult; |
| 19 | /* The shift value of the current clocksource. */ | ||
| 20 | u32 shift; | 36 | u32 shift; |
| 21 | /* Number of clock cycles in one NTP interval. */ | 37 | u64 xtime_nsec; |
| 38 | ktime_t base_mono; | ||
| 39 | }; | ||
| 40 | |||
| 41 | /** | ||
| 42 | * struct timekeeper - Structure holding internal timekeeping values. | ||
| 43 | * @tkr: The readout base structure | ||
| 44 | * @xtime_sec: Current CLOCK_REALTIME time in seconds | ||
| 45 | * @wall_to_monotonic: CLOCK_REALTIME to CLOCK_MONOTONIC offset | ||
| 46 | * @offs_real: Offset clock monotonic -> clock realtime | ||
| 47 | * @offs_boot: Offset clock monotonic -> clock boottime | ||
| 48 | * @offs_tai: Offset clock monotonic -> clock tai | ||
| 49 | * @tai_offset: The current UTC to TAI offset in seconds | ||
| 50 | * @base_raw: Monotonic raw base time in ktime_t format | ||
| 51 | * @raw_time: Monotonic raw base time in timespec64 format | ||
| 52 | * @cycle_interval: Number of clock cycles in one NTP interval | ||
| 53 | * @xtime_interval: Number of clock shifted nano seconds in one NTP | ||
| 54 | * interval. | ||
| 55 | * @xtime_remainder: Shifted nano seconds left over when rounding | ||
| 56 | * @cycle_interval | ||
| 57 | * @raw_interval: Raw nano seconds accumulated per NTP interval. | ||
| 58 | * @ntp_error: Difference between accumulated time and NTP time in ntp | ||
| 59 | * shifted nano seconds. | ||
| 60 | * @ntp_error_shift: Shift conversion between clock shifted nano seconds and | ||
| 61 | * ntp shifted nano seconds. | ||
| 62 | * | ||
| 63 | * Note: For timespec(64) based interfaces wall_to_monotonic is what | ||
| 64 | * we need to add to xtime (or xtime corrected for sub jiffie times) | ||
| 65 | * to get to monotonic time. Monotonic is pegged at zero at system | ||
| 66 | * boot time, so wall_to_monotonic will be negative, however, we will | ||
| 67 | * ALWAYS keep the tv_nsec part positive so we can use the usual | ||
| 68 | * normalization. | ||
| 69 | * | ||
| 70 | * wall_to_monotonic is moved after resume from suspend for the | ||
| 71 | * monotonic time not to jump. We need to add total_sleep_time to | ||
| 72 | * wall_to_monotonic to get the real boot based time offset. | ||
| 73 | * | ||
| 74 | * wall_to_monotonic is no longer the boot time, getboottime must be | ||
| 75 | * used instead. | ||
| 76 | */ | ||
| 77 | struct timekeeper { | ||
| 78 | struct tk_read_base tkr; | ||
| 79 | u64 xtime_sec; | ||
| 80 | struct timespec64 wall_to_monotonic; | ||
| 81 | ktime_t offs_real; | ||
| 82 | ktime_t offs_boot; | ||
| 83 | ktime_t offs_tai; | ||
| 84 | s32 tai_offset; | ||
| 85 | ktime_t base_raw; | ||
| 86 | struct timespec64 raw_time; | ||
| 87 | |||
| 88 | /* The following members are for timekeeping internal use */ | ||
| 22 | cycle_t cycle_interval; | 89 | cycle_t cycle_interval; |
| 23 | /* Last cycle value (also stored in clock->cycle_last) */ | ||
| 24 | cycle_t cycle_last; | ||
| 25 | /* Number of clock shifted nano seconds in one NTP interval. */ | ||
| 26 | u64 xtime_interval; | 90 | u64 xtime_interval; |
| 27 | /* shifted nano seconds left over when rounding cycle_interval */ | ||
| 28 | s64 xtime_remainder; | 91 | s64 xtime_remainder; |
| 29 | /* Raw nano seconds accumulated per NTP interval. */ | ||
| 30 | u32 raw_interval; | 92 | u32 raw_interval; |
| 31 | 93 | /* The ntp_tick_length() value currently being used. | |
| 32 | /* Current CLOCK_REALTIME time in seconds */ | 94 | * This cached copy ensures we consistently apply the tick |
| 33 | u64 xtime_sec; | 95 | * length for an entire tick, as ntp_tick_length may change |
| 34 | /* Clock shifted nano seconds */ | 96 | * mid-tick, and we don't want to apply that new value to |
| 35 | u64 xtime_nsec; | 97 | * the tick in progress. |
| 36 | 98 | */ | |
| 99 | u64 ntp_tick; | ||
| 37 | /* Difference between accumulated time and NTP time in ntp | 100 | /* Difference between accumulated time and NTP time in ntp |
| 38 | * shifted nano seconds. */ | 101 | * shifted nano seconds. */ |
| 39 | s64 ntp_error; | 102 | s64 ntp_error; |
| 40 | /* Shift conversion between clock shifted nano seconds and | ||
| 41 | * ntp shifted nano seconds. */ | ||
| 42 | u32 ntp_error_shift; | 103 | u32 ntp_error_shift; |
| 43 | 104 | u32 ntp_err_mult; | |
| 44 | /* | ||
| 45 | * wall_to_monotonic is what we need to add to xtime (or xtime corrected | ||
| 46 | * for sub jiffie times) to get to monotonic time. Monotonic is pegged | ||
| 47 | * at zero at system boot time, so wall_to_monotonic will be negative, | ||
| 48 | * however, we will ALWAYS keep the tv_nsec part positive so we can use | ||
| 49 | * the usual normalization. | ||
| 50 | * | ||
| 51 | * wall_to_monotonic is moved after resume from suspend for the | ||
| 52 | * monotonic time not to jump. We need to add total_sleep_time to | ||
| 53 | * wall_to_monotonic to get the real boot based time offset. | ||
| 54 | * | ||
| 55 | * - wall_to_monotonic is no longer the boot time, getboottime must be | ||
| 56 | * used instead. | ||
| 57 | */ | ||
| 58 | struct timespec wall_to_monotonic; | ||
| 59 | /* Offset clock monotonic -> clock realtime */ | ||
| 60 | ktime_t offs_real; | ||
| 61 | /* time spent in suspend */ | ||
| 62 | struct timespec total_sleep_time; | ||
| 63 | /* Offset clock monotonic -> clock boottime */ | ||
| 64 | ktime_t offs_boot; | ||
| 65 | /* The raw monotonic time for the CLOCK_MONOTONIC_RAW posix clock. */ | ||
| 66 | struct timespec raw_time; | ||
| 67 | /* The current UTC to TAI offset in seconds */ | ||
| 68 | s32 tai_offset; | ||
| 69 | /* Offset clock monotonic -> clock tai */ | ||
| 70 | ktime_t offs_tai; | ||
| 71 | |||
| 72 | }; | 105 | }; |
| 73 | 106 | ||
| 74 | static inline struct timespec tk_xtime(struct timekeeper *tk) | ||
| 75 | { | ||
| 76 | struct timespec ts; | ||
| 77 | |||
| 78 | ts.tv_sec = tk->xtime_sec; | ||
| 79 | ts.tv_nsec = (long)(tk->xtime_nsec >> tk->shift); | ||
| 80 | return ts; | ||
| 81 | } | ||
| 82 | |||
| 83 | |||
| 84 | #ifdef CONFIG_GENERIC_TIME_VSYSCALL | 107 | #ifdef CONFIG_GENERIC_TIME_VSYSCALL |
| 85 | 108 | ||
| 86 | extern void update_vsyscall(struct timekeeper *tk); | 109 | extern void update_vsyscall(struct timekeeper *tk); |
| @@ -89,17 +112,10 @@ extern void update_vsyscall_tz(void); | |||
| 89 | #elif defined(CONFIG_GENERIC_TIME_VSYSCALL_OLD) | 112 | #elif defined(CONFIG_GENERIC_TIME_VSYSCALL_OLD) |
| 90 | 113 | ||
| 91 | extern void update_vsyscall_old(struct timespec *ts, struct timespec *wtm, | 114 | extern void update_vsyscall_old(struct timespec *ts, struct timespec *wtm, |
| 92 | struct clocksource *c, u32 mult); | 115 | struct clocksource *c, u32 mult, |
| 116 | cycle_t cycle_last); | ||
| 93 | extern void update_vsyscall_tz(void); | 117 | extern void update_vsyscall_tz(void); |
| 94 | 118 | ||
| 95 | static inline void update_vsyscall(struct timekeeper *tk) | ||
| 96 | { | ||
| 97 | struct timespec xt; | ||
| 98 | |||
| 99 | xt = tk_xtime(tk); | ||
| 100 | update_vsyscall_old(&xt, &tk->wall_to_monotonic, tk->clock, tk->mult); | ||
| 101 | } | ||
| 102 | |||
| 103 | #else | 119 | #else |
| 104 | 120 | ||
| 105 | static inline void update_vsyscall(struct timekeeper *tk) | 121 | static inline void update_vsyscall(struct timekeeper *tk) |
diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h new file mode 100644 index 000000000000..1caa6b04fdc5 --- /dev/null +++ b/include/linux/timekeeping.h | |||
| @@ -0,0 +1,209 @@ | |||
| 1 | #ifndef _LINUX_TIMEKEEPING_H | ||
| 2 | #define _LINUX_TIMEKEEPING_H | ||
| 3 | |||
| 4 | /* Included from linux/ktime.h */ | ||
| 5 | |||
| 6 | void timekeeping_init(void); | ||
| 7 | extern int timekeeping_suspended; | ||
| 8 | |||
| 9 | /* | ||
| 10 | * Get and set timeofday | ||
| 11 | */ | ||
| 12 | extern void do_gettimeofday(struct timeval *tv); | ||
| 13 | extern int do_settimeofday(const struct timespec *tv); | ||
| 14 | extern int do_sys_settimeofday(const struct timespec *tv, | ||
| 15 | const struct timezone *tz); | ||
| 16 | |||
| 17 | /* | ||
| 18 | * Kernel time accessors | ||
| 19 | */ | ||
| 20 | unsigned long get_seconds(void); | ||
| 21 | struct timespec current_kernel_time(void); | ||
| 22 | /* does not take xtime_lock */ | ||
| 23 | struct timespec __current_kernel_time(void); | ||
| 24 | |||
| 25 | /* | ||
| 26 | * timespec based interfaces | ||
| 27 | */ | ||
| 28 | struct timespec get_monotonic_coarse(void); | ||
| 29 | extern void getrawmonotonic(struct timespec *ts); | ||
| 30 | extern void ktime_get_ts64(struct timespec64 *ts); | ||
| 31 | |||
| 32 | extern int __getnstimeofday64(struct timespec64 *tv); | ||
| 33 | extern void getnstimeofday64(struct timespec64 *tv); | ||
| 34 | |||
| 35 | #if BITS_PER_LONG == 64 | ||
| 36 | static inline int __getnstimeofday(struct timespec *ts) | ||
| 37 | { | ||
| 38 | return __getnstimeofday64(ts); | ||
| 39 | } | ||
| 40 | |||
| 41 | static inline void getnstimeofday(struct timespec *ts) | ||
| 42 | { | ||
| 43 | getnstimeofday64(ts); | ||
| 44 | } | ||
| 45 | |||
| 46 | static inline void ktime_get_ts(struct timespec *ts) | ||
| 47 | { | ||
| 48 | ktime_get_ts64(ts); | ||
| 49 | } | ||
| 50 | |||
| 51 | static inline void ktime_get_real_ts(struct timespec *ts) | ||
| 52 | { | ||
| 53 | getnstimeofday64(ts); | ||
| 54 | } | ||
| 55 | |||
| 56 | #else | ||
| 57 | static inline int __getnstimeofday(struct timespec *ts) | ||
| 58 | { | ||
| 59 | struct timespec64 ts64; | ||
| 60 | int ret = __getnstimeofday64(&ts64); | ||
| 61 | |||
| 62 | *ts = timespec64_to_timespec(ts64); | ||
| 63 | return ret; | ||
| 64 | } | ||
| 65 | |||
| 66 | static inline void getnstimeofday(struct timespec *ts) | ||
| 67 | { | ||
| 68 | struct timespec64 ts64; | ||
| 69 | |||
| 70 | getnstimeofday64(&ts64); | ||
| 71 | *ts = timespec64_to_timespec(ts64); | ||
| 72 | } | ||
| 73 | |||
| 74 | static inline void ktime_get_ts(struct timespec *ts) | ||
| 75 | { | ||
| 76 | struct timespec64 ts64; | ||
| 77 | |||
| 78 | ktime_get_ts64(&ts64); | ||
| 79 | *ts = timespec64_to_timespec(ts64); | ||
| 80 | } | ||
| 81 | |||
| 82 | static inline void ktime_get_real_ts(struct timespec *ts) | ||
| 83 | { | ||
| 84 | struct timespec64 ts64; | ||
| 85 | |||
| 86 | getnstimeofday64(&ts64); | ||
| 87 | *ts = timespec64_to_timespec(ts64); | ||
| 88 | } | ||
| 89 | #endif | ||
| 90 | |||
| 91 | extern void getboottime(struct timespec *ts); | ||
| 92 | |||
| 93 | #define do_posix_clock_monotonic_gettime(ts) ktime_get_ts(ts) | ||
| 94 | #define ktime_get_real_ts64(ts) getnstimeofday64(ts) | ||
| 95 | |||
| 96 | /* | ||
| 97 | * ktime_t based interfaces | ||
| 98 | */ | ||
| 99 | |||
| 100 | enum tk_offsets { | ||
| 101 | TK_OFFS_REAL, | ||
| 102 | TK_OFFS_BOOT, | ||
| 103 | TK_OFFS_TAI, | ||
| 104 | TK_OFFS_MAX, | ||
| 105 | }; | ||
| 106 | |||
| 107 | extern ktime_t ktime_get(void); | ||
| 108 | extern ktime_t ktime_get_with_offset(enum tk_offsets offs); | ||
| 109 | extern ktime_t ktime_mono_to_any(ktime_t tmono, enum tk_offsets offs); | ||
| 110 | extern ktime_t ktime_get_raw(void); | ||
| 111 | |||
| 112 | /** | ||
| 113 | * ktime_get_real - get the real (wall-) time in ktime_t format | ||
| 114 | */ | ||
| 115 | static inline ktime_t ktime_get_real(void) | ||
| 116 | { | ||
| 117 | return ktime_get_with_offset(TK_OFFS_REAL); | ||
| 118 | } | ||
| 119 | |||
| 120 | /** | ||
| 121 | * ktime_get_boottime - Returns monotonic time since boot in ktime_t format | ||
| 122 | * | ||
| 123 | * This is similar to CLOCK_MONTONIC/ktime_get, but also includes the | ||
| 124 | * time spent in suspend. | ||
| 125 | */ | ||
| 126 | static inline ktime_t ktime_get_boottime(void) | ||
| 127 | { | ||
| 128 | return ktime_get_with_offset(TK_OFFS_BOOT); | ||
| 129 | } | ||
| 130 | |||
| 131 | /** | ||
| 132 | * ktime_get_clocktai - Returns the TAI time of day in ktime_t format | ||
| 133 | */ | ||
| 134 | static inline ktime_t ktime_get_clocktai(void) | ||
| 135 | { | ||
| 136 | return ktime_get_with_offset(TK_OFFS_TAI); | ||
| 137 | } | ||
| 138 | |||
| 139 | /** | ||
| 140 | * ktime_mono_to_real - Convert monotonic time to clock realtime | ||
| 141 | */ | ||
| 142 | static inline ktime_t ktime_mono_to_real(ktime_t mono) | ||
| 143 | { | ||
| 144 | return ktime_mono_to_any(mono, TK_OFFS_REAL); | ||
| 145 | } | ||
| 146 | |||
| 147 | static inline u64 ktime_get_ns(void) | ||
| 148 | { | ||
| 149 | return ktime_to_ns(ktime_get()); | ||
| 150 | } | ||
| 151 | |||
| 152 | static inline u64 ktime_get_real_ns(void) | ||
| 153 | { | ||
| 154 | return ktime_to_ns(ktime_get_real()); | ||
| 155 | } | ||
| 156 | |||
| 157 | static inline u64 ktime_get_boot_ns(void) | ||
| 158 | { | ||
| 159 | return ktime_to_ns(ktime_get_boottime()); | ||
| 160 | } | ||
| 161 | |||
| 162 | static inline u64 ktime_get_raw_ns(void) | ||
| 163 | { | ||
| 164 | return ktime_to_ns(ktime_get_raw()); | ||
| 165 | } | ||
| 166 | |||
| 167 | extern u64 ktime_get_mono_fast_ns(void); | ||
| 168 | |||
| 169 | /* | ||
| 170 | * Timespec interfaces utilizing the ktime based ones | ||
| 171 | */ | ||
| 172 | static inline void get_monotonic_boottime(struct timespec *ts) | ||
| 173 | { | ||
| 174 | *ts = ktime_to_timespec(ktime_get_boottime()); | ||
| 175 | } | ||
| 176 | |||
| 177 | static inline void timekeeping_clocktai(struct timespec *ts) | ||
| 178 | { | ||
| 179 | *ts = ktime_to_timespec(ktime_get_clocktai()); | ||
| 180 | } | ||
| 181 | |||
| 182 | /* | ||
| 183 | * RTC specific | ||
| 184 | */ | ||
| 185 | extern void timekeeping_inject_sleeptime(struct timespec *delta); | ||
| 186 | |||
| 187 | /* | ||
| 188 | * PPS accessor | ||
| 189 | */ | ||
| 190 | extern void getnstime_raw_and_real(struct timespec *ts_raw, | ||
| 191 | struct timespec *ts_real); | ||
| 192 | |||
| 193 | /* | ||
| 194 | * Persistent clock related interfaces | ||
| 195 | */ | ||
| 196 | extern bool persistent_clock_exist; | ||
| 197 | extern int persistent_clock_is_local; | ||
| 198 | |||
| 199 | static inline bool has_persistent_clock(void) | ||
| 200 | { | ||
| 201 | return persistent_clock_exist; | ||
| 202 | } | ||
| 203 | |||
| 204 | extern void read_persistent_clock(struct timespec *ts); | ||
| 205 | extern void read_boot_clock(struct timespec *ts); | ||
| 206 | extern int update_persistent_clock(struct timespec now); | ||
| 207 | |||
| 208 | |||
| 209 | #endif | ||
diff --git a/include/linux/timerfd.h b/include/linux/timerfd.h index d3b57fa12225..bd36ce431e32 100644 --- a/include/linux/timerfd.h +++ b/include/linux/timerfd.h | |||
| @@ -11,6 +11,9 @@ | |||
| 11 | /* For O_CLOEXEC and O_NONBLOCK */ | 11 | /* For O_CLOEXEC and O_NONBLOCK */ |
| 12 | #include <linux/fcntl.h> | 12 | #include <linux/fcntl.h> |
| 13 | 13 | ||
| 14 | /* For _IO helpers */ | ||
| 15 | #include <linux/ioctl.h> | ||
| 16 | |||
| 14 | /* | 17 | /* |
| 15 | * CAREFUL: Check include/asm-generic/fcntl.h when defining | 18 | * CAREFUL: Check include/asm-generic/fcntl.h when defining |
| 16 | * new flags, since they might collide with O_* ones. We want | 19 | * new flags, since they might collide with O_* ones. We want |
| @@ -29,4 +32,6 @@ | |||
| 29 | /* Flags for timerfd_settime. */ | 32 | /* Flags for timerfd_settime. */ |
| 30 | #define TFD_SETTIME_FLAGS (TFD_TIMER_ABSTIME | TFD_TIMER_CANCEL_ON_SET) | 33 | #define TFD_SETTIME_FLAGS (TFD_TIMER_ABSTIME | TFD_TIMER_CANCEL_ON_SET) |
| 31 | 34 | ||
| 35 | #define TFD_IOC_SET_TICKS _IOW('T', 0, u64) | ||
| 36 | |||
| 32 | #endif /* _LINUX_TIMERFD_H */ | 37 | #endif /* _LINUX_TIMERFD_H */ |
diff --git a/include/linux/tpm.h b/include/linux/tpm.h index fff1d0976f80..8350c538b486 100644 --- a/include/linux/tpm.h +++ b/include/linux/tpm.h | |||
| @@ -39,6 +39,9 @@ struct tpm_class_ops { | |||
| 39 | int (*send) (struct tpm_chip *chip, u8 *buf, size_t len); | 39 | int (*send) (struct tpm_chip *chip, u8 *buf, size_t len); |
| 40 | void (*cancel) (struct tpm_chip *chip); | 40 | void (*cancel) (struct tpm_chip *chip); |
| 41 | u8 (*status) (struct tpm_chip *chip); | 41 | u8 (*status) (struct tpm_chip *chip); |
| 42 | bool (*update_timeouts)(struct tpm_chip *chip, | ||
| 43 | unsigned long *timeout_cap); | ||
| 44 | |||
| 42 | }; | 45 | }; |
| 43 | 46 | ||
| 44 | #if defined(CONFIG_TCG_TPM) || defined(CONFIG_TCG_TPM_MODULE) | 47 | #if defined(CONFIG_TCG_TPM) || defined(CONFIG_TCG_TPM_MODULE) |
diff --git a/include/linux/trace_seq.h b/include/linux/trace_seq.h index 136116924d8d..ea6c9dea79e3 100644 --- a/include/linux/trace_seq.h +++ b/include/linux/trace_seq.h | |||
| @@ -25,6 +25,21 @@ trace_seq_init(struct trace_seq *s) | |||
| 25 | s->full = 0; | 25 | s->full = 0; |
| 26 | } | 26 | } |
| 27 | 27 | ||
| 28 | /** | ||
| 29 | * trace_seq_buffer_ptr - return pointer to next location in buffer | ||
| 30 | * @s: trace sequence descriptor | ||
| 31 | * | ||
| 32 | * Returns the pointer to the buffer where the next write to | ||
| 33 | * the buffer will happen. This is useful to save the location | ||
| 34 | * that is about to be written to and then return the result | ||
| 35 | * of that write. | ||
| 36 | */ | ||
| 37 | static inline unsigned char * | ||
| 38 | trace_seq_buffer_ptr(struct trace_seq *s) | ||
| 39 | { | ||
| 40 | return s->buffer + s->len; | ||
| 41 | } | ||
| 42 | |||
| 28 | /* | 43 | /* |
| 29 | * Currently only defined when tracing is enabled. | 44 | * Currently only defined when tracing is enabled. |
| 30 | */ | 45 | */ |
| @@ -36,14 +51,13 @@ int trace_seq_vprintf(struct trace_seq *s, const char *fmt, va_list args); | |||
| 36 | extern int | 51 | extern int |
| 37 | trace_seq_bprintf(struct trace_seq *s, const char *fmt, const u32 *binary); | 52 | trace_seq_bprintf(struct trace_seq *s, const char *fmt, const u32 *binary); |
| 38 | extern int trace_print_seq(struct seq_file *m, struct trace_seq *s); | 53 | extern int trace_print_seq(struct seq_file *m, struct trace_seq *s); |
| 39 | extern ssize_t trace_seq_to_user(struct trace_seq *s, char __user *ubuf, | 54 | extern int trace_seq_to_user(struct trace_seq *s, char __user *ubuf, |
| 40 | size_t cnt); | 55 | int cnt); |
| 41 | extern int trace_seq_puts(struct trace_seq *s, const char *str); | 56 | extern int trace_seq_puts(struct trace_seq *s, const char *str); |
| 42 | extern int trace_seq_putc(struct trace_seq *s, unsigned char c); | 57 | extern int trace_seq_putc(struct trace_seq *s, unsigned char c); |
| 43 | extern int trace_seq_putmem(struct trace_seq *s, const void *mem, size_t len); | 58 | extern int trace_seq_putmem(struct trace_seq *s, const void *mem, unsigned int len); |
| 44 | extern int trace_seq_putmem_hex(struct trace_seq *s, const void *mem, | 59 | extern int trace_seq_putmem_hex(struct trace_seq *s, const void *mem, |
| 45 | size_t len); | 60 | unsigned int len); |
| 46 | extern void *trace_seq_reserve(struct trace_seq *s, size_t len); | ||
| 47 | extern int trace_seq_path(struct trace_seq *s, const struct path *path); | 61 | extern int trace_seq_path(struct trace_seq *s, const struct path *path); |
| 48 | 62 | ||
| 49 | extern int trace_seq_bitmask(struct trace_seq *s, const unsigned long *maskp, | 63 | extern int trace_seq_bitmask(struct trace_seq *s, const unsigned long *maskp, |
| @@ -71,8 +85,8 @@ static inline int trace_print_seq(struct seq_file *m, struct trace_seq *s) | |||
| 71 | { | 85 | { |
| 72 | return 0; | 86 | return 0; |
| 73 | } | 87 | } |
| 74 | static inline ssize_t trace_seq_to_user(struct trace_seq *s, char __user *ubuf, | 88 | static inline int trace_seq_to_user(struct trace_seq *s, char __user *ubuf, |
| 75 | size_t cnt) | 89 | int cnt) |
| 76 | { | 90 | { |
| 77 | return 0; | 91 | return 0; |
| 78 | } | 92 | } |
| @@ -85,19 +99,15 @@ static inline int trace_seq_putc(struct trace_seq *s, unsigned char c) | |||
| 85 | return 0; | 99 | return 0; |
| 86 | } | 100 | } |
| 87 | static inline int | 101 | static inline int |
| 88 | trace_seq_putmem(struct trace_seq *s, const void *mem, size_t len) | 102 | trace_seq_putmem(struct trace_seq *s, const void *mem, unsigned int len) |
| 89 | { | 103 | { |
| 90 | return 0; | 104 | return 0; |
| 91 | } | 105 | } |
| 92 | static inline int trace_seq_putmem_hex(struct trace_seq *s, const void *mem, | 106 | static inline int trace_seq_putmem_hex(struct trace_seq *s, const void *mem, |
| 93 | size_t len) | 107 | unsigned int len) |
| 94 | { | 108 | { |
| 95 | return 0; | 109 | return 0; |
| 96 | } | 110 | } |
| 97 | static inline void *trace_seq_reserve(struct trace_seq *s, size_t len) | ||
| 98 | { | ||
| 99 | return NULL; | ||
| 100 | } | ||
| 101 | static inline int trace_seq_path(struct trace_seq *s, const struct path *path) | 111 | static inline int trace_seq_path(struct trace_seq *s, const struct path *path) |
| 102 | { | 112 | { |
| 103 | return 0; | 113 | return 0; |
diff --git a/include/linux/tty.h b/include/linux/tty.h index 1c3316a47d7e..84132942902a 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h | |||
| @@ -477,13 +477,11 @@ extern int tty_mode_ioctl(struct tty_struct *tty, struct file *file, | |||
| 477 | unsigned int cmd, unsigned long arg); | 477 | unsigned int cmd, unsigned long arg); |
| 478 | extern int tty_perform_flush(struct tty_struct *tty, unsigned long arg); | 478 | extern int tty_perform_flush(struct tty_struct *tty, unsigned long arg); |
| 479 | extern void tty_default_fops(struct file_operations *fops); | 479 | extern void tty_default_fops(struct file_operations *fops); |
| 480 | extern struct tty_struct *alloc_tty_struct(void); | 480 | extern struct tty_struct *alloc_tty_struct(struct tty_driver *driver, int idx); |
| 481 | extern int tty_alloc_file(struct file *file); | 481 | extern int tty_alloc_file(struct file *file); |
| 482 | extern void tty_add_file(struct tty_struct *tty, struct file *file); | 482 | extern void tty_add_file(struct tty_struct *tty, struct file *file); |
| 483 | extern void tty_free_file(struct file *file); | 483 | extern void tty_free_file(struct file *file); |
| 484 | extern void free_tty_struct(struct tty_struct *tty); | 484 | extern void free_tty_struct(struct tty_struct *tty); |
| 485 | extern void initialize_tty_struct(struct tty_struct *tty, | ||
| 486 | struct tty_driver *driver, int idx); | ||
| 487 | extern void deinitialize_tty_struct(struct tty_struct *tty); | 485 | extern void deinitialize_tty_struct(struct tty_struct *tty); |
| 488 | extern struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx); | 486 | extern struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx); |
| 489 | extern int tty_release(struct inode *inode, struct file *filp); | 487 | extern int tty_release(struct inode *inode, struct file *filp); |
diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h index 756a60989294..e48c608a8fa8 100644 --- a/include/linux/tty_driver.h +++ b/include/linux/tty_driver.h | |||
| @@ -35,14 +35,14 @@ | |||
| 35 | * This routine is mandatory; if this routine is not filled in, | 35 | * This routine is mandatory; if this routine is not filled in, |
| 36 | * the attempted open will fail with ENODEV. | 36 | * the attempted open will fail with ENODEV. |
| 37 | * | 37 | * |
| 38 | * Required method. | 38 | * Required method. Called with tty lock held. |
| 39 | * | 39 | * |
| 40 | * void (*close)(struct tty_struct * tty, struct file * filp); | 40 | * void (*close)(struct tty_struct * tty, struct file * filp); |
| 41 | * | 41 | * |
| 42 | * This routine is called when a particular tty device is closed. | 42 | * This routine is called when a particular tty device is closed. |
| 43 | * Note: called even if the corresponding open() failed. | 43 | * Note: called even if the corresponding open() failed. |
| 44 | * | 44 | * |
| 45 | * Required method. | 45 | * Required method. Called with tty lock held. |
| 46 | * | 46 | * |
| 47 | * void (*shutdown)(struct tty_struct * tty); | 47 | * void (*shutdown)(struct tty_struct * tty); |
| 48 | * | 48 | * |
| @@ -172,6 +172,8 @@ | |||
| 172 | * | 172 | * |
| 173 | * Optional: | 173 | * Optional: |
| 174 | * | 174 | * |
| 175 | * Called with tty lock held. | ||
| 176 | * | ||
| 175 | * int (*break_ctl)(struct tty_struct *tty, int state); | 177 | * int (*break_ctl)(struct tty_struct *tty, int state); |
| 176 | * | 178 | * |
| 177 | * This optional routine requests the tty driver to turn on or | 179 | * This optional routine requests the tty driver to turn on or |
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h index 7373203140e7..c330f5ef42cf 100644 --- a/include/linux/usb/composite.h +++ b/include/linux/usb/composite.h | |||
| @@ -386,6 +386,21 @@ struct usb_composite_driver { | |||
| 386 | 386 | ||
| 387 | extern int usb_composite_probe(struct usb_composite_driver *driver); | 387 | extern int usb_composite_probe(struct usb_composite_driver *driver); |
| 388 | extern void usb_composite_unregister(struct usb_composite_driver *driver); | 388 | extern void usb_composite_unregister(struct usb_composite_driver *driver); |
| 389 | |||
| 390 | /** | ||
| 391 | * module_usb_composite_driver() - Helper macro for registering a USB gadget | ||
| 392 | * composite driver | ||
| 393 | * @__usb_composite_driver: usb_composite_driver struct | ||
| 394 | * | ||
| 395 | * Helper macro for USB gadget composite drivers which do not do anything | ||
| 396 | * special in module init/exit. This eliminates a lot of boilerplate. Each | ||
| 397 | * module may only use this macro once, and calling it replaces module_init() | ||
| 398 | * and module_exit() | ||
| 399 | */ | ||
| 400 | #define module_usb_composite_driver(__usb_composite_driver) \ | ||
| 401 | module_driver(__usb_composite_driver, usb_composite_probe, \ | ||
| 402 | usb_composite_unregister) | ||
| 403 | |||
| 389 | extern void usb_composite_setup_continue(struct usb_composite_dev *cdev); | 404 | extern void usb_composite_setup_continue(struct usb_composite_dev *cdev); |
| 390 | extern int composite_dev_prepare(struct usb_composite_driver *composite, | 405 | extern int composite_dev_prepare(struct usb_composite_driver *composite, |
| 391 | struct usb_composite_dev *cdev); | 406 | struct usb_composite_dev *cdev); |
diff --git a/include/linux/usb/quirks.h b/include/linux/usb/quirks.h index 52f944dfe2fd..55a17b188daa 100644 --- a/include/linux/usb/quirks.h +++ b/include/linux/usb/quirks.h | |||
| @@ -30,4 +30,15 @@ | |||
| 30 | descriptor */ | 30 | descriptor */ |
| 31 | #define USB_QUIRK_DELAY_INIT 0x00000040 | 31 | #define USB_QUIRK_DELAY_INIT 0x00000040 |
| 32 | 32 | ||
| 33 | /* | ||
| 34 | * For high speed and super speed interupt endpoints, the USB 2.0 and | ||
| 35 | * USB 3.0 spec require the interval in microframes | ||
| 36 | * (1 microframe = 125 microseconds) to be calculated as | ||
| 37 | * interval = 2 ^ (bInterval-1). | ||
| 38 | * | ||
| 39 | * Devices with this quirk report their bInterval as the result of this | ||
| 40 | * calculation instead of the exponent variable used in the calculation. | ||
| 41 | */ | ||
| 42 | #define USB_QUIRK_LINEAR_UFRAME_INTR_BINTERVAL 0x00000080 | ||
| 43 | |||
| 33 | #endif /* __LINUX_USB_QUIRKS_H */ | 44 | #endif /* __LINUX_USB_QUIRKS_H */ |
diff --git a/include/linux/usb/renesas_usbhs.h b/include/linux/usb/renesas_usbhs.h index e452ba6ec6bd..d5952bb66752 100644 --- a/include/linux/usb/renesas_usbhs.h +++ b/include/linux/usb/renesas_usbhs.h | |||
| @@ -153,6 +153,9 @@ struct renesas_usbhs_driver_param { | |||
| 153 | */ | 153 | */ |
| 154 | int pio_dma_border; /* default is 64byte */ | 154 | int pio_dma_border; /* default is 64byte */ |
| 155 | 155 | ||
| 156 | u32 type; | ||
| 157 | u32 enable_gpio; | ||
| 158 | |||
| 156 | /* | 159 | /* |
| 157 | * option: | 160 | * option: |
| 158 | */ | 161 | */ |
| @@ -160,6 +163,9 @@ struct renesas_usbhs_driver_param { | |||
| 160 | u32 has_sudmac:1; /* for SUDMAC */ | 163 | u32 has_sudmac:1; /* for SUDMAC */ |
| 161 | }; | 164 | }; |
| 162 | 165 | ||
| 166 | #define USBHS_TYPE_R8A7790 1 | ||
| 167 | #define USBHS_TYPE_R8A7791 2 | ||
| 168 | |||
| 163 | /* | 169 | /* |
| 164 | * option: | 170 | * option: |
| 165 | * | 171 | * |
diff --git a/include/linux/usb/usb338x.h b/include/linux/usb/usb338x.h new file mode 100644 index 000000000000..f92eb635b9d3 --- /dev/null +++ b/include/linux/usb/usb338x.h | |||
| @@ -0,0 +1,199 @@ | |||
| 1 | /* | ||
| 2 | * USB 338x super/high/full speed USB device controller. | ||
| 3 | * Unlike many such controllers, this one talks PCI. | ||
| 4 | * | ||
| 5 | * Copyright (C) 2002 NetChip Technology, Inc. (http://www.netchip.com) | ||
| 6 | * Copyright (C) 2003 David Brownell | ||
| 7 | * Copyright (C) 2014 Ricardo Ribalda - Qtechnology/AS | ||
| 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 | */ | ||
| 20 | |||
| 21 | #ifndef __LINUX_USB_USB338X_H | ||
| 22 | #define __LINUX_USB_USB338X_H | ||
| 23 | |||
| 24 | #include <linux/usb/net2280.h> | ||
| 25 | |||
| 26 | /* | ||
| 27 | * Extra defined bits for net2280 registers | ||
| 28 | */ | ||
| 29 | #define SCRATCH 0x0b | ||
| 30 | |||
| 31 | #define DEFECT7374_FSM_FIELD 28 | ||
| 32 | #define SUPER_SPEED 8 | ||
| 33 | #define DMA_REQUEST_OUTSTANDING 5 | ||
| 34 | #define DMA_PAUSE_DONE_INTERRUPT 26 | ||
| 35 | #define SET_ISOCHRONOUS_DELAY 24 | ||
| 36 | #define SET_SEL 22 | ||
| 37 | #define SUPER_SPEED_MODE 8 | ||
| 38 | |||
| 39 | /*ep_cfg*/ | ||
| 40 | #define MAX_BURST_SIZE 24 | ||
| 41 | #define EP_FIFO_BYTE_COUNT 16 | ||
| 42 | #define IN_ENDPOINT_ENABLE 14 | ||
| 43 | #define IN_ENDPOINT_TYPE 12 | ||
| 44 | #define OUT_ENDPOINT_ENABLE 10 | ||
| 45 | #define OUT_ENDPOINT_TYPE 8 | ||
| 46 | |||
| 47 | struct usb338x_usb_ext_regs { | ||
| 48 | u32 usbclass; | ||
| 49 | #define DEVICE_PROTOCOL 16 | ||
| 50 | #define DEVICE_SUB_CLASS 8 | ||
| 51 | #define DEVICE_CLASS 0 | ||
| 52 | u32 ss_sel; | ||
| 53 | #define U2_SYSTEM_EXIT_LATENCY 8 | ||
| 54 | #define U1_SYSTEM_EXIT_LATENCY 0 | ||
| 55 | u32 ss_del; | ||
| 56 | #define U2_DEVICE_EXIT_LATENCY 8 | ||
| 57 | #define U1_DEVICE_EXIT_LATENCY 0 | ||
| 58 | u32 usb2lpm; | ||
| 59 | #define USB_L1_LPM_HIRD 2 | ||
| 60 | #define USB_L1_LPM_REMOTE_WAKE 1 | ||
| 61 | #define USB_L1_LPM_SUPPORT 0 | ||
| 62 | u32 usb3belt; | ||
| 63 | #define BELT_MULTIPLIER 10 | ||
| 64 | #define BEST_EFFORT_LATENCY_TOLERANCE 0 | ||
| 65 | u32 usbctl2; | ||
| 66 | #define LTM_ENABLE 7 | ||
| 67 | #define U2_ENABLE 6 | ||
| 68 | #define U1_ENABLE 5 | ||
| 69 | #define FUNCTION_SUSPEND 4 | ||
| 70 | #define USB3_CORE_ENABLE 3 | ||
| 71 | #define USB2_CORE_ENABLE 2 | ||
| 72 | #define SERIAL_NUMBER_STRING_ENABLE 0 | ||
| 73 | u32 in_timeout; | ||
| 74 | #define GPEP3_TIMEOUT 19 | ||
| 75 | #define GPEP2_TIMEOUT 18 | ||
| 76 | #define GPEP1_TIMEOUT 17 | ||
| 77 | #define GPEP0_TIMEOUT 16 | ||
| 78 | #define GPEP3_TIMEOUT_VALUE 13 | ||
| 79 | #define GPEP3_TIMEOUT_ENABLE 12 | ||
| 80 | #define GPEP2_TIMEOUT_VALUE 9 | ||
| 81 | #define GPEP2_TIMEOUT_ENABLE 8 | ||
| 82 | #define GPEP1_TIMEOUT_VALUE 5 | ||
| 83 | #define GPEP1_TIMEOUT_ENABLE 4 | ||
| 84 | #define GPEP0_TIMEOUT_VALUE 1 | ||
| 85 | #define GPEP0_TIMEOUT_ENABLE 0 | ||
| 86 | u32 isodelay; | ||
| 87 | #define ISOCHRONOUS_DELAY 0 | ||
| 88 | } __packed; | ||
| 89 | |||
| 90 | struct usb338x_fifo_regs { | ||
| 91 | /* offset 0x0500, 0x0520, 0x0540, 0x0560, 0x0580 */ | ||
| 92 | u32 ep_fifo_size_base; | ||
| 93 | #define IN_FIFO_BASE_ADDRESS 22 | ||
| 94 | #define IN_FIFO_SIZE 16 | ||
| 95 | #define OUT_FIFO_BASE_ADDRESS 6 | ||
| 96 | #define OUT_FIFO_SIZE 0 | ||
| 97 | u32 ep_fifo_out_wrptr; | ||
| 98 | u32 ep_fifo_out_rdptr; | ||
| 99 | u32 ep_fifo_in_wrptr; | ||
| 100 | u32 ep_fifo_in_rdptr; | ||
| 101 | u32 unused[3]; | ||
| 102 | } __packed; | ||
| 103 | |||
| 104 | |||
| 105 | /* Link layer */ | ||
| 106 | struct usb338x_ll_regs { | ||
| 107 | /* offset 0x700 */ | ||
| 108 | u32 ll_ltssm_ctrl1; | ||
| 109 | u32 ll_ltssm_ctrl2; | ||
| 110 | u32 ll_ltssm_ctrl3; | ||
| 111 | u32 unused[2]; | ||
| 112 | u32 ll_general_ctrl0; | ||
| 113 | u32 ll_general_ctrl1; | ||
| 114 | #define PM_U3_AUTO_EXIT 29 | ||
| 115 | #define PM_U2_AUTO_EXIT 28 | ||
| 116 | #define PM_U1_AUTO_EXIT 27 | ||
| 117 | #define PM_FORCE_U2_ENTRY 26 | ||
| 118 | #define PM_FORCE_U1_ENTRY 25 | ||
| 119 | #define PM_LGO_COLLISION_SEND_LAU 24 | ||
| 120 | #define PM_DIR_LINK_REJECT 23 | ||
| 121 | #define PM_FORCE_LINK_ACCEPT 22 | ||
| 122 | #define PM_DIR_ENTRY_U3 20 | ||
| 123 | #define PM_DIR_ENTRY_U2 19 | ||
| 124 | #define PM_DIR_ENTRY_U1 18 | ||
| 125 | #define PM_U2_ENABLE 17 | ||
| 126 | #define PM_U1_ENABLE 16 | ||
| 127 | #define SKP_THRESHOLD_ADJUST_FMW 8 | ||
| 128 | #define RESEND_DPP_ON_LRTY_FMW 7 | ||
| 129 | #define DL_BIT_VALUE_FMW 6 | ||
| 130 | #define FORCE_DL_BIT 5 | ||
| 131 | u32 ll_general_ctrl2; | ||
| 132 | #define SELECT_INVERT_LANE_POLARITY 7 | ||
| 133 | #define FORCE_INVERT_LANE_POLARITY 6 | ||
| 134 | u32 ll_general_ctrl3; | ||
| 135 | u32 ll_general_ctrl4; | ||
| 136 | u32 ll_error_gen; | ||
| 137 | } __packed; | ||
| 138 | |||
| 139 | struct usb338x_ll_lfps_regs { | ||
| 140 | /* offset 0x748 */ | ||
| 141 | u32 ll_lfps_5; | ||
| 142 | #define TIMER_LFPS_6US 16 | ||
| 143 | u32 ll_lfps_6; | ||
| 144 | #define TIMER_LFPS_80US 0 | ||
| 145 | } __packed; | ||
| 146 | |||
| 147 | struct usb338x_ll_tsn_regs { | ||
| 148 | /* offset 0x77C */ | ||
| 149 | u32 ll_tsn_counters_2; | ||
| 150 | #define HOT_TX_NORESET_TS2 24 | ||
| 151 | u32 ll_tsn_counters_3; | ||
| 152 | #define HOT_RX_RESET_TS2 0 | ||
| 153 | } __packed; | ||
| 154 | |||
| 155 | struct usb338x_ll_chi_regs { | ||
| 156 | /* offset 0x79C */ | ||
| 157 | u32 ll_tsn_chicken_bit; | ||
| 158 | #define RECOVERY_IDLE_TO_RECOVER_FMW 3 | ||
| 159 | } __packed; | ||
| 160 | |||
| 161 | /* protocol layer */ | ||
| 162 | struct usb338x_pl_regs { | ||
| 163 | /* offset 0x800 */ | ||
| 164 | u32 pl_reg_1; | ||
| 165 | u32 pl_reg_2; | ||
| 166 | u32 pl_reg_3; | ||
| 167 | u32 pl_reg_4; | ||
| 168 | u32 pl_ep_ctrl; | ||
| 169 | /* Protocol Layer Endpoint Control*/ | ||
| 170 | #define PL_EP_CTRL 0x810 | ||
| 171 | #define ENDPOINT_SELECT 0 | ||
| 172 | /* [4:0] */ | ||
| 173 | #define EP_INITIALIZED 16 | ||
| 174 | #define SEQUENCE_NUMBER_RESET 17 | ||
| 175 | #define CLEAR_ACK_ERROR_CODE 20 | ||
| 176 | u32 pl_reg_6; | ||
| 177 | u32 pl_reg_7; | ||
| 178 | u32 pl_reg_8; | ||
| 179 | u32 pl_ep_status_1; | ||
| 180 | /* Protocol Layer Endpoint Status 1*/ | ||
| 181 | #define PL_EP_STATUS_1 0x820 | ||
| 182 | #define STATE 16 | ||
| 183 | #define ACK_GOOD_NORMAL 0x11 | ||
| 184 | #define ACK_GOOD_MORE_ACKS_TO_COME 0x16 | ||
| 185 | u32 pl_ep_status_2; | ||
| 186 | u32 pl_ep_status_3; | ||
| 187 | /* Protocol Layer Endpoint Status 3*/ | ||
| 188 | #define PL_EP_STATUS_3 0x828 | ||
| 189 | #define SEQUENCE_NUMBER 0 | ||
| 190 | u32 pl_ep_status_4; | ||
| 191 | /* Protocol Layer Endpoint Status 4*/ | ||
| 192 | #define PL_EP_STATUS_4 0x82c | ||
| 193 | u32 pl_ep_cfg_4; | ||
| 194 | /* Protocol Layer Endpoint Configuration 4*/ | ||
| 195 | #define PL_EP_CFG_4 0x830 | ||
| 196 | #define NON_CTRL_IN_TOLERATE_BAD_DIR 6 | ||
| 197 | } __packed; | ||
| 198 | |||
| 199 | #endif /* __LINUX_USB_USB338X_H */ | ||
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h index 0662e98fef72..26088feb6608 100644 --- a/include/linux/usb/usbnet.h +++ b/include/linux/usb/usbnet.h | |||
| @@ -148,6 +148,9 @@ struct driver_info { | |||
| 148 | struct sk_buff *(*tx_fixup)(struct usbnet *dev, | 148 | struct sk_buff *(*tx_fixup)(struct usbnet *dev, |
| 149 | struct sk_buff *skb, gfp_t flags); | 149 | struct sk_buff *skb, gfp_t flags); |
| 150 | 150 | ||
| 151 | /* recover from timeout */ | ||
| 152 | void (*recover)(struct usbnet *dev); | ||
| 153 | |||
| 151 | /* early initialization code, can sleep. This is for minidrivers | 154 | /* early initialization code, can sleep. This is for minidrivers |
| 152 | * having 'subminidrivers' that need to do extra initialization | 155 | * having 'subminidrivers' that need to do extra initialization |
| 153 | * right after minidriver have initialized hardware. */ | 156 | * right after minidriver have initialized hardware. */ |
diff --git a/include/linux/usb/xhci_pdriver.h b/include/linux/usb/xhci_pdriver.h new file mode 100644 index 000000000000..376654b5b0f7 --- /dev/null +++ b/include/linux/usb/xhci_pdriver.h | |||
| @@ -0,0 +1,27 @@ | |||
| 1 | /* | ||
| 2 | * This program is free software; you can redistribute it and/or modify | ||
| 3 | * it under the terms of the GNU General Public License version 2 as | ||
| 4 | * published by the Free Software Foundation. | ||
| 5 | * | ||
| 6 | * This program is distributed in the hope that it will be useful, but | ||
| 7 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | ||
| 8 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
| 9 | * for more details. | ||
| 10 | * | ||
| 11 | */ | ||
| 12 | |||
| 13 | #ifndef __USB_CORE_XHCI_PDRIVER_H | ||
| 14 | #define __USB_CORE_XHCI_PDRIVER_H | ||
| 15 | |||
| 16 | /** | ||
| 17 | * struct usb_xhci_pdata - platform_data for generic xhci platform driver | ||
| 18 | * | ||
| 19 | * @usb3_lpm_capable: determines if this xhci platform supports USB3 | ||
| 20 | * LPM capability | ||
| 21 | * | ||
| 22 | */ | ||
| 23 | struct usb_xhci_pdata { | ||
| 24 | unsigned usb3_lpm_capable:1; | ||
| 25 | }; | ||
| 26 | |||
| 27 | #endif /* __USB_CORE_XHCI_PDRIVER_H */ | ||
diff --git a/include/linux/verify_pefile.h b/include/linux/verify_pefile.h new file mode 100644 index 000000000000..ac34819214f9 --- /dev/null +++ b/include/linux/verify_pefile.h | |||
| @@ -0,0 +1,18 @@ | |||
| 1 | /* Signed PE file verification | ||
| 2 | * | ||
| 3 | * Copyright (C) 2014 Red Hat, Inc. All Rights Reserved. | ||
| 4 | * Written by David Howells (dhowells@redhat.com) | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or | ||
| 7 | * modify it under the terms of the GNU General Public Licence | ||
| 8 | * as published by the Free Software Foundation; either version | ||
| 9 | * 2 of the Licence, or (at your option) any later version. | ||
| 10 | */ | ||
| 11 | |||
| 12 | #ifndef _LINUX_VERIFY_PEFILE_H | ||
| 13 | #define _LINUX_VERIFY_PEFILE_H | ||
| 14 | |||
| 15 | extern int verify_pefile_signature(const void *pebuf, unsigned pelen, | ||
| 16 | struct key *trusted_keyring, bool *_trusted); | ||
| 17 | |||
| 18 | #endif /* _LINUX_VERIFY_PEFILE_H */ | ||
diff --git a/include/linux/wait.h b/include/linux/wait.h index bd68819f0815..6fb1ba5f9b2f 100644 --- a/include/linux/wait.h +++ b/include/linux/wait.h | |||
| @@ -25,6 +25,7 @@ struct wait_bit_key { | |||
| 25 | void *flags; | 25 | void *flags; |
| 26 | int bit_nr; | 26 | int bit_nr; |
| 27 | #define WAIT_ATOMIC_T_BIT_NR -1 | 27 | #define WAIT_ATOMIC_T_BIT_NR -1 |
| 28 | unsigned long private; | ||
| 28 | }; | 29 | }; |
| 29 | 30 | ||
| 30 | struct wait_bit_queue { | 31 | struct wait_bit_queue { |
| @@ -141,18 +142,19 @@ __remove_wait_queue(wait_queue_head_t *head, wait_queue_t *old) | |||
| 141 | list_del(&old->task_list); | 142 | list_del(&old->task_list); |
| 142 | } | 143 | } |
| 143 | 144 | ||
| 145 | typedef int wait_bit_action_f(struct wait_bit_key *); | ||
| 144 | void __wake_up(wait_queue_head_t *q, unsigned int mode, int nr, void *key); | 146 | void __wake_up(wait_queue_head_t *q, unsigned int mode, int nr, void *key); |
| 145 | void __wake_up_locked_key(wait_queue_head_t *q, unsigned int mode, void *key); | 147 | void __wake_up_locked_key(wait_queue_head_t *q, unsigned int mode, void *key); |
| 146 | void __wake_up_sync_key(wait_queue_head_t *q, unsigned int mode, int nr, void *key); | 148 | void __wake_up_sync_key(wait_queue_head_t *q, unsigned int mode, int nr, void *key); |
| 147 | void __wake_up_locked(wait_queue_head_t *q, unsigned int mode, int nr); | 149 | void __wake_up_locked(wait_queue_head_t *q, unsigned int mode, int nr); |
| 148 | void __wake_up_sync(wait_queue_head_t *q, unsigned int mode, int nr); | 150 | void __wake_up_sync(wait_queue_head_t *q, unsigned int mode, int nr); |
| 149 | void __wake_up_bit(wait_queue_head_t *, void *, int); | 151 | void __wake_up_bit(wait_queue_head_t *, void *, int); |
| 150 | int __wait_on_bit(wait_queue_head_t *, struct wait_bit_queue *, int (*)(void *), unsigned); | 152 | int __wait_on_bit(wait_queue_head_t *, struct wait_bit_queue *, wait_bit_action_f *, unsigned); |
| 151 | int __wait_on_bit_lock(wait_queue_head_t *, struct wait_bit_queue *, int (*)(void *), unsigned); | 153 | int __wait_on_bit_lock(wait_queue_head_t *, struct wait_bit_queue *, wait_bit_action_f *, unsigned); |
| 152 | void wake_up_bit(void *, int); | 154 | void wake_up_bit(void *, int); |
| 153 | void wake_up_atomic_t(atomic_t *); | 155 | void wake_up_atomic_t(atomic_t *); |
| 154 | int out_of_line_wait_on_bit(void *, int, int (*)(void *), unsigned); | 156 | int out_of_line_wait_on_bit(void *, int, wait_bit_action_f *, unsigned); |
| 155 | int out_of_line_wait_on_bit_lock(void *, int, int (*)(void *), unsigned); | 157 | int out_of_line_wait_on_bit_lock(void *, int, wait_bit_action_f *, unsigned); |
| 156 | int out_of_line_wait_on_atomic_t(atomic_t *, int (*)(atomic_t *), unsigned); | 158 | int out_of_line_wait_on_atomic_t(atomic_t *, int (*)(atomic_t *), unsigned); |
| 157 | wait_queue_head_t *bit_waitqueue(void *, int); | 159 | wait_queue_head_t *bit_waitqueue(void *, int); |
| 158 | 160 | ||
| @@ -854,11 +856,14 @@ int wake_bit_function(wait_queue_t *wait, unsigned mode, int sync, void *key); | |||
| 854 | (wait)->flags = 0; \ | 856 | (wait)->flags = 0; \ |
| 855 | } while (0) | 857 | } while (0) |
| 856 | 858 | ||
| 859 | |||
| 860 | extern int bit_wait(struct wait_bit_key *); | ||
| 861 | extern int bit_wait_io(struct wait_bit_key *); | ||
| 862 | |||
| 857 | /** | 863 | /** |
| 858 | * wait_on_bit - wait for a bit to be cleared | 864 | * wait_on_bit - wait for a bit to be cleared |
| 859 | * @word: the word being waited on, a kernel virtual address | 865 | * @word: the word being waited on, a kernel virtual address |
| 860 | * @bit: the bit of the word being waited on | 866 | * @bit: the bit of the word being waited on |
| 861 | * @action: the function used to sleep, which may take special actions | ||
| 862 | * @mode: the task state to sleep in | 867 | * @mode: the task state to sleep in |
| 863 | * | 868 | * |
| 864 | * There is a standard hashed waitqueue table for generic use. This | 869 | * There is a standard hashed waitqueue table for generic use. This |
| @@ -867,9 +872,62 @@ int wake_bit_function(wait_queue_t *wait, unsigned mode, int sync, void *key); | |||
| 867 | * call wait_on_bit() in threads waiting for the bit to clear. | 872 | * call wait_on_bit() in threads waiting for the bit to clear. |
| 868 | * One uses wait_on_bit() where one is waiting for the bit to clear, | 873 | * One uses wait_on_bit() where one is waiting for the bit to clear, |
| 869 | * but has no intention of setting it. | 874 | * but has no intention of setting it. |
| 875 | * Returned value will be zero if the bit was cleared, or non-zero | ||
| 876 | * if the process received a signal and the mode permitted wakeup | ||
| 877 | * on that signal. | ||
| 878 | */ | ||
| 879 | static inline int | ||
| 880 | wait_on_bit(void *word, int bit, unsigned mode) | ||
| 881 | { | ||
| 882 | if (!test_bit(bit, word)) | ||
| 883 | return 0; | ||
| 884 | return out_of_line_wait_on_bit(word, bit, | ||
| 885 | bit_wait, | ||
| 886 | mode); | ||
| 887 | } | ||
| 888 | |||
| 889 | /** | ||
| 890 | * wait_on_bit_io - wait for a bit to be cleared | ||
| 891 | * @word: the word being waited on, a kernel virtual address | ||
| 892 | * @bit: the bit of the word being waited on | ||
| 893 | * @mode: the task state to sleep in | ||
| 894 | * | ||
| 895 | * Use the standard hashed waitqueue table to wait for a bit | ||
| 896 | * to be cleared. This is similar to wait_on_bit(), but calls | ||
| 897 | * io_schedule() instead of schedule() for the actual waiting. | ||
| 898 | * | ||
| 899 | * Returned value will be zero if the bit was cleared, or non-zero | ||
| 900 | * if the process received a signal and the mode permitted wakeup | ||
| 901 | * on that signal. | ||
| 902 | */ | ||
| 903 | static inline int | ||
| 904 | wait_on_bit_io(void *word, int bit, unsigned mode) | ||
| 905 | { | ||
| 906 | if (!test_bit(bit, word)) | ||
| 907 | return 0; | ||
| 908 | return out_of_line_wait_on_bit(word, bit, | ||
| 909 | bit_wait_io, | ||
| 910 | mode); | ||
| 911 | } | ||
| 912 | |||
| 913 | /** | ||
| 914 | * wait_on_bit_action - wait for a bit to be cleared | ||
| 915 | * @word: the word being waited on, a kernel virtual address | ||
| 916 | * @bit: the bit of the word being waited on | ||
| 917 | * @action: the function used to sleep, which may take special actions | ||
| 918 | * @mode: the task state to sleep in | ||
| 919 | * | ||
| 920 | * Use the standard hashed waitqueue table to wait for a bit | ||
| 921 | * to be cleared, and allow the waiting action to be specified. | ||
| 922 | * This is like wait_on_bit() but allows fine control of how the waiting | ||
| 923 | * is done. | ||
| 924 | * | ||
| 925 | * Returned value will be zero if the bit was cleared, or non-zero | ||
| 926 | * if the process received a signal and the mode permitted wakeup | ||
| 927 | * on that signal. | ||
| 870 | */ | 928 | */ |
| 871 | static inline int | 929 | static inline int |
| 872 | wait_on_bit(void *word, int bit, int (*action)(void *), unsigned mode) | 930 | wait_on_bit_action(void *word, int bit, wait_bit_action_f *action, unsigned mode) |
| 873 | { | 931 | { |
| 874 | if (!test_bit(bit, word)) | 932 | if (!test_bit(bit, word)) |
| 875 | return 0; | 933 | return 0; |
| @@ -880,7 +938,6 @@ wait_on_bit(void *word, int bit, int (*action)(void *), unsigned mode) | |||
| 880 | * wait_on_bit_lock - wait for a bit to be cleared, when wanting to set it | 938 | * wait_on_bit_lock - wait for a bit to be cleared, when wanting to set it |
| 881 | * @word: the word being waited on, a kernel virtual address | 939 | * @word: the word being waited on, a kernel virtual address |
| 882 | * @bit: the bit of the word being waited on | 940 | * @bit: the bit of the word being waited on |
| 883 | * @action: the function used to sleep, which may take special actions | ||
| 884 | * @mode: the task state to sleep in | 941 | * @mode: the task state to sleep in |
| 885 | * | 942 | * |
| 886 | * There is a standard hashed waitqueue table for generic use. This | 943 | * There is a standard hashed waitqueue table for generic use. This |
| @@ -891,9 +948,61 @@ wait_on_bit(void *word, int bit, int (*action)(void *), unsigned mode) | |||
| 891 | * wait_on_bit() in threads waiting to be able to set the bit. | 948 | * wait_on_bit() in threads waiting to be able to set the bit. |
| 892 | * One uses wait_on_bit_lock() where one is waiting for the bit to | 949 | * One uses wait_on_bit_lock() where one is waiting for the bit to |
| 893 | * clear with the intention of setting it, and when done, clearing it. | 950 | * clear with the intention of setting it, and when done, clearing it. |
| 951 | * | ||
| 952 | * Returns zero if the bit was (eventually) found to be clear and was | ||
| 953 | * set. Returns non-zero if a signal was delivered to the process and | ||
| 954 | * the @mode allows that signal to wake the process. | ||
| 955 | */ | ||
| 956 | static inline int | ||
| 957 | wait_on_bit_lock(void *word, int bit, unsigned mode) | ||
| 958 | { | ||
| 959 | if (!test_and_set_bit(bit, word)) | ||
| 960 | return 0; | ||
| 961 | return out_of_line_wait_on_bit_lock(word, bit, bit_wait, mode); | ||
| 962 | } | ||
| 963 | |||
| 964 | /** | ||
| 965 | * wait_on_bit_lock_io - wait for a bit to be cleared, when wanting to set it | ||
| 966 | * @word: the word being waited on, a kernel virtual address | ||
| 967 | * @bit: the bit of the word being waited on | ||
| 968 | * @mode: the task state to sleep in | ||
| 969 | * | ||
| 970 | * Use the standard hashed waitqueue table to wait for a bit | ||
| 971 | * to be cleared and then to atomically set it. This is similar | ||
| 972 | * to wait_on_bit(), but calls io_schedule() instead of schedule() | ||
| 973 | * for the actual waiting. | ||
| 974 | * | ||
| 975 | * Returns zero if the bit was (eventually) found to be clear and was | ||
| 976 | * set. Returns non-zero if a signal was delivered to the process and | ||
| 977 | * the @mode allows that signal to wake the process. | ||
| 978 | */ | ||
| 979 | static inline int | ||
| 980 | wait_on_bit_lock_io(void *word, int bit, unsigned mode) | ||
| 981 | { | ||
| 982 | if (!test_and_set_bit(bit, word)) | ||
| 983 | return 0; | ||
| 984 | return out_of_line_wait_on_bit_lock(word, bit, bit_wait_io, mode); | ||
| 985 | } | ||
| 986 | |||
| 987 | /** | ||
| 988 | * wait_on_bit_lock_action - wait for a bit to be cleared, when wanting to set it | ||
| 989 | * @word: the word being waited on, a kernel virtual address | ||
| 990 | * @bit: the bit of the word being waited on | ||
| 991 | * @action: the function used to sleep, which may take special actions | ||
| 992 | * @mode: the task state to sleep in | ||
| 993 | * | ||
| 994 | * Use the standard hashed waitqueue table to wait for a bit | ||
| 995 | * to be cleared and then to set it, and allow the waiting action | ||
| 996 | * to be specified. | ||
| 997 | * This is like wait_on_bit() but allows fine control of how the waiting | ||
| 998 | * is done. | ||
| 999 | * | ||
| 1000 | * Returns zero if the bit was (eventually) found to be clear and was | ||
| 1001 | * set. Returns non-zero if a signal was delivered to the process and | ||
| 1002 | * the @mode allows that signal to wake the process. | ||
| 894 | */ | 1003 | */ |
| 895 | static inline int | 1004 | static inline int |
| 896 | wait_on_bit_lock(void *word, int bit, int (*action)(void *), unsigned mode) | 1005 | wait_on_bit_lock_action(void *word, int bit, wait_bit_action_f *action, unsigned mode) |
| 897 | { | 1006 | { |
| 898 | if (!test_and_set_bit(bit, word)) | 1007 | if (!test_and_set_bit(bit, word)) |
| 899 | return 0; | 1008 | return 0; |
diff --git a/include/linux/writeback.h b/include/linux/writeback.h index 5777c13849ba..a219be961c0a 100644 --- a/include/linux/writeback.h +++ b/include/linux/writeback.h | |||
| @@ -90,7 +90,6 @@ struct writeback_control { | |||
| 90 | * fs/fs-writeback.c | 90 | * fs/fs-writeback.c |
| 91 | */ | 91 | */ |
| 92 | struct bdi_writeback; | 92 | struct bdi_writeback; |
| 93 | int inode_wait(void *); | ||
| 94 | void writeback_inodes_sb(struct super_block *, enum wb_reason reason); | 93 | void writeback_inodes_sb(struct super_block *, enum wb_reason reason); |
| 95 | void writeback_inodes_sb_nr(struct super_block *, unsigned long nr, | 94 | void writeback_inodes_sb_nr(struct super_block *, unsigned long nr, |
| 96 | enum wb_reason reason); | 95 | enum wb_reason reason); |
| @@ -105,7 +104,7 @@ void inode_wait_for_writeback(struct inode *inode); | |||
| 105 | static inline void wait_on_inode(struct inode *inode) | 104 | static inline void wait_on_inode(struct inode *inode) |
| 106 | { | 105 | { |
| 107 | might_sleep(); | 106 | might_sleep(); |
| 108 | wait_on_bit(&inode->i_state, __I_NEW, inode_wait, TASK_UNINTERRUPTIBLE); | 107 | wait_on_bit(&inode->i_state, __I_NEW, TASK_UNINTERRUPTIBLE); |
| 109 | } | 108 | } |
| 110 | 109 | ||
| 111 | /* | 110 | /* |
