summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/acpi/acbuffer.h2
-rw-r--r--include/acpi/acconfig.h27
-rw-r--r--include/acpi/acexcep.h2
-rw-r--r--include/acpi/acnames.h2
-rw-r--r--include/acpi/acoutput.h159
-rw-r--r--include/acpi/acpi.h2
-rw-r--r--include/acpi/acpi_bus.h100
-rw-r--r--include/acpi/acpiosxf.h13
-rw-r--r--include/acpi/acpixf.h68
-rw-r--r--include/acpi/acrestyp.h17
-rw-r--r--include/acpi/actbl.h9
-rw-r--r--include/acpi/actbl1.h8
-rw-r--r--include/acpi/actbl2.h25
-rw-r--r--include/acpi/actbl3.h34
-rw-r--r--include/acpi/actypes.h38
-rw-r--r--include/acpi/container.h12
-rw-r--r--include/acpi/platform/acenv.h319
-rw-r--r--include/acpi/platform/acgcc.h6
-rw-r--r--include/acpi/platform/aclinux.h3
-rw-r--r--include/asm-generic/cputime.h66
-rw-r--r--include/asm-generic/cputime_jiffies.h72
-rw-r--r--include/asm-generic/cputime_nsecs.h104
-rw-r--r--include/asm-generic/io.h20
-rw-r--r--include/asm-generic/pgtable.h10
-rw-r--r--include/asm-generic/vmlinux.lds.h32
-rw-r--r--include/clocksource/arm_arch_timer.h63
-rw-r--r--include/clocksource/arm_generic.h21
-rw-r--r--include/linux/acpi.h25
-rw-r--r--include/linux/aer.h4
-rw-r--r--include/linux/amba/sp810.h64
-rw-r--r--include/linux/async.h10
-rw-r--r--include/linux/backing-dev.h6
-rw-r--r--include/linux/bcm2835_timer.h22
-rw-r--r--include/linux/bcma/bcma_driver_chipcommon.h4
-rw-r--r--include/linux/bcma/bcma_driver_mips.h11
-rw-r--r--include/linux/bcma/bcma_driver_pci.h2
-rw-r--r--include/linux/bma150.h16
-rw-r--r--include/linux/bug.h47
-rw-r--r--include/linux/can/dev.h11
-rw-r--r--include/linux/can/led.h51
-rw-r--r--include/linux/can/skb.h45
-rw-r--r--include/linux/cgroup.h3
-rw-r--r--include/linux/clk-provider.h6
-rw-r--r--include/linux/clk/sunxi.h22
-rw-r--r--include/linux/clk/tegra.h127
-rw-r--r--include/linux/clockchips.h9
-rw-r--r--include/linux/clocksource.h11
-rw-r--r--include/linux/compiler-gcc.h3
-rw-r--r--include/linux/compiler-gcc3.h8
-rw-r--r--include/linux/compiler-gcc4.h36
-rw-r--r--include/linux/compiler.h32
-rw-r--r--include/linux/console.h5
-rw-r--r--include/linux/context_tracking.h28
-rw-r--r--include/linux/cpufreq.h34
-rw-r--r--include/linux/cpuidle.h22
-rw-r--r--include/linux/cyclomx.h77
-rw-r--r--include/linux/cycx_drv.h64
-rw-r--r--include/linux/debugfs.h2
-rw-r--r--include/linux/device.h12
-rw-r--r--include/linux/dma-buf.h2
-rw-r--r--include/linux/dw_apb_timer.h2
-rw-r--r--include/linux/dynamic_debug.h11
-rw-r--r--include/linux/efi.h27
-rw-r--r--include/linux/elevator.h5
-rw-r--r--include/linux/etherdevice.h4
-rw-r--r--include/linux/extcon/extcon-gpio.h (renamed from include/linux/extcon/extcon_gpio.h)0
-rw-r--r--include/linux/freezer.h5
-rw-r--r--include/linux/fs.h2
-rw-r--r--include/linux/ftrace.h6
-rw-r--r--include/linux/ftrace_event.h6
-rw-r--r--include/linux/hardirq.h8
-rw-r--r--include/linux/hid-sensor-hub.h38
-rw-r--r--include/linux/hid-sensor-ids.h9
-rw-r--r--include/linux/hid.h17
-rw-r--r--include/linux/hwmon.h12
-rw-r--r--include/linux/hyperv.h248
-rw-r--r--include/linux/ieee80211.h155
-rw-r--r--include/linux/if_macvlan.h6
-rw-r--r--include/linux/if_team.h1
-rw-r--r--include/linux/iio/buffer.h13
-rw-r--r--include/linux/iio/common/st_sensors.h280
-rw-r--r--include/linux/iio/common/st_sensors_i2c.h20
-rw-r--r--include/linux/iio/common/st_sensors_spi.h20
-rw-r--r--include/linux/iio/consumer.h14
-rw-r--r--include/linux/iio/driver.h9
-rw-r--r--include/linux/iio/gyro/itg3200.h154
-rw-r--r--include/linux/iio/trigger.h5
-rw-r--r--include/linux/in6.h13
-rw-r--r--include/linux/inetdevice.h6
-rw-r--r--include/linux/init.h1
-rw-r--r--include/linux/init_task.h12
-rw-r--r--include/linux/input/adxl34x.h2
-rw-r--r--include/linux/input/tegra_kbc.h62
-rw-r--r--include/linux/ipv6.h10
-rw-r--r--include/linux/irq.h8
-rw-r--r--include/linux/irq_work.h22
-rw-r--r--include/linux/irqchip.h16
-rw-r--r--include/linux/irqchip/arm-gic.h79
-rw-r--r--include/linux/irqchip/arm-vic.h36
-rw-r--r--include/linux/kernel_stat.h2
-rw-r--r--include/linux/kgdb.h1
-rw-r--r--include/linux/kprobes.h12
-rw-r--r--include/linux/kvm_host.h55
-rw-r--r--include/linux/libps2.h2
-rw-r--r--include/linux/llist.h25
-rw-r--r--include/linux/lockdep.h4
-rw-r--r--include/linux/mailbox.h17
-rw-r--r--include/linux/memcontrol.h2
-rw-r--r--include/linux/mfd/abx500.h17
-rw-r--r--include/linux/mfd/abx500/ab8500-bm.h66
-rw-r--r--include/linux/mfd/abx500/ab8500-gpio.h16
-rw-r--r--include/linux/mfd/abx500/ab8500.h279
-rw-r--r--include/linux/mfd/abx500/ux500_chargalg.h5
-rw-r--r--include/linux/mfd/arizona/core.h4
-rw-r--r--include/linux/mfd/arizona/pdata.h30
-rw-r--r--include/linux/mfd/arizona/registers.h56
-rw-r--r--include/linux/mfd/da9052/da9052.h66
-rw-r--r--include/linux/mfd/da9052/reg.h3
-rw-r--r--include/linux/mfd/db8500-prcmu.h20
-rw-r--r--include/linux/mfd/dbx500-prcmu.h127
-rw-r--r--include/linux/mfd/max77693-private.h86
-rw-r--r--include/linux/mfd/max77693.h9
-rw-r--r--include/linux/mfd/max8997-private.h64
-rw-r--r--include/linux/mfd/max8997.h25
-rw-r--r--include/linux/mfd/rtsx_common.h3
-rw-r--r--include/linux/mfd/rtsx_pci.h25
-rw-r--r--include/linux/mfd/samsung/core.h11
-rw-r--r--include/linux/micrel_phy.h9
-rw-r--r--include/linux/mlx4/device.h8
-rw-r--r--include/linux/mmu_notifier.h2
-rw-r--r--include/linux/mroute.h2
-rw-r--r--include/linux/mroute6.h2
-rw-r--r--include/linux/netdev_features.h3
-rw-r--r--include/linux/netdevice.h113
-rw-r--r--include/linux/netfilter/nf_conntrack_sip.h3
-rw-r--r--include/linux/netfilter/nfnetlink.h4
-rw-r--r--include/linux/netpoll.h28
-rw-r--r--include/linux/ntb.h83
-rw-r--r--include/linux/of.h13
-rw-r--r--include/linux/of_gpio.h40
-rw-r--r--include/linux/of_serial.h17
-rw-r--r--include/linux/page-flags.h8
-rw-r--r--include/linux/pagemap.h1
-rw-r--r--include/linux/pci.h7
-rw-r--r--include/linux/pci_ids.h26
-rw-r--r--include/linux/percpu_counter.h2
-rw-r--r--include/linux/perf_event.h20
-rw-r--r--include/linux/phy.h6
-rw-r--r--include/linux/pinctrl/devinfo.h45
-rw-r--r--include/linux/pinctrl/pinconf-generic.h16
-rw-r--r--include/linux/pinctrl/pinctrl.h1
-rw-r--r--include/linux/platform_data/cpsw.h4
-rw-r--r--include/linux/platform_data/dma-coh901318.h72
-rw-r--r--include/linux/platform_data/i2c-s3c2410.h2
-rw-r--r--include/linux/platform_data/invensense_mpu6050.h31
-rw-r--r--include/linux/platform_data/lp855x.h19
-rw-r--r--include/linux/platform_data/lp8755.h71
-rw-r--r--include/linux/platform_data/max6697.h36
-rw-r--r--include/linux/platform_data/microread.h35
-rw-r--r--include/linux/platform_data/mtd-nand-omap2.h4
-rw-r--r--include/linux/platform_data/mtd-onenand-omap2.h3
-rw-r--r--include/linux/platform_data/s3c-hsotg.h2
-rw-r--r--include/linux/platform_data/samsung-usbphy.h27
-rw-r--r--include/linux/platform_data/serial-sccnxp.h (renamed from include/linux/platform_data/sccnxp.h)6
-rw-r--r--include/linux/platform_data/spi-omap2-mcspi.h3
-rw-r--r--include/linux/platform_data/tsl2563.h8
-rw-r--r--include/linux/platform_data/usb-omap.h8
-rw-r--r--include/linux/platform_data/usb3503.h19
-rw-r--r--include/linux/platform_device.h18
-rw-r--r--include/linux/pm.h1
-rw-r--r--include/linux/pm2301_charger.h61
-rw-r--r--include/linux/pm_runtime.h7
-rw-r--r--include/linux/power/bq2415x_charger.h3
-rw-r--r--include/linux/power_supply.h4
-rw-r--r--include/linux/pps_kernel.h17
-rw-r--r--include/linux/printk.h38
-rw-r--r--include/linux/proc_fs.h20
-rw-r--r--include/linux/profile.h13
-rw-r--r--include/linux/pstore.h6
-rw-r--r--include/linux/pxa2xx_ssp.h18
-rw-r--r--include/linux/random.h6
-rw-r--r--include/linux/rcupdate.h15
-rw-r--r--include/linux/regmap.h97
-rw-r--r--include/linux/regulator/driver.h6
-rw-r--r--include/linux/ring_buffer.h1
-rw-r--r--include/linux/rtc.h3
-rw-r--r--include/linux/sched.h188
-rw-r--r--include/linux/sched/rt.h58
-rw-r--r--include/linux/sched/sysctl.h110
-rw-r--r--include/linux/security.h59
-rw-r--r--include/linux/serial_8250.h4
-rw-r--r--include/linux/serial_core.h26
-rw-r--r--include/linux/sh_pfc.h236
-rw-r--r--include/linux/skbuff.h61
-rw-r--r--include/linux/smp.h3
-rw-r--r--include/linux/smpboot.h5
-rw-r--r--include/linux/socket.h4
-rw-r--r--include/linux/spi/pxa2xx_spi.h108
-rw-r--r--include/linux/spi/spi.h49
-rw-r--r--include/linux/spi/spi_gpio.h4
-rw-r--r--include/linux/srcu.h26
-rw-r--r--include/linux/ssb/ssb_driver_gige.h23
-rw-r--r--include/linux/ssb/ssb_driver_mips.h5
-rw-r--r--include/linux/sunrpc/sched.h1
-rw-r--r--include/linux/sunrpc/xprt.h6
-rw-r--r--include/linux/sunserialcore.h4
-rw-r--r--include/linux/sunxi_timer.h2
-rw-r--r--include/linux/suspend.h6
-rw-r--r--include/linux/sysfs.h16
-rw-r--r--include/linux/tcp.h4
-rw-r--r--include/linux/tegra-soc.h22
-rw-r--r--include/linux/tick.h17
-rw-r--r--include/linux/time.h17
-rw-r--r--include/linux/tsacct_kern.h3
-rw-r--r--include/linux/tty.h50
-rw-r--r--include/linux/tty_driver.h1
-rw-r--r--include/linux/tty_flip.h28
-rw-r--r--include/linux/tty_ldisc.h11
-rw-r--r--include/linux/uprobes.h23
-rw-r--r--include/linux/usb.h2
-rw-r--r--include/linux/usb/composite.h75
-rw-r--r--include/linux/usb/dwc3-omap.h30
-rw-r--r--include/linux/usb/gadget.h13
-rw-r--r--include/linux/usb/hcd.h3
-rw-r--r--include/linux/usb/musb.h2
-rw-r--r--include/linux/usb/omap_control_usb.h92
-rw-r--r--include/linux/usb/omap_usb.h27
-rw-r--r--include/linux/usb/phy.h43
-rw-r--r--include/linux/usb/samsung_usb_phy.h16
-rw-r--r--include/linux/usb/tegra_usb_phy.h16
-rw-r--r--include/linux/usb/usbnet.h3
-rw-r--r--include/linux/vmw_vmci_api.h82
-rw-r--r--include/linux/vmw_vmci_defs.h880
-rw-r--r--include/linux/vtime.h59
-rw-r--r--include/linux/wanrouter.h127
-rw-r--r--include/linux/wl12xx.h16
-rw-r--r--include/linux/workqueue.h35
-rw-r--r--include/net/act_api.h27
-rw-r--r--include/net/addrconf.h63
-rw-r--r--include/net/bluetooth/a2mp.h4
-rw-r--r--include/net/bluetooth/bluetooth.h23
-rw-r--r--include/net/bluetooth/hci.h18
-rw-r--r--include/net/bluetooth/hci_core.h5
-rw-r--r--include/net/bluetooth/l2cap.h1
-rw-r--r--include/net/cfg80211.h480
-rw-r--r--include/net/dn_route.h2
-rw-r--r--include/net/dsfield.h6
-rw-r--r--include/net/dst.h9
-rw-r--r--include/net/gro_cells.h4
-rw-r--r--include/net/inet6_hashtables.h5
-rw-r--r--include/net/inet_frag.h84
-rw-r--r--include/net/inet_hashtables.h13
-rw-r--r--include/net/ip.h2
-rw-r--r--include/net/ip6_checksum.h62
-rw-r--r--include/net/ip6_fib.h41
-rw-r--r--include/net/ip6_route.h9
-rw-r--r--include/net/ipv6.h140
-rw-r--r--include/net/irda/irlmp.h2
-rw-r--r--include/net/irda/irttp.h2
-rw-r--r--include/net/mac80211.h313
-rw-r--r--include/net/mrp.h143
-rw-r--r--include/net/ndisc.h32
-rw-r--r--include/net/neighbour.h3
-rw-r--r--include/net/netevent.h3
-rw-r--r--include/net/netfilter/nf_conntrack_acct.h6
-rw-r--r--include/net/netfilter/nf_conntrack_core.h17
-rw-r--r--include/net/netfilter/nf_conntrack_ecache.h19
-rw-r--r--include/net/netfilter/nf_conntrack_expect.h7
-rw-r--r--include/net/netfilter/nf_conntrack_extend.h4
-rw-r--r--include/net/netfilter/nf_conntrack_helper.h11
-rw-r--r--include/net/netfilter/nf_conntrack_l3proto.h11
-rw-r--r--include/net/netfilter/nf_conntrack_l4proto.h10
-rw-r--r--include/net/netfilter/nf_conntrack_labels.h58
-rw-r--r--include/net/netfilter/nf_conntrack_timeout.h8
-rw-r--r--include/net/netfilter/nf_conntrack_timestamp.h21
-rw-r--r--include/net/netfilter/nf_tproxy_core.h2
-rw-r--r--include/net/netns/conntrack.h4
-rw-r--r--include/net/netns/ipv4.h3
-rw-r--r--include/net/netns/ipv6.h1
-rw-r--r--include/net/nfc/hci.h22
-rw-r--r--include/net/nfc/nci_core.h1
-rw-r--r--include/net/nfc/nfc.h8
-rw-r--r--include/net/pkt_cls.h7
-rw-r--r--include/net/pkt_sched.h10
-rw-r--r--include/net/regulatory.h4
-rw-r--r--include/net/sch_generic.h21
-rw-r--r--include/net/sctp/constants.h2
-rw-r--r--include/net/sctp/structs.h5
-rw-r--r--include/net/sock.h10
-rw-r--r--include/net/tcp.h10
-rw-r--r--include/net/transp_v6.h22
-rw-r--r--include/net/xfrm.h40
-rw-r--r--include/sound/compress_driver.h8
-rw-r--r--include/sound/core.h12
-rw-r--r--include/sound/cs4271.h15
-rw-r--r--include/sound/da7213.h52
-rwxr-xr-xinclude/sound/max98090.h29
-rw-r--r--include/sound/memalloc.h2
-rw-r--r--include/sound/saif.h16
-rw-r--r--include/sound/sh_fsi.h70
-rw-r--r--include/sound/simple_card.h12
-rw-r--r--include/sound/soc-dai.h8
-rw-r--r--include/sound/soc.h6
-rw-r--r--include/sound/tlv320aic3x.h10
-rw-r--r--include/sound/wm2000.h3
-rw-r--r--include/sound/wm2200.h22
-rw-r--r--include/trace/events/power.h92
-rw-r--r--include/trace/events/ras.h77
-rw-r--r--include/trace/events/rcu.h31
-rw-r--r--include/trace/events/workqueue.h10
-rw-r--r--include/uapi/asm-generic/socket.h5
-rw-r--r--include/uapi/linux/auto_fs.h25
-rw-r--r--include/uapi/linux/can/gw.h2
-rw-r--r--include/uapi/linux/elf.h12
-rw-r--r--include/uapi/linux/fs.h3
-rw-r--r--include/uapi/linux/fuse.h60
-rw-r--r--include/uapi/linux/if_bridge.h11
-rw-r--r--include/uapi/linux/if_ether.h1
-rw-r--r--include/uapi/linux/if_link.h1
-rw-r--r--include/uapi/linux/if_vlan.h1
-rw-r--r--include/uapi/linux/in6.h20
-rw-r--r--include/uapi/linux/ipv6.h2
-rw-r--r--include/uapi/linux/kvm.h17
-rw-r--r--include/uapi/linux/mroute.h3
-rw-r--r--include/uapi/linux/mroute6.h3
-rw-r--r--include/uapi/linux/neighbour.h1
-rw-r--r--include/uapi/linux/netfilter/Kbuild2
-rw-r--r--include/uapi/linux/netfilter/nf_conntrack_common.h1
-rw-r--r--include/uapi/linux/netfilter/nfnetlink_conntrack.h2
-rw-r--r--include/uapi/linux/netfilter/xt_CT.h6
-rw-r--r--include/uapi/linux/netfilter/xt_bpf.h17
-rw-r--r--include/uapi/linux/netfilter/xt_connlabel.h12
-rw-r--r--include/uapi/linux/netfilter/xt_conntrack.h1
-rw-r--r--include/uapi/linux/nfc.h37
-rw-r--r--include/uapi/linux/nl80211.h395
-rw-r--r--include/uapi/linux/perf_event.h3
-rw-r--r--include/uapi/linux/rtnetlink.h1
-rw-r--r--include/uapi/linux/serial_core.h5
-rw-r--r--include/uapi/linux/snmp.h1
-rw-r--r--include/uapi/linux/tcp.h1
-rw-r--r--include/uapi/linux/uhid.h2
-rw-r--r--include/uapi/linux/usb/audio.h6
-rw-r--r--include/uapi/linux/usb/ch9.h6
-rw-r--r--include/uapi/linux/virtio_net.h8
-rw-r--r--include/uapi/linux/vm_sockets.h163
-rw-r--r--include/uapi/linux/wanrouter.h443
-rw-r--r--include/uapi/sound/compress_offload.h31
-rw-r--r--include/video/exynos_mipi_dsim.h1
-rw-r--r--include/video/mmp_disp.h352
-rw-r--r--include/video/samsung_fimd.h205
350 files changed, 9141 insertions, 3317 deletions
diff --git a/include/acpi/acbuffer.h b/include/acpi/acbuffer.h
index a1e45cdd729a..c927a0b1de78 100644
--- a/include/acpi/acbuffer.h
+++ b/include/acpi/acbuffer.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/include/acpi/acconfig.h b/include/acpi/acconfig.h
index 0943457e0fa5..14ceff788c40 100644
--- a/include/acpi/acconfig.h
+++ b/include/acpi/acconfig.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -138,7 +138,7 @@
138 138
139/* Maximum sleep allowed via Sleep() operator */ 139/* Maximum sleep allowed via Sleep() operator */
140 140
141#define ACPI_MAX_SLEEP 2000 /* Two seconds */ 141#define ACPI_MAX_SLEEP 2000 /* 2000 millisec == two seconds */
142 142
143/* Address Range lists are per-space_id (Memory and I/O only) */ 143/* Address Range lists are per-space_id (Memory and I/O only) */
144 144
@@ -150,11 +150,6 @@
150 * 150 *
151 *****************************************************************************/ 151 *****************************************************************************/
152 152
153/* Number of distinct GPE register blocks and register width */
154
155#define ACPI_MAX_GPE_BLOCKS 2
156#define ACPI_GPE_REGISTER_WIDTH 8
157
158/* Method info (in WALK_STATE), containing local variables and argumetns */ 153/* Method info (in WALK_STATE), containing local variables and argumetns */
159 154
160#define ACPI_METHOD_NUM_LOCALS 8 155#define ACPI_METHOD_NUM_LOCALS 8
@@ -163,12 +158,6 @@
163#define ACPI_METHOD_NUM_ARGS 7 158#define ACPI_METHOD_NUM_ARGS 7
164#define ACPI_METHOD_MAX_ARG 6 159#define ACPI_METHOD_MAX_ARG 6
165 160
166/* Length of _HID, _UID, _CID, and UUID values */
167
168#define ACPI_DEVICE_ID_LENGTH 0x09
169#define ACPI_MAX_CID_LENGTH 48
170#define ACPI_UUID_LENGTH 16
171
172/* 161/*
173 * Operand Stack (in WALK_STATE), Must be large enough to contain METHOD_MAX_ARG 162 * Operand Stack (in WALK_STATE), Must be large enough to contain METHOD_MAX_ARG
174 */ 163 */
@@ -186,17 +175,6 @@
186 */ 175 */
187#define ACPI_RESULTS_OBJ_NUM_MAX 255 176#define ACPI_RESULTS_OBJ_NUM_MAX 255
188 177
189/* Names within the namespace are 4 bytes long */
190
191#define ACPI_NAME_SIZE 4
192#define ACPI_PATH_SEGMENT_LENGTH 5 /* 4 chars for name + 1 char for separator */
193#define ACPI_PATH_SEPARATOR '.'
194
195/* Sizes for ACPI table headers */
196
197#define ACPI_OEM_ID_SIZE 6
198#define ACPI_OEM_TABLE_ID_SIZE 8
199
200/* Constants used in searching for the RSDP in low memory */ 178/* Constants used in searching for the RSDP in low memory */
201 179
202#define ACPI_EBDA_PTR_LOCATION 0x0000040E /* Physical Address */ 180#define ACPI_EBDA_PTR_LOCATION 0x0000040E /* Physical Address */
@@ -213,6 +191,7 @@
213/* Maximum space_ids for Operation Regions */ 191/* Maximum space_ids for Operation Regions */
214 192
215#define ACPI_MAX_ADDRESS_SPACE 255 193#define ACPI_MAX_ADDRESS_SPACE 255
194#define ACPI_NUM_DEFAULT_SPACES 4
216 195
217/* Array sizes. Used for range checking also */ 196/* Array sizes. Used for range checking also */
218 197
diff --git a/include/acpi/acexcep.h b/include/acpi/acexcep.h
index 6c3890e02140..9bf59d0e8aaa 100644
--- a/include/acpi/acexcep.h
+++ b/include/acpi/acexcep.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/include/acpi/acnames.h b/include/acpi/acnames.h
index 7665df663284..ce08ef7d969c 100644
--- a/include/acpi/acnames.h
+++ b/include/acpi/acnames.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/include/acpi/acoutput.h b/include/acpi/acoutput.h
index 2457ac849655..9885276178e0 100644
--- a/include/acpi/acoutput.h
+++ b/include/acpi/acoutput.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -72,6 +72,7 @@
72#define ACPI_EXAMPLE 0x00004000 72#define ACPI_EXAMPLE 0x00004000
73#define ACPI_DRIVER 0x00008000 73#define ACPI_DRIVER 0x00008000
74#define DT_COMPILER 0x00010000 74#define DT_COMPILER 0x00010000
75#define ASL_PREPROCESSOR 0x00020000
75 76
76#define ACPI_ALL_COMPONENTS 0x0001FFFF 77#define ACPI_ALL_COMPONENTS 0x0001FFFF
77#define ACPI_COMPONENT_DEFAULT (ACPI_ALL_COMPONENTS) 78#define ACPI_COMPONENT_DEFAULT (ACPI_ALL_COMPONENTS)
@@ -262,18 +263,140 @@
262 * Common parameters used for debug output functions: 263 * Common parameters used for debug output functions:
263 * line number, function name, module(file) name, component ID 264 * line number, function name, module(file) name, component ID
264 */ 265 */
265#define ACPI_DEBUG_PARAMETERS __LINE__, ACPI_GET_FUNCTION_NAME, _acpi_module_name, _COMPONENT 266#define ACPI_DEBUG_PARAMETERS \
267 __LINE__, ACPI_GET_FUNCTION_NAME, _acpi_module_name, _COMPONENT
268
269/* Check if debug output is currently dynamically enabled */
270
271#define ACPI_IS_DEBUG_ENABLED(level, component) \
272 ((level & acpi_dbg_level) && (component & acpi_dbg_layer))
266 273
267/* 274/*
268 * Master debug print macros 275 * Master debug print macros
269 * Print message if and only if: 276 * Print message if and only if:
270 * 1) Debug print for the current component is enabled 277 * 1) Debug print for the current component is enabled
271 * 2) Debug error level or trace level for the print statement is enabled 278 * 2) Debug error level or trace level for the print statement is enabled
279 *
280 * November 2012: Moved the runtime check for whether to actually emit the
281 * debug message outside of the print function itself. This improves overall
282 * performance at a relatively small code cost. Implementation involves the
283 * use of variadic macros supported by C99.
284 *
285 * Note: the ACPI_DO_WHILE0 macro is used to prevent some compilers from
286 * complaining about these constructs. On other compilers the do...while
287 * adds some extra code, so this feature is optional.
272 */ 288 */
273#define ACPI_DEBUG_PRINT(plist) acpi_debug_print plist 289#ifdef ACPI_USE_DO_WHILE_0
274#define ACPI_DEBUG_PRINT_RAW(plist) acpi_debug_print_raw plist 290#define ACPI_DO_WHILE0(a) do a while(0)
275
276#else 291#else
292#define ACPI_DO_WHILE0(a) a
293#endif
294
295/* DEBUG_PRINT functions */
296
297#define ACPI_DEBUG_PRINT(plist) ACPI_ACTUAL_DEBUG plist
298#define ACPI_DEBUG_PRINT_RAW(plist) ACPI_ACTUAL_DEBUG_RAW plist
299
300/* Helper macros for DEBUG_PRINT */
301
302#define ACPI_DO_DEBUG_PRINT(function, level, line, filename, modulename, component, ...) \
303 ACPI_DO_WHILE0 ({ \
304 if (ACPI_IS_DEBUG_ENABLED (level, component)) \
305 { \
306 function (level, line, filename, modulename, component, __VA_ARGS__); \
307 } \
308 })
309
310#define ACPI_ACTUAL_DEBUG(level, line, filename, modulename, component, ...) \
311 ACPI_DO_DEBUG_PRINT (acpi_debug_print, level, line, \
312 filename, modulename, component, __VA_ARGS__)
313
314#define ACPI_ACTUAL_DEBUG_RAW(level, line, filename, modulename, component, ...) \
315 ACPI_DO_DEBUG_PRINT (acpi_debug_print_raw, level, line, \
316 filename, modulename, component, __VA_ARGS__)
317
318/*
319 * Function entry tracing
320 *
321 * The name of the function is emitted as a local variable that is
322 * intended to be used by both the entry trace and the exit trace.
323 */
324
325/* Helper macro */
326
327#define ACPI_TRACE_ENTRY(name, function, cast, param) \
328 ACPI_FUNCTION_NAME (name) \
329 function (ACPI_DEBUG_PARAMETERS, cast (param))
330
331/* The actual entry trace macros */
332
333#define ACPI_FUNCTION_TRACE(name) \
334 ACPI_FUNCTION_NAME(name) \
335 acpi_ut_trace (ACPI_DEBUG_PARAMETERS)
336
337#define ACPI_FUNCTION_TRACE_PTR(name, pointer) \
338 ACPI_TRACE_ENTRY (name, acpi_ut_trace_ptr, (void *), pointer)
339
340#define ACPI_FUNCTION_TRACE_U32(name, value) \
341 ACPI_TRACE_ENTRY (name, acpi_ut_trace_u32, (u32), value)
342
343#define ACPI_FUNCTION_TRACE_STR(name, string) \
344 ACPI_TRACE_ENTRY (name, acpi_ut_trace_str, (char *), string)
345
346#define ACPI_FUNCTION_ENTRY() \
347 acpi_ut_track_stack_ptr()
348
349/*
350 * Function exit tracing
351 *
352 * These macros include a return statement. This is usually considered
353 * bad form, but having a separate exit macro before the actual return
354 * is very ugly and difficult to maintain.
355 *
356 * One of the FUNCTION_TRACE macros above must be used in conjunction
357 * with these macros so that "_AcpiFunctionName" is defined.
358 */
359
360/* Exit trace helper macro */
361
362#define ACPI_TRACE_EXIT(function, cast, param) \
363 ACPI_DO_WHILE0 ({ \
364 function (ACPI_DEBUG_PARAMETERS, cast (param)); \
365 return ((param)); \
366 })
367
368/* The actual exit macros */
369
370#define return_VOID \
371 ACPI_DO_WHILE0 ({ \
372 acpi_ut_exit (ACPI_DEBUG_PARAMETERS); \
373 return; \
374 })
375
376#define return_ACPI_STATUS(status) \
377 ACPI_TRACE_EXIT (acpi_ut_status_exit, (acpi_status), status)
378
379#define return_PTR(pointer) \
380 ACPI_TRACE_EXIT (acpi_ut_ptr_exit, (u8 *), pointer)
381
382#define return_VALUE(value) \
383 ACPI_TRACE_EXIT (acpi_ut_value_exit, (u64), value)
384
385/* Conditional execution */
386
387#define ACPI_DEBUG_EXEC(a) a
388#define ACPI_DEBUG_ONLY_MEMBERS(a) a;
389#define _VERBOSE_STRUCTURES
390
391/* Various object display routines for debug */
392
393#define ACPI_DUMP_STACK_ENTRY(a) acpi_ex_dump_operand((a), 0)
394#define ACPI_DUMP_OPERANDS(a, b ,c) acpi_ex_dump_operands(a, b, c)
395#define ACPI_DUMP_ENTRY(a, b) acpi_ns_dump_entry (a, b)
396#define ACPI_DUMP_PATHNAME(a, b, c, d) acpi_ns_dump_pathname(a, b, c, d)
397#define ACPI_DUMP_BUFFER(a, b) acpi_ut_debug_dump_buffer((u8 *) a, b, DB_BYTE_DISPLAY, _COMPONENT)
398
399#else /* ACPI_DEBUG_OUTPUT */
277/* 400/*
278 * This is the non-debug case -- make everything go away, 401 * This is the non-debug case -- make everything go away,
279 * leaving no executable debug code! 402 * leaving no executable debug code!
@@ -281,6 +404,32 @@
281#define ACPI_FUNCTION_NAME(a) 404#define ACPI_FUNCTION_NAME(a)
282#define ACPI_DEBUG_PRINT(pl) 405#define ACPI_DEBUG_PRINT(pl)
283#define ACPI_DEBUG_PRINT_RAW(pl) 406#define ACPI_DEBUG_PRINT_RAW(pl)
407#define ACPI_DEBUG_EXEC(a)
408#define ACPI_DEBUG_ONLY_MEMBERS(a)
409#define ACPI_FUNCTION_TRACE(a)
410#define ACPI_FUNCTION_TRACE_PTR(a, b)
411#define ACPI_FUNCTION_TRACE_U32(a, b)
412#define ACPI_FUNCTION_TRACE_STR(a, b)
413#define ACPI_FUNCTION_EXIT
414#define ACPI_FUNCTION_STATUS_EXIT(s)
415#define ACPI_FUNCTION_VALUE_EXIT(s)
416#define ACPI_FUNCTION_ENTRY()
417#define ACPI_DUMP_STACK_ENTRY(a)
418#define ACPI_DUMP_OPERANDS(a, b, c)
419#define ACPI_DUMP_ENTRY(a, b)
420#define ACPI_DUMP_TABLES(a, b)
421#define ACPI_DUMP_PATHNAME(a, b, c, d)
422#define ACPI_DUMP_BUFFER(a, b)
423#define ACPI_DEBUG_PRINT(pl)
424#define ACPI_DEBUG_PRINT_RAW(pl)
425#define ACPI_IS_DEBUG_ENABLED(level, component) 0
426
427/* Return macros must have a return statement at the minimum */
428
429#define return_VOID return
430#define return_ACPI_STATUS(s) return(s)
431#define return_VALUE(s) return(s)
432#define return_PTR(s) return(s)
284 433
285#endif /* ACPI_DEBUG_OUTPUT */ 434#endif /* ACPI_DEBUG_OUTPUT */
286 435
diff --git a/include/acpi/acpi.h b/include/acpi/acpi.h
index c1ea8436961f..618787715d56 100644
--- a/include/acpi/acpi.h
+++ b/include/acpi/acpi.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index 7ced5dc20dd3..227ba7dc293d 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -84,28 +84,29 @@ struct acpi_driver;
84struct acpi_device; 84struct acpi_device;
85 85
86/* 86/*
87 * ACPI Scan Handler
88 * -----------------
89 */
90
91struct acpi_scan_handler {
92 const struct acpi_device_id *ids;
93 struct list_head list_node;
94 int (*attach)(struct acpi_device *dev, const struct acpi_device_id *id);
95 void (*detach)(struct acpi_device *dev);
96};
97
98/*
87 * ACPI Driver 99 * ACPI Driver
88 * ----------- 100 * -----------
89 */ 101 */
90 102
91typedef int (*acpi_op_add) (struct acpi_device * device); 103typedef int (*acpi_op_add) (struct acpi_device * device);
92typedef int (*acpi_op_remove) (struct acpi_device * device, int type); 104typedef int (*acpi_op_remove) (struct acpi_device * device);
93typedef int (*acpi_op_start) (struct acpi_device * device);
94typedef int (*acpi_op_bind) (struct acpi_device * device);
95typedef int (*acpi_op_unbind) (struct acpi_device * device);
96typedef void (*acpi_op_notify) (struct acpi_device * device, u32 event); 105typedef void (*acpi_op_notify) (struct acpi_device * device, u32 event);
97 106
98struct acpi_bus_ops {
99 u32 acpi_op_add:1;
100 u32 acpi_op_start:1;
101};
102
103struct acpi_device_ops { 107struct acpi_device_ops {
104 acpi_op_add add; 108 acpi_op_add add;
105 acpi_op_remove remove; 109 acpi_op_remove remove;
106 acpi_op_start start;
107 acpi_op_bind bind;
108 acpi_op_unbind unbind;
109 acpi_op_notify notify; 110 acpi_op_notify notify;
110}; 111};
111 112
@@ -148,7 +149,8 @@ struct acpi_device_flags {
148 u32 power_manageable:1; 149 u32 power_manageable:1;
149 u32 performance_manageable:1; 150 u32 performance_manageable:1;
150 u32 eject_pending:1; 151 u32 eject_pending:1;
151 u32 reserved:24; 152 u32 match_driver:1;
153 u32 reserved:23;
152}; 154};
153 155
154/* File System */ 156/* File System */
@@ -207,7 +209,7 @@ struct acpi_device_power_state {
207 } flags; 209 } flags;
208 int power; /* % Power (compared to D0) */ 210 int power; /* % Power (compared to D0) */
209 int latency; /* Dx->D0 time (microseconds) */ 211 int latency; /* Dx->D0 time (microseconds) */
210 struct acpi_handle_list resources; /* Power resources referenced */ 212 struct list_head resources; /* Power resources referenced */
211}; 213};
212 214
213struct acpi_device_power { 215struct acpi_device_power {
@@ -250,7 +252,7 @@ struct acpi_device_wakeup {
250 acpi_handle gpe_device; 252 acpi_handle gpe_device;
251 u64 gpe_number; 253 u64 gpe_number;
252 u64 sleep_state; 254 u64 sleep_state;
253 struct acpi_handle_list resources; 255 struct list_head resources;
254 struct acpi_device_wakeup_flags flags; 256 struct acpi_device_wakeup_flags flags;
255 int prepare_count; 257 int prepare_count;
256}; 258};
@@ -279,16 +281,17 @@ struct acpi_device {
279 struct acpi_device_wakeup wakeup; 281 struct acpi_device_wakeup wakeup;
280 struct acpi_device_perf performance; 282 struct acpi_device_perf performance;
281 struct acpi_device_dir dir; 283 struct acpi_device_dir dir;
282 struct acpi_device_ops ops; 284 struct acpi_scan_handler *handler;
283 struct acpi_driver *driver; 285 struct acpi_driver *driver;
284 void *driver_data; 286 void *driver_data;
285 struct device dev; 287 struct device dev;
286 struct acpi_bus_ops bus_ops; /* workaround for different code path for hotplug */
287 enum acpi_bus_removal_type removal_type; /* indicate for different removal type */ 288 enum acpi_bus_removal_type removal_type; /* indicate for different removal type */
288 u8 physical_node_count; 289 u8 physical_node_count;
289 struct list_head physical_node_list; 290 struct list_head physical_node_list;
290 struct mutex physical_node_lock; 291 struct mutex physical_node_lock;
291 DECLARE_BITMAP(physical_node_id_bitmap, ACPI_MAX_PHYSICAL_NODE); 292 DECLARE_BITMAP(physical_node_id_bitmap, ACPI_MAX_PHYSICAL_NODE);
293 struct list_head power_dependent;
294 void (*remove)(struct acpi_device *);
292}; 295};
293 296
294static inline void *acpi_driver_data(struct acpi_device *d) 297static inline void *acpi_driver_data(struct acpi_device *d)
@@ -316,7 +319,7 @@ struct acpi_bus_event {
316}; 319};
317 320
318struct acpi_eject_event { 321struct acpi_eject_event {
319 acpi_handle handle; 322 struct acpi_device *device;
320 u32 event; 323 u32 event;
321}; 324};
322 325
@@ -339,13 +342,51 @@ void acpi_bus_data_handler(acpi_handle handle, void *context);
339acpi_status acpi_bus_get_status_handle(acpi_handle handle, 342acpi_status acpi_bus_get_status_handle(acpi_handle handle,
340 unsigned long long *sta); 343 unsigned long long *sta);
341int acpi_bus_get_status(struct acpi_device *device); 344int acpi_bus_get_status(struct acpi_device *device);
345
346#ifdef CONFIG_PM
342int acpi_bus_set_power(acpi_handle handle, int state); 347int acpi_bus_set_power(acpi_handle handle, int state);
348const char *acpi_power_state_string(int state);
349int acpi_device_get_power(struct acpi_device *device, int *state);
343int acpi_device_set_power(struct acpi_device *device, int state); 350int acpi_device_set_power(struct acpi_device *device, int state);
351int acpi_bus_init_power(struct acpi_device *device);
344int acpi_bus_update_power(acpi_handle handle, int *state_p); 352int acpi_bus_update_power(acpi_handle handle, int *state_p);
345bool acpi_bus_power_manageable(acpi_handle handle); 353bool acpi_bus_power_manageable(acpi_handle handle);
346bool acpi_bus_can_wakeup(acpi_handle handle); 354bool acpi_bus_can_wakeup(acpi_handle handle);
347int acpi_power_resource_register_device(struct device *dev, acpi_handle handle); 355#else /* !CONFIG_PM */
348void acpi_power_resource_unregister_device(struct device *dev, acpi_handle handle); 356static inline int acpi_bus_set_power(acpi_handle handle, int state)
357{
358 return 0;
359}
360static inline const char *acpi_power_state_string(int state)
361{
362 return "D0";
363}
364static inline int acpi_device_get_power(struct acpi_device *device, int *state)
365{
366 return 0;
367}
368static inline int acpi_device_set_power(struct acpi_device *device, int state)
369{
370 return 0;
371}
372static inline int acpi_bus_init_power(struct acpi_device *device)
373{
374 return 0;
375}
376static inline int acpi_bus_update_power(acpi_handle handle, int *state_p)
377{
378 return 0;
379}
380static inline bool acpi_bus_power_manageable(acpi_handle handle)
381{
382 return false;
383}
384static inline bool acpi_bus_can_wakeup(acpi_handle handle)
385{
386 return false;
387}
388#endif /* !CONFIG_PM */
389
349#ifdef CONFIG_ACPI_PROC_EVENT 390#ifdef CONFIG_ACPI_PROC_EVENT
350int acpi_bus_generate_proc_event(struct acpi_device *device, u8 type, int data); 391int acpi_bus_generate_proc_event(struct acpi_device *device, u8 type, int data);
351int acpi_bus_generate_proc_event4(const char *class, const char *bid, u8 type, int data); 392int acpi_bus_generate_proc_event4(const char *class, const char *bid, u8 type, int data);
@@ -354,13 +395,15 @@ int acpi_bus_receive_event(struct acpi_bus_event *event);
354static inline int acpi_bus_generate_proc_event(struct acpi_device *device, u8 type, int data) 395static inline int acpi_bus_generate_proc_event(struct acpi_device *device, u8 type, int data)
355 { return 0; } 396 { return 0; }
356#endif 397#endif
398
399void acpi_scan_lock_acquire(void);
400void acpi_scan_lock_release(void);
401int acpi_scan_add_handler(struct acpi_scan_handler *handler);
357int acpi_bus_register_driver(struct acpi_driver *driver); 402int acpi_bus_register_driver(struct acpi_driver *driver);
358void acpi_bus_unregister_driver(struct acpi_driver *driver); 403void acpi_bus_unregister_driver(struct acpi_driver *driver);
359int acpi_bus_add(struct acpi_device **child, struct acpi_device *parent, 404int acpi_bus_scan(acpi_handle handle);
360 acpi_handle handle, int type);
361void acpi_bus_hot_remove_device(void *context); 405void acpi_bus_hot_remove_device(void *context);
362int acpi_bus_trim(struct acpi_device *start, int rmdevice); 406void acpi_bus_trim(struct acpi_device *start);
363int acpi_bus_start(struct acpi_device *device);
364acpi_status acpi_bus_get_ejd(acpi_handle handle, acpi_handle * ejd); 407acpi_status acpi_bus_get_ejd(acpi_handle handle, acpi_handle * ejd);
365int acpi_match_device_ids(struct acpi_device *device, 408int acpi_match_device_ids(struct acpi_device *device,
366 const struct acpi_device_id *ids); 409 const struct acpi_device_id *ids);
@@ -390,6 +433,8 @@ struct acpi_bus_type {
390 int (*find_device) (struct device *, acpi_handle *); 433 int (*find_device) (struct device *, acpi_handle *);
391 /* For bridges, such as PCI root bridge, IDE controller */ 434 /* For bridges, such as PCI root bridge, IDE controller */
392 int (*find_bridge) (struct device *, acpi_handle *); 435 int (*find_bridge) (struct device *, acpi_handle *);
436 void (*setup)(struct device *);
437 void (*cleanup)(struct device *);
393}; 438};
394int register_acpi_bus_type(struct acpi_bus_type *); 439int register_acpi_bus_type(struct acpi_bus_type *);
395int unregister_acpi_bus_type(struct acpi_bus_type *); 440int unregister_acpi_bus_type(struct acpi_bus_type *);
@@ -397,7 +442,6 @@ int unregister_acpi_bus_type(struct acpi_bus_type *);
397struct acpi_pci_root { 442struct acpi_pci_root {
398 struct list_head node; 443 struct list_head node;
399 struct acpi_device * device; 444 struct acpi_device * device;
400 struct acpi_pci_id id;
401 struct pci_bus *bus; 445 struct pci_bus *bus;
402 u16 segment; 446 u16 segment;
403 struct resource secondary; /* downstream bus range */ 447 struct resource secondary; /* downstream bus range */
@@ -425,6 +469,8 @@ acpi_status acpi_remove_pm_notifier(struct acpi_device *adev,
425int acpi_device_power_state(struct device *dev, struct acpi_device *adev, 469int acpi_device_power_state(struct device *dev, struct acpi_device *adev,
426 u32 target_state, int d_max_in, int *d_min_p); 470 u32 target_state, int d_max_in, int *d_min_p);
427int acpi_pm_device_sleep_state(struct device *, int *, int); 471int acpi_pm_device_sleep_state(struct device *, int *, int);
472void acpi_dev_pm_add_dependent(acpi_handle handle, struct device *depdev);
473void acpi_dev_pm_remove_dependent(acpi_handle handle, struct device *depdev);
428#else 474#else
429static inline acpi_status acpi_add_pm_notifier(struct acpi_device *adev, 475static inline acpi_status acpi_add_pm_notifier(struct acpi_device *adev,
430 acpi_notify_handler handler, 476 acpi_notify_handler handler,
@@ -454,6 +500,10 @@ static inline int acpi_pm_device_sleep_state(struct device *d, int *p, int m)
454{ 500{
455 return __acpi_device_power_state(m, p); 501 return __acpi_device_power_state(m, p);
456} 502}
503static inline void acpi_dev_pm_add_dependent(acpi_handle handle,
504 struct device *depdev) {}
505static inline void acpi_dev_pm_remove_dependent(acpi_handle handle,
506 struct device *depdev) {}
457#endif 507#endif
458 508
459#ifdef CONFIG_PM_RUNTIME 509#ifdef CONFIG_PM_RUNTIME
diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h
index 43152742b46f..7d2a9eaab9eb 100644
--- a/include/acpi/acpiosxf.h
+++ b/include/acpi/acpiosxf.h
@@ -7,7 +7,7 @@
7 *****************************************************************************/ 7 *****************************************************************************/
8 8
9/* 9/*
10 * Copyright (C) 2000 - 2012, Intel Corp. 10 * Copyright (C) 2000 - 2013, Intel Corp.
11 * All rights reserved. 11 * All rights reserved.
12 * 12 *
13 * Redistribution and use in source and binary forms, with or without 13 * Redistribution and use in source and binary forms, with or without
@@ -102,10 +102,8 @@ acpi_os_physical_table_override(struct acpi_table_header *existing_table,
102/* 102/*
103 * Spinlock primitives 103 * Spinlock primitives
104 */ 104 */
105
106#ifndef acpi_os_create_lock 105#ifndef acpi_os_create_lock
107acpi_status 106acpi_status acpi_os_create_lock(acpi_spinlock * out_handle);
108acpi_os_create_lock(acpi_spinlock *out_handle);
109#endif 107#endif
110 108
111void acpi_os_delete_lock(acpi_spinlock handle); 109void acpi_os_delete_lock(acpi_spinlock handle);
@@ -148,6 +146,8 @@ void acpi_os_release_mutex(acpi_mutex handle);
148 */ 146 */
149void *acpi_os_allocate(acpi_size size); 147void *acpi_os_allocate(acpi_size size);
150 148
149void acpi_os_free(void *memory);
150
151void __iomem *acpi_os_map_memory(acpi_physical_address where, 151void __iomem *acpi_os_map_memory(acpi_physical_address where,
152 acpi_size length); 152 acpi_size length);
153 153
@@ -180,12 +180,13 @@ acpi_status acpi_os_release_object(acpi_cache_t * cache, void *object);
180 * Interrupt handlers 180 * Interrupt handlers
181 */ 181 */
182acpi_status 182acpi_status
183acpi_os_install_interrupt_handler(u32 gsi, 183acpi_os_install_interrupt_handler(u32 interrupt_number,
184 acpi_osd_handler service_routine, 184 acpi_osd_handler service_routine,
185 void *context); 185 void *context);
186 186
187acpi_status 187acpi_status
188acpi_os_remove_interrupt_handler(u32 gsi, acpi_osd_handler service_routine); 188acpi_os_remove_interrupt_handler(u32 interrupt_number,
189 acpi_osd_handler service_routine);
189 190
190void acpi_os_gpe_count(u32 gpe_number); 191void acpi_os_gpe_count(u32 gpe_number);
191void acpi_os_fixed_event_count(u32 fixed_event_number); 192void acpi_os_fixed_event_count(u32 fixed_event_number);
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index 3d88395d4d6f..03322dddd88e 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -46,7 +46,7 @@
46 46
47/* Current ACPICA subsystem version in YYYYMMDD format */ 47/* Current ACPICA subsystem version in YYYYMMDD format */
48 48
49#define ACPI_CA_VERSION 0x20121018 49#define ACPI_CA_VERSION 0x20130117
50 50
51#include <acpi/acconfig.h> 51#include <acpi/acconfig.h>
52#include <acpi/actypes.h> 52#include <acpi/actypes.h>
@@ -56,11 +56,20 @@
56extern u8 acpi_gbl_permanent_mmap; 56extern u8 acpi_gbl_permanent_mmap;
57 57
58/* 58/*
59 * Globals that are publicly available, allowing for 59 * Globals that are publically available
60 * run time configuration
61 */ 60 */
61extern u32 acpi_current_gpe_count;
62extern struct acpi_table_fadt acpi_gbl_FADT;
63extern u8 acpi_gbl_system_awake_and_running;
64extern u8 acpi_gbl_reduced_hardware; /* ACPI 5.0 */
65
66/* Runtime configuration of debug print levels */
67
62extern u32 acpi_dbg_level; 68extern u32 acpi_dbg_level;
63extern u32 acpi_dbg_layer; 69extern u32 acpi_dbg_layer;
70
71/* ACPICA runtime options */
72
64extern u8 acpi_gbl_enable_interpreter_slack; 73extern u8 acpi_gbl_enable_interpreter_slack;
65extern u8 acpi_gbl_all_methods_serialized; 74extern u8 acpi_gbl_all_methods_serialized;
66extern u8 acpi_gbl_create_osi_method; 75extern u8 acpi_gbl_create_osi_method;
@@ -99,14 +108,9 @@ extern u8 acpi_gbl_disable_auto_repair;
99 108
100#endif /* !ACPI_REDUCED_HARDWARE */ 109#endif /* !ACPI_REDUCED_HARDWARE */
101 110
102extern u32 acpi_current_gpe_count;
103extern struct acpi_table_fadt acpi_gbl_FADT;
104extern u8 acpi_gbl_system_awake_and_running;
105extern u8 acpi_gbl_reduced_hardware; /* ACPI 5.0 */
106
107extern u32 acpi_rsdt_forced; 111extern u32 acpi_rsdt_forced;
108/* 112/*
109 * Global interfaces 113 * Initialization
110 */ 114 */
111acpi_status 115acpi_status
112acpi_initialize_tables(struct acpi_table_desc *initial_storage, 116acpi_initialize_tables(struct acpi_table_desc *initial_storage,
@@ -120,13 +124,15 @@ acpi_status acpi_initialize_objects(u32 flags);
120 124
121acpi_status acpi_terminate(void); 125acpi_status acpi_terminate(void);
122 126
127/*
128 * Miscellaneous global interfaces
129 */
130ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_enable(void))
131ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_disable(void))
123#ifdef ACPI_FUTURE_USAGE 132#ifdef ACPI_FUTURE_USAGE
124acpi_status acpi_subsystem_status(void); 133acpi_status acpi_subsystem_status(void);
125#endif 134#endif
126 135
127ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_enable(void))
128ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_disable(void))
129
130#ifdef ACPI_FUTURE_USAGE 136#ifdef ACPI_FUTURE_USAGE
131acpi_status acpi_get_system_info(struct acpi_buffer *ret_buffer); 137acpi_status acpi_get_system_info(struct acpi_buffer *ret_buffer);
132#endif 138#endif
@@ -191,9 +197,9 @@ acpi_status
191acpi_get_table_by_index(u32 table_index, struct acpi_table_header **out_table); 197acpi_get_table_by_index(u32 table_index, struct acpi_table_header **out_table);
192 198
193acpi_status 199acpi_status
194acpi_install_table_handler(acpi_tbl_handler handler, void *context); 200acpi_install_table_handler(acpi_table_handler handler, void *context);
195 201
196acpi_status acpi_remove_table_handler(acpi_tbl_handler handler); 202acpi_status acpi_remove_table_handler(acpi_table_handler handler);
197 203
198/* 204/*
199 * Namespace and name interfaces 205 * Namespace and name interfaces
@@ -438,6 +444,11 @@ acpi_get_event_resources(acpi_handle device_handle,
438 struct acpi_buffer *ret_buffer); 444 struct acpi_buffer *ret_buffer);
439 445
440acpi_status 446acpi_status
447acpi_walk_resource_buffer(struct acpi_buffer *buffer,
448 acpi_walk_resource_callback user_function,
449 void *context);
450
451acpi_status
441acpi_walk_resources(acpi_handle device, 452acpi_walk_resources(acpi_handle device,
442 char *name, 453 char *name,
443 acpi_walk_resource_callback user_function, void *context); 454 acpi_walk_resource_callback user_function, void *context);
@@ -462,6 +473,10 @@ acpi_buffer_to_resource(u8 *aml_buffer,
462 */ 473 */
463acpi_status acpi_reset(void); 474acpi_status acpi_reset(void);
464 475
476acpi_status acpi_read(u64 *value, struct acpi_generic_address *reg);
477
478acpi_status acpi_write(u64 value, struct acpi_generic_address *reg);
479
465ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status 480ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
466 acpi_read_bit_register(u32 register_id, 481 acpi_read_bit_register(u32 register_id,
467 u32 *return_value)) 482 u32 *return_value))
@@ -470,20 +485,6 @@ ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
470 acpi_write_bit_register(u32 register_id, 485 acpi_write_bit_register(u32 register_id,
471 u32 value)) 486 u32 value))
472 487
473ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
474 acpi_set_firmware_waking_vector(u32
475 physical_address))
476
477#if ACPI_MACHINE_WIDTH == 64
478ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
479 acpi_set_firmware_waking_vector64(u64
480 physical_address))
481#endif
482
483acpi_status acpi_read(u64 *value, struct acpi_generic_address *reg);
484
485acpi_status acpi_write(u64 value, struct acpi_generic_address *reg);
486
487/* 488/*
488 * Sleep/Wake interfaces 489 * Sleep/Wake interfaces
489 */ 490 */
@@ -500,6 +501,15 @@ acpi_status acpi_leave_sleep_state_prep(u8 sleep_state);
500 501
501acpi_status acpi_leave_sleep_state(u8 sleep_state); 502acpi_status acpi_leave_sleep_state(u8 sleep_state);
502 503
504ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
505 acpi_set_firmware_waking_vector(u32
506 physical_address))
507
508#if ACPI_MACHINE_WIDTH == 64
509ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
510 acpi_set_firmware_waking_vector64(u64
511 physical_address))
512#endif
503/* 513/*
504 * ACPI Timer interfaces 514 * ACPI Timer interfaces
505 */ 515 */
diff --git a/include/acpi/acrestyp.h b/include/acpi/acrestyp.h
index 40349ae65464..cbf4bf977f75 100644
--- a/include/acpi/acrestyp.h
+++ b/include/acpi/acrestyp.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -102,8 +102,11 @@ typedef u32 acpi_rsdesc_size; /* Max Resource Descriptor size is (Length+3) = (6
102 102
103#define ACPI_EXCLUSIVE (u8) 0x00 103#define ACPI_EXCLUSIVE (u8) 0x00
104#define ACPI_SHARED (u8) 0x01 104#define ACPI_SHARED (u8) 0x01
105#define ACPI_EXCLUSIVE_AND_WAKE (u8) 0x02 105
106#define ACPI_SHARED_AND_WAKE (u8) 0x03 106/* Wake */
107
108#define ACPI_NOT_WAKE_CAPABLE (u8) 0x00
109#define ACPI_WAKE_CAPABLE (u8) 0x01
107 110
108/* 111/*
109 * DMA Attributes 112 * DMA Attributes
@@ -171,6 +174,7 @@ struct acpi_resource_irq {
171 u8 triggering; 174 u8 triggering;
172 u8 polarity; 175 u8 polarity;
173 u8 sharable; 176 u8 sharable;
177 u8 wake_capable;
174 u8 interrupt_count; 178 u8 interrupt_count;
175 u8 interrupts[1]; 179 u8 interrupts[1];
176}; 180};
@@ -346,6 +350,7 @@ struct acpi_resource_extended_irq {
346 u8 triggering; 350 u8 triggering;
347 u8 polarity; 351 u8 polarity;
348 u8 sharable; 352 u8 sharable;
353 u8 wake_capable;
349 u8 interrupt_count; 354 u8 interrupt_count;
350 struct acpi_resource_source resource_source; 355 struct acpi_resource_source resource_source;
351 u32 interrupts[1]; 356 u32 interrupts[1];
@@ -365,6 +370,7 @@ struct acpi_resource_gpio {
365 u8 producer_consumer; /* For values, see Producer/Consumer above */ 370 u8 producer_consumer; /* For values, see Producer/Consumer above */
366 u8 pin_config; 371 u8 pin_config;
367 u8 sharable; /* For values, see Interrupt Attributes above */ 372 u8 sharable; /* For values, see Interrupt Attributes above */
373 u8 wake_capable; /* For values, see Interrupt Attributes above */
368 u8 io_restriction; 374 u8 io_restriction;
369 u8 triggering; /* For values, see Interrupt Attributes above */ 375 u8 triggering; /* For values, see Interrupt Attributes above */
370 u8 polarity; /* For values, see Interrupt Attributes above */ 376 u8 polarity; /* For values, see Interrupt Attributes above */
@@ -591,7 +597,10 @@ struct acpi_resource {
591#define ACPI_RS_SIZE_MIN (u32) ACPI_ROUND_UP_TO_NATIVE_WORD (12) 597#define ACPI_RS_SIZE_MIN (u32) ACPI_ROUND_UP_TO_NATIVE_WORD (12)
592#define ACPI_RS_SIZE(type) (u32) (ACPI_RS_SIZE_NO_DATA + sizeof (type)) 598#define ACPI_RS_SIZE(type) (u32) (ACPI_RS_SIZE_NO_DATA + sizeof (type))
593 599
594#define ACPI_NEXT_RESOURCE(res) (struct acpi_resource *)((u8 *) res + res->length) 600/* Macro for walking resource templates with multiple descriptors */
601
602#define ACPI_NEXT_RESOURCE(res) \
603 ACPI_ADD_PTR (struct acpi_resource, (res), (res)->length)
595 604
596struct acpi_pci_routing_table { 605struct acpi_pci_routing_table {
597 u32 length; 606 u32 length;
diff --git a/include/acpi/actbl.h b/include/acpi/actbl.h
index 4f94b1d812d5..9b58a8f43771 100644
--- a/include/acpi/actbl.h
+++ b/include/acpi/actbl.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -326,8 +326,6 @@ enum acpi_preferred_pm_profiles {
326 326
327#pragma pack() 327#pragma pack()
328 328
329#define ACPI_FADT_OFFSET(f) (u16) ACPI_OFFSET (struct acpi_table_fadt, f)
330
331/* 329/*
332 * Internal table-related structures 330 * Internal table-related structures
333 */ 331 */
@@ -359,11 +357,14 @@ struct acpi_table_desc {
359/* 357/*
360 * Get the remaining ACPI tables 358 * Get the remaining ACPI tables
361 */ 359 */
362
363#include <acpi/actbl1.h> 360#include <acpi/actbl1.h>
364#include <acpi/actbl2.h> 361#include <acpi/actbl2.h>
365#include <acpi/actbl3.h> 362#include <acpi/actbl3.h>
366 363
364/* Macros used to generate offsets to specific table fields */
365
366#define ACPI_FADT_OFFSET(f) (u16) ACPI_OFFSET (struct acpi_table_fadt, f)
367
367/* 368/*
368 * Sizes of the various flavors of FADT. We need to look closely 369 * Sizes of the various flavors of FADT. We need to look closely
369 * at the FADT length because the version number essentially tells 370 * at the FADT length because the version number essentially tells
diff --git a/include/acpi/actbl1.h b/include/acpi/actbl1.h
index 280fc45b59dd..0bd750ebeb49 100644
--- a/include/acpi/actbl1.h
+++ b/include/acpi/actbl1.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -768,7 +768,7 @@ struct acpi_madt_interrupt_source {
768 768
769struct acpi_madt_local_x2apic { 769struct acpi_madt_local_x2apic {
770 struct acpi_subtable_header header; 770 struct acpi_subtable_header header;
771 u16 reserved; /* Reserved - must be zero */ 771 u16 reserved; /* reserved - must be zero */
772 u32 local_apic_id; /* Processor x2APIC ID */ 772 u32 local_apic_id; /* Processor x2APIC ID */
773 u32 lapic_flags; 773 u32 lapic_flags;
774 u32 uid; /* ACPI processor UID */ 774 u32 uid; /* ACPI processor UID */
@@ -781,14 +781,14 @@ struct acpi_madt_local_x2apic_nmi {
781 u16 inti_flags; 781 u16 inti_flags;
782 u32 uid; /* ACPI processor UID */ 782 u32 uid; /* ACPI processor UID */
783 u8 lint; /* LINTn to which NMI is connected */ 783 u8 lint; /* LINTn to which NMI is connected */
784 u8 reserved[3]; 784 u8 reserved[3]; /* reserved - must be zero */
785}; 785};
786 786
787/* 11: Generic Interrupt (ACPI 5.0) */ 787/* 11: Generic Interrupt (ACPI 5.0) */
788 788
789struct acpi_madt_generic_interrupt { 789struct acpi_madt_generic_interrupt {
790 struct acpi_subtable_header header; 790 struct acpi_subtable_header header;
791 u16 reserved; /* Reserved - must be zero */ 791 u16 reserved; /* reserved - must be zero */
792 u32 gic_id; 792 u32 gic_id;
793 u32 uid; 793 u32 uid;
794 u32 flags; 794 u32 flags;
diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h
index 1b2b356486d1..77dc7a4099a3 100644
--- a/include/acpi/actbl2.h
+++ b/include/acpi/actbl2.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -261,9 +261,28 @@ struct acpi_csrt_group {
261 u16 subdevice_id; 261 u16 subdevice_id;
262 u16 revision; 262 u16 revision;
263 u16 reserved; 263 u16 reserved;
264 u32 info_length; 264 u32 shared_info_length;
265 265
266 /* Shared data (length = info_length) immediately follows */ 266 /* Shared data immediately follows (Length = shared_info_length) */
267};
268
269/* Shared Info subtable */
270
271struct acpi_csrt_shared_info {
272 u16 major_version;
273 u16 minor_version;
274 u32 mmio_base_low;
275 u32 mmio_base_high;
276 u32 gsi_interrupt;
277 u8 interrupt_polarity;
278 u8 interrupt_mode;
279 u8 num_channels;
280 u8 dma_address_width;
281 u16 base_request_line;
282 u16 num_handshake_signals;
283 u32 max_block_size;
284
285 /* Resource descriptors immediately follow (Length = Group length - shared_info_length) */
267}; 286};
268 287
269/* Resource Descriptor subtable */ 288/* Resource Descriptor subtable */
diff --git a/include/acpi/actbl3.h b/include/acpi/actbl3.h
index 6585141e4b97..332b17e3bec8 100644
--- a/include/acpi/actbl3.h
+++ b/include/acpi/actbl3.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -68,13 +68,13 @@
68#define ACPI_SIG_PCCT "PCCT" /* Platform Communications Channel Table */ 68#define ACPI_SIG_PCCT "PCCT" /* Platform Communications Channel Table */
69#define ACPI_SIG_PMTT "PMTT" /* Platform Memory Topology Table */ 69#define ACPI_SIG_PMTT "PMTT" /* Platform Memory Topology Table */
70#define ACPI_SIG_RASF "RASF" /* RAS Feature table */ 70#define ACPI_SIG_RASF "RASF" /* RAS Feature table */
71#define ACPI_SIG_TPM2 "TPM2" /* Trusted Platform Module 2.0 H/W interface table */
71 72
72#define ACPI_SIG_S3PT "S3PT" /* S3 Performance (sub)Table */ 73#define ACPI_SIG_S3PT "S3PT" /* S3 Performance (sub)Table */
73#define ACPI_SIG_PCCS "PCC" /* PCC Shared Memory Region */ 74#define ACPI_SIG_PCCS "PCC" /* PCC Shared Memory Region */
74 75
75/* Reserved table signatures */ 76/* Reserved table signatures */
76 77
77#define ACPI_SIG_CSRT "CSRT" /* Core System Resources Table */
78#define ACPI_SIG_MATR "MATR" /* Memory Address Translation Table */ 78#define ACPI_SIG_MATR "MATR" /* Memory Address Translation Table */
79#define ACPI_SIG_MSDM "MSDM" /* Microsoft Data Management Table */ 79#define ACPI_SIG_MSDM "MSDM" /* Microsoft Data Management Table */
80#define ACPI_SIG_WPBT "WPBT" /* Windows Platform Binary Table */ 80#define ACPI_SIG_WPBT "WPBT" /* Windows Platform Binary Table */
@@ -550,6 +550,36 @@ enum acpi_rasf_status {
550#define ACPI_RASF_ERROR (1<<2) 550#define ACPI_RASF_ERROR (1<<2)
551#define ACPI_RASF_STATUS (0x1F<<3) 551#define ACPI_RASF_STATUS (0x1F<<3)
552 552
553/*******************************************************************************
554 *
555 * TPM2 - Trusted Platform Module (TPM) 2.0 Hardware Interface Table
556 * Version 3
557 *
558 * Conforms to "TPM 2.0 Hardware Interface Table (TPM2)" 29 November 2011
559 *
560 ******************************************************************************/
561
562struct acpi_table_tpm2 {
563 struct acpi_table_header header; /* Common ACPI table header */
564 u32 flags;
565 u64 control_address;
566 u32 start_method;
567};
568
569/* Control area structure (not part of table, pointed to by control_address) */
570
571struct acpi_tpm2_control {
572 u32 reserved;
573 u32 error;
574 u32 cancel;
575 u32 start;
576 u64 interrupt_control;
577 u32 command_size;
578 u64 command_address;
579 u32 response_size;
580 u64 response_address;
581};
582
553/* Reset to default packing */ 583/* Reset to default packing */
554 584
555#pragma pack() 585#pragma pack()
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
index 4f43f1fba132..845e75f1ffd8 100644
--- a/include/acpi/actypes.h
+++ b/include/acpi/actypes.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -341,7 +341,7 @@ typedef u32 acpi_physical_address;
341 341
342/* PM Timer ticks per second (HZ) */ 342/* PM Timer ticks per second (HZ) */
343 343
344#define PM_TIMER_FREQUENCY 3579545 344#define ACPI_PM_TIMER_FREQUENCY 3579545
345 345
346/******************************************************************************* 346/*******************************************************************************
347 * 347 *
@@ -373,6 +373,21 @@ typedef u32 acpi_name; /* 4-byte ACPI name */
373typedef char *acpi_string; /* Null terminated ASCII string */ 373typedef char *acpi_string; /* Null terminated ASCII string */
374typedef void *acpi_handle; /* Actually a ptr to a NS Node */ 374typedef void *acpi_handle; /* Actually a ptr to a NS Node */
375 375
376/* Time constants for timer calculations */
377
378#define ACPI_MSEC_PER_SEC 1000L
379
380#define ACPI_USEC_PER_MSEC 1000L
381#define ACPI_USEC_PER_SEC 1000000L
382
383#define ACPI_100NSEC_PER_USEC 10L
384#define ACPI_100NSEC_PER_MSEC 10000L
385#define ACPI_100NSEC_PER_SEC 10000000L
386
387#define ACPI_NSEC_PER_USEC 1000L
388#define ACPI_NSEC_PER_MSEC 1000000L
389#define ACPI_NSEC_PER_SEC 1000000000L
390
376/* Owner IDs are used to track namespace nodes for selective deletion */ 391/* Owner IDs are used to track namespace nodes for selective deletion */
377 392
378typedef u8 acpi_owner_id; 393typedef u8 acpi_owner_id;
@@ -390,10 +405,6 @@ typedef u8 acpi_owner_id;
390#define ACPI_MAX16_DECIMAL_DIGITS 5 405#define ACPI_MAX16_DECIMAL_DIGITS 5
391#define ACPI_MAX8_DECIMAL_DIGITS 3 406#define ACPI_MAX8_DECIMAL_DIGITS 3
392 407
393/* PM Timer ticks per second (HZ) */
394
395#define PM_TIMER_FREQUENCY 3579545
396
397/* 408/*
398 * Constants with special meanings 409 * Constants with special meanings
399 */ 410 */
@@ -474,6 +485,7 @@ typedef u64 acpi_integer;
474 */ 485 */
475#define ACPI_FULL_INITIALIZATION 0x00 486#define ACPI_FULL_INITIALIZATION 0x00
476#define ACPI_NO_ADDRESS_SPACE_INIT 0x01 487#define ACPI_NO_ADDRESS_SPACE_INIT 0x01
488#define ACPI_NO_HARDWARE_INIT 0x02
477#define ACPI_NO_EVENT_INIT 0x04 489#define ACPI_NO_EVENT_INIT 0x04
478#define ACPI_NO_HANDLER_INIT 0x08 490#define ACPI_NO_HANDLER_INIT 0x08
479#define ACPI_NO_ACPI_ENABLE 0x10 491#define ACPI_NO_ACPI_ENABLE 0x10
@@ -595,7 +607,7 @@ typedef u32 acpi_object_type;
595 607
596/* 608/*
597 * These are special object types that never appear in 609 * These are special object types that never appear in
598 * a Namespace node, only in a union acpi_operand_object 610 * a Namespace node, only in an object of union acpi_operand_object
599 */ 611 */
600#define ACPI_TYPE_LOCAL_EXTRA 0x1C 612#define ACPI_TYPE_LOCAL_EXTRA 0x1C
601#define ACPI_TYPE_LOCAL_DATA 0x1D 613#define ACPI_TYPE_LOCAL_DATA 0x1D
@@ -662,7 +674,7 @@ typedef u32 acpi_event_status;
662#define ACPI_GPE_MAX 0xFF 674#define ACPI_GPE_MAX 0xFF
663#define ACPI_NUM_GPE 256 675#define ACPI_NUM_GPE 256
664 676
665/* Actions for acpi_set_gpe_wake_mask, acpi_hw_low_set_gpe */ 677/* Actions for acpi_set_gpe, acpi_gpe_wakeup, acpi_hw_low_set_gpe */
666 678
667#define ACPI_GPE_ENABLE 0 679#define ACPI_GPE_ENABLE 0
668#define ACPI_GPE_DISABLE 1 680#define ACPI_GPE_DISABLE 1
@@ -880,6 +892,10 @@ struct acpi_buffer {
880 void *pointer; /* pointer to buffer */ 892 void *pointer; /* pointer to buffer */
881}; 893};
882 894
895/* Free a buffer created in an struct acpi_buffer via ACPI_ALLOCATE_LOCAL_BUFFER */
896
897#define ACPI_FREE_BUFFER(b) ACPI_FREE(b.pointer)
898
883/* 899/*
884 * name_type for acpi_get_name 900 * name_type for acpi_get_name
885 */ 901 */
@@ -968,7 +984,11 @@ acpi_status(*acpi_exception_handler) (acpi_status aml_status,
968/* Table Event handler (Load, load_table, etc.) and types */ 984/* Table Event handler (Load, load_table, etc.) and types */
969 985
970typedef 986typedef
971acpi_status(*acpi_tbl_handler) (u32 event, void *table, void *context); 987acpi_status(*acpi_table_handler) (u32 event, void *table, void *context);
988
989#define ACPI_TABLE_LOAD 0x0
990#define ACPI_TABLE_UNLOAD 0x1
991#define ACPI_NUM_TABLE_EVENTS 2
972 992
973/* Address Spaces (For Operation Regions) */ 993/* Address Spaces (For Operation Regions) */
974 994
diff --git a/include/acpi/container.h b/include/acpi/container.h
deleted file mode 100644
index a703f14e049e..000000000000
--- a/include/acpi/container.h
+++ /dev/null
@@ -1,12 +0,0 @@
1#ifndef __ACPI_CONTAINER_H
2#define __ACPI_CONTAINER_H
3
4#include <linux/kernel.h>
5
6struct acpi_container {
7 acpi_handle handle;
8 unsigned long sun;
9 int state;
10};
11
12#endif /* __ACPI_CONTAINER_H */
diff --git a/include/acpi/platform/acenv.h b/include/acpi/platform/acenv.h
index 89cee88dd2a5..ef04b36ca6ed 100644
--- a/include/acpi/platform/acenv.h
+++ b/include/acpi/platform/acenv.h
@@ -1,11 +1,11 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Name: acenv.h - Generation environment specific items 3 * Name: acenv.h - Host and compiler configuration
4 * 4 *
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -44,6 +44,12 @@
44#ifndef __ACENV_H__ 44#ifndef __ACENV_H__
45#define __ACENV_H__ 45#define __ACENV_H__
46 46
47/*
48 * Environment configuration. The purpose of this file is to interface ACPICA
49 * to the local environment. This includes compiler-specific, OS-specific,
50 * and machine-specific configuration.
51 */
52
47/* Types for ACPI_MUTEX_TYPE */ 53/* Types for ACPI_MUTEX_TYPE */
48 54
49#define ACPI_BINARY_SEMAPHORE 0 55#define ACPI_BINARY_SEMAPHORE 0
@@ -60,139 +66,170 @@
60 * 66 *
61 *****************************************************************************/ 67 *****************************************************************************/
62 68
63#ifdef ACPI_LIBRARY 69/* iASL configuration */
64/*
65 * Note: The non-debug version of the acpi_library does not contain any
66 * debug support, for minimal size. The debug version uses ACPI_FULL_DEBUG
67 */
68#define ACPI_USE_LOCAL_CACHE
69#endif
70 70
71#ifdef ACPI_ASL_COMPILER 71#ifdef ACPI_ASL_COMPILER
72#define ACPI_DEBUG_OUTPUT
73#define ACPI_APPLICATION 72#define ACPI_APPLICATION
74#define ACPI_DISASSEMBLER 73#define ACPI_DISASSEMBLER
74#define ACPI_DEBUG_OUTPUT
75#define ACPI_CONSTANT_EVAL_ONLY 75#define ACPI_CONSTANT_EVAL_ONLY
76#define ACPI_LARGE_NAMESPACE_NODE 76#define ACPI_LARGE_NAMESPACE_NODE
77#define ACPI_DATA_TABLE_DISASSEMBLY 77#define ACPI_DATA_TABLE_DISASSEMBLY
78#define ACPI_SINGLE_THREADED
78#endif 79#endif
79 80
81/* acpi_exec configuration. Multithreaded with full AML debugger */
82
80#ifdef ACPI_EXEC_APP 83#ifdef ACPI_EXEC_APP
81#undef DEBUGGER_THREADING
82#define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED
83#define ACPI_FULL_DEBUG
84#define ACPI_APPLICATION 84#define ACPI_APPLICATION
85#define ACPI_DEBUGGER 85#define ACPI_FULL_DEBUG
86#define ACPI_MUTEX_DEBUG 86#define ACPI_MUTEX_DEBUG
87#define ACPI_DBG_TRACK_ALLOCATIONS 87#define ACPI_DBG_TRACK_ALLOCATIONS
88#endif 88#endif
89 89
90/* acpi_names configuration. Single threaded with debugger output enabled. */
91
92#ifdef ACPI_NAMES_APP
93#define ACPI_DEBUGGER
94#define ACPI_APPLICATION
95#define ACPI_SINGLE_THREADED
96#endif
97
98/*
99 * acpi_bin/acpi_help/acpi_src configuration. All single threaded, with
100 * no debug output.
101 */
102#if (defined ACPI_BIN_APP) || \
103 (defined ACPI_SRC_APP) || \
104 (defined ACPI_XTRACT_APP)
105#define ACPI_APPLICATION
106#define ACPI_SINGLE_THREADED
107#endif
108
109#ifdef ACPI_HELP_APP
110#define ACPI_APPLICATION
111#define ACPI_SINGLE_THREADED
112#define ACPI_NO_ERROR_MESSAGES
113#endif
114
115/* Linkable ACPICA library */
116
117#ifdef ACPI_LIBRARY
118#define ACPI_USE_LOCAL_CACHE
119#define ACPI_FUTURE_USAGE
120#endif
121
122/* Common for all ACPICA applications */
123
90#ifdef ACPI_APPLICATION 124#ifdef ACPI_APPLICATION
91#define ACPI_USE_SYSTEM_CLIBRARY 125#define ACPI_USE_SYSTEM_CLIBRARY
92#define ACPI_USE_LOCAL_CACHE 126#define ACPI_USE_LOCAL_CACHE
93#endif 127#endif
94 128
129/* Common debug support */
130
95#ifdef ACPI_FULL_DEBUG 131#ifdef ACPI_FULL_DEBUG
96#define ACPI_DEBUGGER 132#define ACPI_DEBUGGER
97#define ACPI_DEBUG_OUTPUT 133#define ACPI_DEBUG_OUTPUT
98#define ACPI_DISASSEMBLER 134#define ACPI_DISASSEMBLER
99#endif 135#endif
100 136
101/*
102 * Environment configuration. The purpose of this file is to interface to the
103 * local generation environment.
104 *
105 * 1) ACPI_USE_SYSTEM_CLIBRARY - Define this if linking to an actual C library.
106 * Otherwise, local versions of string/memory functions will be used.
107 * 2) ACPI_USE_STANDARD_HEADERS - Define this if linking to a C library and
108 * the standard header files may be used.
109 *
110 * The ACPI subsystem only uses low level C library functions that do not call
111 * operating system services and may therefore be inlined in the code.
112 *
113 * It may be necessary to tailor these include files to the target
114 * generation environment.
115 *
116 *
117 * Functions and constants used from each header:
118 *
119 * string.h: memcpy
120 * memset
121 * strcat
122 * strcmp
123 * strcpy
124 * strlen
125 * strncmp
126 * strncat
127 * strncpy
128 *
129 * stdlib.h: strtoul
130 *
131 * stdarg.h: va_list
132 * va_arg
133 * va_start
134 * va_end
135 *
136 */
137 137
138/*! [Begin] no source code translation */ 138/*! [Begin] no source code translation */
139 139
140/******************************************************************************
141 *
142 * Host configuration files. The compiler configuration files are included
143 * by the host files.
144 *
145 *****************************************************************************/
146
140#if defined(_LINUX) || defined(__linux__) 147#if defined(_LINUX) || defined(__linux__)
141#include <acpi/platform/aclinux.h> 148#include <acpi/platform/aclinux.h>
142 149
143#elif defined(_AED_EFI)
144#include "acefi.h"
145
146#elif defined(WIN32)
147#include "acwin.h"
148
149#elif defined(WIN64)
150#include "acwin64.h"
151
152#elif defined(MSDOS) /* Must appear after WIN32 and WIN64 check */
153#include "acdos16.h"
154
155#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) 150#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
156#include "acfreebsd.h" 151#include "acfreebsd.h"
157 152
158#elif defined(__NetBSD__) 153#elif defined(__NetBSD__)
159#include "acnetbsd.h" 154#include "acnetbsd.h"
160 155
156#elif defined(__sun)
157#include "acsolaris.h"
158
161#elif defined(MODESTO) 159#elif defined(MODESTO)
162#include "acmodesto.h" 160#include "acmodesto.h"
163 161
164#elif defined(NETWARE) 162#elif defined(NETWARE)
165#include "acnetware.h" 163#include "acnetware.h"
166 164
167#elif defined(__sun) 165#elif defined(_CYGWIN)
168#include "acsolaris.h" 166#include "accygwin.h"
169 167
170#else 168#elif defined(WIN32)
169#include "acwin.h"
170
171#elif defined(WIN64)
172#include "acwin64.h"
171 173
172/* All other environments */ 174#elif defined(_WRS_LIB_BUILD)
175#include "acvxworks.h"
173 176
174#define ACPI_USE_STANDARD_HEADERS 177#elif defined(__OS2__)
178#include "acos2.h"
175 179
176#define COMPILER_DEPENDENT_INT64 long long 180#elif defined(_AED_EFI)
177#define COMPILER_DEPENDENT_UINT64 unsigned long long 181#include "acefi.h"
182
183#elif defined(__HAIKU__)
184#include "achaiku.h"
178 185
186#else
187
188/* Unknown environment */
189
190#error Unknown target environment
179#endif 191#endif
180 192
181/*! [End] no source code translation !*/ 193/*! [End] no source code translation !*/
182 194
183/****************************************************************************** 195/******************************************************************************
184 * 196 *
185 * Miscellaneous configuration 197 * Setup defaults for the required symbols that were not defined in one of
198 * the host/compiler files above.
186 * 199 *
187 *****************************************************************************/ 200 *****************************************************************************/
188 201
189/* 202/* 64-bit data types */
190 * Are mutexes supported by the host? default is no, use binary semaphores. 203
191 */ 204#ifndef COMPILER_DEPENDENT_INT64
205#define COMPILER_DEPENDENT_INT64 long long
206#endif
207
208#ifndef COMPILER_DEPENDENT_UINT64
209#define COMPILER_DEPENDENT_UINT64 unsigned long long
210#endif
211
212/* Type of mutex supported by host. Default is binary semaphores. */
192#ifndef ACPI_MUTEX_TYPE 213#ifndef ACPI_MUTEX_TYPE
193#define ACPI_MUTEX_TYPE ACPI_BINARY_SEMAPHORE 214#define ACPI_MUTEX_TYPE ACPI_BINARY_SEMAPHORE
194#endif 215#endif
195 216
217/* Global Lock acquire/release */
218
219#ifndef ACPI_ACQUIRE_GLOBAL_LOCK
220#define ACPI_ACQUIRE_GLOBAL_LOCK(Glptr, acquired) acquired = 1
221#endif
222
223#ifndef ACPI_RELEASE_GLOBAL_LOCK
224#define ACPI_RELEASE_GLOBAL_LOCK(Glptr, pending) pending = 0
225#endif
226
227/* Flush CPU cache - used when going to sleep. Wbinvd or similar. */
228
229#ifndef ACPI_FLUSH_CPU_CACHE
230#define ACPI_FLUSH_CPU_CACHE()
231#endif
232
196/* "inline" keywords - configurable since inline is not standardized */ 233/* "inline" keywords - configurable since inline is not standardized */
197 234
198#ifndef ACPI_INLINE 235#ifndef ACPI_INLINE
@@ -200,6 +237,30 @@
200#endif 237#endif
201 238
202/* 239/*
240 * Configurable calling conventions:
241 *
242 * ACPI_SYSTEM_XFACE - Interfaces to host OS (handlers, threads)
243 * ACPI_EXTERNAL_XFACE - External ACPI interfaces
244 * ACPI_INTERNAL_XFACE - Internal ACPI interfaces
245 * ACPI_INTERNAL_VAR_XFACE - Internal variable-parameter list interfaces
246 */
247#ifndef ACPI_SYSTEM_XFACE
248#define ACPI_SYSTEM_XFACE
249#endif
250
251#ifndef ACPI_EXTERNAL_XFACE
252#define ACPI_EXTERNAL_XFACE
253#endif
254
255#ifndef ACPI_INTERNAL_XFACE
256#define ACPI_INTERNAL_XFACE
257#endif
258
259#ifndef ACPI_INTERNAL_VAR_XFACE
260#define ACPI_INTERNAL_VAR_XFACE
261#endif
262
263/*
203 * Debugger threading model 264 * Debugger threading model
204 * Use single threaded if the entire subsystem is contained in an application 265 * Use single threaded if the entire subsystem is contained in an application
205 * Use multiple threaded when the subsystem is running in the kernel. 266 * Use multiple threaded when the subsystem is running in the kernel.
@@ -222,17 +283,26 @@
222 * 283 *
223 *****************************************************************************/ 284 *****************************************************************************/
224 285
225#define ACPI_IS_ASCII(c) ((c) < 0x80)
226
227#ifdef ACPI_USE_SYSTEM_CLIBRARY
228/* 286/*
229 * Use the standard C library headers. 287 * ACPI_USE_SYSTEM_CLIBRARY - Define this if linking to an actual C library.
230 * We want to keep these to a minimum. 288 * Otherwise, local versions of string/memory functions will be used.
289 * ACPI_USE_STANDARD_HEADERS - Define this if linking to a C library and
290 * the standard header files may be used.
291 *
292 * The ACPICA subsystem only uses low level C library functions that do not call
293 * operating system services and may therefore be inlined in the code.
294 *
295 * It may be necessary to tailor these include files to the target
296 * generation environment.
231 */ 297 */
298#ifdef ACPI_USE_SYSTEM_CLIBRARY
299
300/* Use the standard C library headers. We want to keep these to a minimum. */
301
232#ifdef ACPI_USE_STANDARD_HEADERS 302#ifdef ACPI_USE_STANDARD_HEADERS
233/* 303
234 * Use the standard headers from the standard locations 304/* Use the standard headers from the standard locations */
235 */ 305
236#include <stdarg.h> 306#include <stdarg.h>
237#include <stdlib.h> 307#include <stdlib.h>
238#include <string.h> 308#include <string.h>
@@ -240,9 +310,8 @@
240 310
241#endif /* ACPI_USE_STANDARD_HEADERS */ 311#endif /* ACPI_USE_STANDARD_HEADERS */
242 312
243/* 313/* We will be linking to the standard Clib functions */
244 * We will be linking to the standard Clib functions 314
245 */
246#define ACPI_STRSTR(s1,s2) strstr((s1), (s2)) 315#define ACPI_STRSTR(s1,s2) strstr((s1), (s2))
247#define ACPI_STRCHR(s1,c) strchr((s1), (c)) 316#define ACPI_STRCHR(s1,c) strchr((s1), (c))
248#define ACPI_STRLEN(s) (acpi_size) strlen((s)) 317#define ACPI_STRLEN(s) (acpi_size) strlen((s))
@@ -274,13 +343,12 @@
274 * 343 *
275 *****************************************************************************/ 344 *****************************************************************************/
276 345
277 /* 346/*
278 * Use local definitions of C library macros and functions 347 * Use local definitions of C library macros and functions. These function
279 * NOTE: The function implementations may not be as efficient 348 * implementations may not be as efficient as an inline or assembly code
280 * as an inline or assembly code implementation provided by a 349 * implementation provided by a native C library, but they are functionally
281 * native C library. 350 * equivalent.
282 */ 351 */
283
284#ifndef va_arg 352#ifndef va_arg
285 353
286#ifndef _VALIST 354#ifndef _VALIST
@@ -288,22 +356,22 @@
288typedef char *va_list; 356typedef char *va_list;
289#endif /* _VALIST */ 357#endif /* _VALIST */
290 358
291/* 359/* Storage alignment properties */
292 * Storage alignment properties 360
293 */
294#define _AUPBND (sizeof (acpi_native_int) - 1) 361#define _AUPBND (sizeof (acpi_native_int) - 1)
295#define _ADNBND (sizeof (acpi_native_int) - 1) 362#define _ADNBND (sizeof (acpi_native_int) - 1)
296 363
297/* 364/* Variable argument list macro definitions */
298 * Variable argument list macro definitions 365
299 */
300#define _bnd(X, bnd) (((sizeof (X)) + (bnd)) & (~(bnd))) 366#define _bnd(X, bnd) (((sizeof (X)) + (bnd)) & (~(bnd)))
301#define va_arg(ap, T) (*(T *)(((ap) += (_bnd (T, _AUPBND))) - (_bnd (T,_ADNBND)))) 367#define va_arg(ap, T) (*(T *)(((ap) += (_bnd (T, _AUPBND))) - (_bnd (T,_ADNBND))))
302#define va_end(ap) (void) 0 368#define va_end(ap) (ap = (va_list) NULL)
303#define va_start(ap, A) (void) ((ap) = (((char *) &(A)) + (_bnd (A,_AUPBND)))) 369#define va_start(ap, A) (void) ((ap) = (((char *) &(A)) + (_bnd (A,_AUPBND))))
304 370
305#endif /* va_arg */ 371#endif /* va_arg */
306 372
373/* Use the local (ACPICA) definitions of the clib functions */
374
307#define ACPI_STRSTR(s1,s2) acpi_ut_strstr ((s1), (s2)) 375#define ACPI_STRSTR(s1,s2) acpi_ut_strstr ((s1), (s2))
308#define ACPI_STRCHR(s1,c) acpi_ut_strchr ((s1), (c)) 376#define ACPI_STRCHR(s1,c) acpi_ut_strchr ((s1), (c))
309#define ACPI_STRLEN(s) (acpi_size) acpi_ut_strlen ((s)) 377#define ACPI_STRLEN(s) (acpi_size) acpi_ut_strlen ((s))
@@ -322,59 +390,4 @@ typedef char *va_list;
322 390
323#endif /* ACPI_USE_SYSTEM_CLIBRARY */ 391#endif /* ACPI_USE_SYSTEM_CLIBRARY */
324 392
325/******************************************************************************
326 *
327 * Assembly code macros
328 *
329 *****************************************************************************/
330
331/*
332 * Handle platform- and compiler-specific assembly language differences.
333 * These should already have been defined by the platform includes above.
334 *
335 * Notes:
336 * 1) Interrupt 3 is used to break into a debugger
337 * 2) Interrupts are turned off during ACPI register setup
338 */
339
340/* Unrecognized compiler, use defaults */
341
342#ifndef ACPI_ASM_MACROS
343
344/*
345 * Calling conventions:
346 *
347 * ACPI_SYSTEM_XFACE - Interfaces to host OS (handlers, threads)
348 * ACPI_EXTERNAL_XFACE - External ACPI interfaces
349 * ACPI_INTERNAL_XFACE - Internal ACPI interfaces
350 * ACPI_INTERNAL_VAR_XFACE - Internal variable-parameter list interfaces
351 */
352#define ACPI_SYSTEM_XFACE
353#define ACPI_EXTERNAL_XFACE
354#define ACPI_INTERNAL_XFACE
355#define ACPI_INTERNAL_VAR_XFACE
356
357#define ACPI_ASM_MACROS
358#define BREAKPOINT3
359#define ACPI_DISABLE_IRQS()
360#define ACPI_ENABLE_IRQS()
361#define ACPI_ACQUIRE_GLOBAL_LOCK(Glptr, acq)
362#define ACPI_RELEASE_GLOBAL_LOCK(Glptr, acq)
363
364#endif /* ACPI_ASM_MACROS */
365
366#ifdef ACPI_APPLICATION
367
368/* Don't want software interrupts within a ring3 application */
369
370#undef BREAKPOINT3
371#define BREAKPOINT3
372#endif
373
374/******************************************************************************
375 *
376 * Compiler-specific information is contained in the compiler-specific
377 * headers.
378 *
379 *****************************************************************************/
380#endif /* __ACENV_H__ */ 393#endif /* __ACENV_H__ */
diff --git a/include/acpi/platform/acgcc.h b/include/acpi/platform/acgcc.h
index 72553b0c9f33..e077ce6c38ca 100644
--- a/include/acpi/platform/acgcc.h
+++ b/include/acpi/platform/acgcc.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -64,8 +64,4 @@
64 */ 64 */
65#define ACPI_UNUSED_VAR __attribute__ ((unused)) 65#define ACPI_UNUSED_VAR __attribute__ ((unused))
66 66
67#ifdef _ANSI
68#define inline
69#endif
70
71#endif /* __ACGCC_H__ */ 67#endif /* __ACGCC_H__ */
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index 85d5d8f38452..68534ef86ec8 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -108,7 +108,6 @@
108 108
109#include <acpi/platform/acgcc.h> 109#include <acpi/platform/acgcc.h>
110 110
111
112#ifdef __KERNEL__ 111#ifdef __KERNEL__
113#include <acpi/actypes.h> 112#include <acpi/actypes.h>
114/* 113/*
diff --git a/include/asm-generic/cputime.h b/include/asm-generic/cputime.h
index 9a62937c56ca..51969436b8b8 100644
--- a/include/asm-generic/cputime.h
+++ b/include/asm-generic/cputime.h
@@ -4,66 +4,12 @@
4#include <linux/time.h> 4#include <linux/time.h>
5#include <linux/jiffies.h> 5#include <linux/jiffies.h>
6 6
7typedef unsigned long __nocast cputime_t; 7#ifndef CONFIG_VIRT_CPU_ACCOUNTING
8 8# include <asm-generic/cputime_jiffies.h>
9#define cputime_one_jiffy jiffies_to_cputime(1) 9#endif
10#define cputime_to_jiffies(__ct) (__force unsigned long)(__ct)
11#define cputime_to_scaled(__ct) (__ct)
12#define jiffies_to_cputime(__hz) (__force cputime_t)(__hz)
13
14typedef u64 __nocast cputime64_t;
15
16#define cputime64_to_jiffies64(__ct) (__force u64)(__ct)
17#define jiffies64_to_cputime64(__jif) (__force cputime64_t)(__jif)
18
19#define nsecs_to_cputime64(__ct) \
20 jiffies64_to_cputime64(nsecs_to_jiffies64(__ct))
21
22
23/*
24 * Convert cputime to microseconds and back.
25 */
26#define cputime_to_usecs(__ct) \
27 jiffies_to_usecs(cputime_to_jiffies(__ct))
28#define usecs_to_cputime(__usec) \
29 jiffies_to_cputime(usecs_to_jiffies(__usec))
30#define usecs_to_cputime64(__usec) \
31 jiffies64_to_cputime64(nsecs_to_jiffies64((__usec) * 1000))
32
33/*
34 * Convert cputime to seconds and back.
35 */
36#define cputime_to_secs(jif) (cputime_to_jiffies(jif) / HZ)
37#define secs_to_cputime(sec) jiffies_to_cputime((sec) * HZ)
38
39/*
40 * Convert cputime to timespec and back.
41 */
42#define timespec_to_cputime(__val) \
43 jiffies_to_cputime(timespec_to_jiffies(__val))
44#define cputime_to_timespec(__ct,__val) \
45 jiffies_to_timespec(cputime_to_jiffies(__ct),__val)
46
47/*
48 * Convert cputime to timeval and back.
49 */
50#define timeval_to_cputime(__val) \
51 jiffies_to_cputime(timeval_to_jiffies(__val))
52#define cputime_to_timeval(__ct,__val) \
53 jiffies_to_timeval(cputime_to_jiffies(__ct),__val)
54
55/*
56 * Convert cputime to clock and back.
57 */
58#define cputime_to_clock_t(__ct) \
59 jiffies_to_clock_t(cputime_to_jiffies(__ct))
60#define clock_t_to_cputime(__x) \
61 jiffies_to_cputime(clock_t_to_jiffies(__x))
62 10
63/* 11#ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN
64 * Convert cputime64 to clock. 12# include <asm-generic/cputime_nsecs.h>
65 */ 13#endif
66#define cputime64_to_clock_t(__ct) \
67 jiffies_64_to_clock_t(cputime64_to_jiffies64(__ct))
68 14
69#endif 15#endif
diff --git a/include/asm-generic/cputime_jiffies.h b/include/asm-generic/cputime_jiffies.h
new file mode 100644
index 000000000000..272ecba9f588
--- /dev/null
+++ b/include/asm-generic/cputime_jiffies.h
@@ -0,0 +1,72 @@
1#ifndef _ASM_GENERIC_CPUTIME_JIFFIES_H
2#define _ASM_GENERIC_CPUTIME_JIFFIES_H
3
4typedef unsigned long __nocast cputime_t;
5
6#define cputime_one_jiffy jiffies_to_cputime(1)
7#define cputime_to_jiffies(__ct) (__force unsigned long)(__ct)
8#define cputime_to_scaled(__ct) (__ct)
9#define jiffies_to_cputime(__hz) (__force cputime_t)(__hz)
10
11typedef u64 __nocast cputime64_t;
12
13#define cputime64_to_jiffies64(__ct) (__force u64)(__ct)
14#define jiffies64_to_cputime64(__jif) (__force cputime64_t)(__jif)
15
16
17/*
18 * Convert nanoseconds to cputime
19 */
20#define nsecs_to_cputime64(__nsec) \
21 jiffies64_to_cputime64(nsecs_to_jiffies64(__nsec))
22#define nsecs_to_cputime(__nsec) \
23 jiffies_to_cputime(nsecs_to_jiffies(__nsec))
24
25
26/*
27 * Convert cputime to microseconds and back.
28 */
29#define cputime_to_usecs(__ct) \
30 jiffies_to_usecs(cputime_to_jiffies(__ct))
31#define usecs_to_cputime(__usec) \
32 jiffies_to_cputime(usecs_to_jiffies(__usec))
33#define usecs_to_cputime64(__usec) \
34 jiffies64_to_cputime64(nsecs_to_jiffies64((__usec) * 1000))
35
36/*
37 * Convert cputime to seconds and back.
38 */
39#define cputime_to_secs(jif) (cputime_to_jiffies(jif) / HZ)
40#define secs_to_cputime(sec) jiffies_to_cputime((sec) * HZ)
41
42/*
43 * Convert cputime to timespec and back.
44 */
45#define timespec_to_cputime(__val) \
46 jiffies_to_cputime(timespec_to_jiffies(__val))
47#define cputime_to_timespec(__ct,__val) \
48 jiffies_to_timespec(cputime_to_jiffies(__ct),__val)
49
50/*
51 * Convert cputime to timeval and back.
52 */
53#define timeval_to_cputime(__val) \
54 jiffies_to_cputime(timeval_to_jiffies(__val))
55#define cputime_to_timeval(__ct,__val) \
56 jiffies_to_timeval(cputime_to_jiffies(__ct),__val)
57
58/*
59 * Convert cputime to clock and back.
60 */
61#define cputime_to_clock_t(__ct) \
62 jiffies_to_clock_t(cputime_to_jiffies(__ct))
63#define clock_t_to_cputime(__x) \
64 jiffies_to_cputime(clock_t_to_jiffies(__x))
65
66/*
67 * Convert cputime64 to clock.
68 */
69#define cputime64_to_clock_t(__ct) \
70 jiffies_64_to_clock_t(cputime64_to_jiffies64(__ct))
71
72#endif
diff --git a/include/asm-generic/cputime_nsecs.h b/include/asm-generic/cputime_nsecs.h
new file mode 100644
index 000000000000..b6485cafb7bd
--- /dev/null
+++ b/include/asm-generic/cputime_nsecs.h
@@ -0,0 +1,104 @@
1/*
2 * Definitions for measuring cputime in nsecs resolution.
3 *
4 * Based on <arch/ia64/include/asm/cputime.h>
5 *
6 * Copyright (C) 2007 FUJITSU LIMITED
7 * Copyright (C) 2007 Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version
12 * 2 of the License, or (at your option) any later version.
13 *
14 */
15
16#ifndef _ASM_GENERIC_CPUTIME_NSECS_H
17#define _ASM_GENERIC_CPUTIME_NSECS_H
18
19typedef u64 __nocast cputime_t;
20typedef u64 __nocast cputime64_t;
21
22#define cputime_one_jiffy jiffies_to_cputime(1)
23
24/*
25 * Convert cputime <-> jiffies (HZ)
26 */
27#define cputime_to_jiffies(__ct) \
28 ((__force u64)(__ct) / (NSEC_PER_SEC / HZ))
29#define cputime_to_scaled(__ct) (__ct)
30#define jiffies_to_cputime(__jif) \
31 (__force cputime_t)((__jif) * (NSEC_PER_SEC / HZ))
32#define cputime64_to_jiffies64(__ct) \
33 ((__force u64)(__ct) / (NSEC_PER_SEC / HZ))
34#define jiffies64_to_cputime64(__jif) \
35 (__force cputime64_t)((__jif) * (NSEC_PER_SEC / HZ))
36
37
38/*
39 * Convert cputime <-> nanoseconds
40 */
41#define nsecs_to_cputime(__nsecs) ((__force u64)(__nsecs))
42
43
44/*
45 * Convert cputime <-> microseconds
46 */
47#define cputime_to_usecs(__ct) \
48 ((__force u64)(__ct) / NSEC_PER_USEC)
49#define usecs_to_cputime(__usecs) \
50 (__force cputime_t)((__usecs) * NSEC_PER_USEC)
51#define usecs_to_cputime64(__usecs) \
52 (__force cputime64_t)((__usecs) * NSEC_PER_USEC)
53
54/*
55 * Convert cputime <-> seconds
56 */
57#define cputime_to_secs(__ct) \
58 ((__force u64)(__ct) / NSEC_PER_SEC)
59#define secs_to_cputime(__secs) \
60 (__force cputime_t)((__secs) * NSEC_PER_SEC)
61
62/*
63 * Convert cputime <-> timespec (nsec)
64 */
65static inline cputime_t timespec_to_cputime(const struct timespec *val)
66{
67 u64 ret = val->tv_sec * NSEC_PER_SEC + val->tv_nsec;
68 return (__force cputime_t) ret;
69}
70static inline void cputime_to_timespec(const cputime_t ct, struct timespec *val)
71{
72 val->tv_sec = (__force u64) ct / NSEC_PER_SEC;
73 val->tv_nsec = (__force u64) ct % NSEC_PER_SEC;
74}
75
76/*
77 * Convert cputime <-> timeval (msec)
78 */
79static inline cputime_t timeval_to_cputime(struct timeval *val)
80{
81 u64 ret = val->tv_sec * NSEC_PER_SEC + val->tv_usec * NSEC_PER_USEC;
82 return (__force cputime_t) ret;
83}
84static inline void cputime_to_timeval(const cputime_t ct, struct timeval *val)
85{
86 val->tv_sec = (__force u64) ct / NSEC_PER_SEC;
87 val->tv_usec = ((__force u64) ct % NSEC_PER_SEC) / NSEC_PER_USEC;
88}
89
90/*
91 * Convert cputime <-> clock (USER_HZ)
92 */
93#define cputime_to_clock_t(__ct) \
94 ((__force u64)(__ct) / (NSEC_PER_SEC / USER_HZ))
95#define clock_t_to_cputime(__x) \
96 (__force cputime_t)((__x) * (NSEC_PER_SEC / USER_HZ))
97
98/*
99 * Convert cputime64 to clock.
100 */
101#define cputime64_to_clock_t(__ct) \
102 cputime_to_clock_t((__force cputime_t)__ct)
103
104#endif
diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
index 33bbbae4ddc6..8e260cf01351 100644
--- a/include/asm-generic/io.h
+++ b/include/asm-generic/io.h
@@ -53,8 +53,18 @@ static inline u32 __raw_readl(const volatile void __iomem *addr)
53#endif 53#endif
54 54
55#define readb __raw_readb 55#define readb __raw_readb
56#define readw(addr) __le16_to_cpu(__raw_readw(addr)) 56
57#define readl(addr) __le32_to_cpu(__raw_readl(addr)) 57#define readw readw
58static inline u16 readw(const volatile void __iomem *addr)
59{
60 return __le16_to_cpu(__raw_readw(addr));
61}
62
63#define readl readl
64static inline u32 readl(const volatile void __iomem *addr)
65{
66 return __le32_to_cpu(__raw_readl(addr));
67}
58 68
59#ifndef __raw_writeb 69#ifndef __raw_writeb
60static inline void __raw_writeb(u8 b, volatile void __iomem *addr) 70static inline void __raw_writeb(u8 b, volatile void __iomem *addr)
@@ -89,7 +99,11 @@ static inline u64 __raw_readq(const volatile void __iomem *addr)
89} 99}
90#endif 100#endif
91 101
92#define readq(addr) __le64_to_cpu(__raw_readq(addr)) 102#define readq readq
103static inline u64 readq(const volatile void __iomem *addr)
104{
105 return __le64_to_cpu(__raw_readq(addr));
106}
93 107
94#ifndef __raw_writeq 108#ifndef __raw_writeq
95static inline void __raw_writeq(u64 b, volatile void __iomem *addr) 109static inline void __raw_writeq(u64 b, volatile void __iomem *addr)
diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h
index 5cf680a98f9b..bfd87685fc1f 100644
--- a/include/asm-generic/pgtable.h
+++ b/include/asm-generic/pgtable.h
@@ -197,16 +197,6 @@ static inline int pmd_same(pmd_t pmd_a, pmd_t pmd_b)
197#endif /* CONFIG_TRANSPARENT_HUGEPAGE */ 197#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
198#endif 198#endif
199 199
200#ifndef __HAVE_ARCH_PAGE_TEST_AND_CLEAR_DIRTY
201#define page_test_and_clear_dirty(pfn, mapped) (0)
202#endif
203
204#ifndef __HAVE_ARCH_PAGE_TEST_AND_CLEAR_DIRTY
205#define pte_maybe_dirty(pte) pte_dirty(pte)
206#else
207#define pte_maybe_dirty(pte) (1)
208#endif
209
210#ifndef __HAVE_ARCH_PAGE_TEST_AND_CLEAR_YOUNG 200#ifndef __HAVE_ARCH_PAGE_TEST_AND_CLEAR_YOUNG
211#define page_test_and_clear_young(pfn) (0) 201#define page_test_and_clear_young(pfn) (0)
212#endif 202#endif
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index d1ea7ce0b4cb..afa12c7a025c 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -149,6 +149,33 @@
149#define TRACE_SYSCALLS() 149#define TRACE_SYSCALLS()
150#endif 150#endif
151 151
152#ifdef CONFIG_CLKSRC_OF
153#define CLKSRC_OF_TABLES() . = ALIGN(8); \
154 VMLINUX_SYMBOL(__clksrc_of_table) = .; \
155 *(__clksrc_of_table) \
156 *(__clksrc_of_table_end)
157#else
158#define CLKSRC_OF_TABLES()
159#endif
160
161#ifdef CONFIG_IRQCHIP
162#define IRQCHIP_OF_MATCH_TABLE() \
163 . = ALIGN(8); \
164 VMLINUX_SYMBOL(__irqchip_begin) = .; \
165 *(__irqchip_of_table) \
166 *(__irqchip_of_end)
167#else
168#define IRQCHIP_OF_MATCH_TABLE()
169#endif
170
171#ifdef CONFIG_COMMON_CLK
172#define CLK_OF_TABLES() . = ALIGN(8); \
173 VMLINUX_SYMBOL(__clk_of_table) = .; \
174 *(__clk_of_table) \
175 *(__clk_of_table_end)
176#else
177#define CLK_OF_TABLES()
178#endif
152 179
153#define KERNEL_DTB() \ 180#define KERNEL_DTB() \
154 STRUCT_ALIGN(); \ 181 STRUCT_ALIGN(); \
@@ -493,7 +520,10 @@
493 DEV_DISCARD(init.rodata) \ 520 DEV_DISCARD(init.rodata) \
494 CPU_DISCARD(init.rodata) \ 521 CPU_DISCARD(init.rodata) \
495 MEM_DISCARD(init.rodata) \ 522 MEM_DISCARD(init.rodata) \
496 KERNEL_DTB() 523 CLK_OF_TABLES() \
524 CLKSRC_OF_TABLES() \
525 KERNEL_DTB() \
526 IRQCHIP_OF_MATCH_TABLE()
497 527
498#define INIT_TEXT \ 528#define INIT_TEXT \
499 *(.init.text) \ 529 *(.init.text) \
diff --git a/include/clocksource/arm_arch_timer.h b/include/clocksource/arm_arch_timer.h
new file mode 100644
index 000000000000..2603267b1a29
--- /dev/null
+++ b/include/clocksource/arm_arch_timer.h
@@ -0,0 +1,63 @@
1/*
2 * Copyright (C) 2012 ARM Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16#ifndef __CLKSOURCE_ARM_ARCH_TIMER_H
17#define __CLKSOURCE_ARM_ARCH_TIMER_H
18
19#include <linux/clocksource.h>
20#include <linux/types.h>
21
22#define ARCH_TIMER_CTRL_ENABLE (1 << 0)
23#define ARCH_TIMER_CTRL_IT_MASK (1 << 1)
24#define ARCH_TIMER_CTRL_IT_STAT (1 << 2)
25
26#define ARCH_TIMER_REG_CTRL 0
27#define ARCH_TIMER_REG_TVAL 1
28
29#define ARCH_TIMER_PHYS_ACCESS 0
30#define ARCH_TIMER_VIRT_ACCESS 1
31
32#ifdef CONFIG_ARM_ARCH_TIMER
33
34extern int arch_timer_init(void);
35extern u32 arch_timer_get_rate(void);
36extern u64 (*arch_timer_read_counter)(void);
37extern struct timecounter *arch_timer_get_timecounter(void);
38
39#else
40
41static inline int arch_timer_init(void)
42{
43 return -ENXIO;
44}
45
46static inline u32 arch_timer_get_rate(void)
47{
48 return 0;
49}
50
51static inline u64 arch_timer_read_counter(void)
52{
53 return 0;
54}
55
56static inline struct timecounter *arch_timer_get_timecounter(void)
57{
58 return NULL;
59}
60
61#endif
62
63#endif
diff --git a/include/clocksource/arm_generic.h b/include/clocksource/arm_generic.h
deleted file mode 100644
index 5b41b0d27f0f..000000000000
--- a/include/clocksource/arm_generic.h
+++ /dev/null
@@ -1,21 +0,0 @@
1/*
2 * Copyright (C) 2012 ARM Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16#ifndef __CLKSOURCE_ARM_GENERIC_H
17#define __CLKSOURCE_ARM_GENERIC_H
18
19extern int arm_generic_timer_init(void);
20
21#endif
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 3994d7790b23..bcbdd7484e58 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -74,9 +74,10 @@ enum acpi_address_range_id {
74 74
75/* Table Handlers */ 75/* Table Handlers */
76 76
77typedef int (*acpi_table_handler) (struct acpi_table_header *table); 77typedef int (*acpi_tbl_table_handler)(struct acpi_table_header *table);
78 78
79typedef int (*acpi_table_entry_handler) (struct acpi_subtable_header *header, const unsigned long end); 79typedef int (*acpi_tbl_entry_handler)(struct acpi_subtable_header *header,
80 const unsigned long end);
80 81
81#ifdef CONFIG_ACPI_INITRD_TABLE_OVERRIDE 82#ifdef CONFIG_ACPI_INITRD_TABLE_OVERRIDE
82void acpi_initrd_override(void *data, size_t size); 83void acpi_initrd_override(void *data, size_t size);
@@ -95,10 +96,14 @@ int acpi_mps_check (void);
95int acpi_numa_init (void); 96int acpi_numa_init (void);
96 97
97int acpi_table_init (void); 98int acpi_table_init (void);
98int acpi_table_parse (char *id, acpi_table_handler handler); 99int acpi_table_parse(char *id, acpi_tbl_table_handler handler);
99int __init acpi_table_parse_entries(char *id, unsigned long table_size, 100int __init acpi_table_parse_entries(char *id, unsigned long table_size,
100 int entry_id, acpi_table_entry_handler handler, unsigned int max_entries); 101 int entry_id,
101int acpi_table_parse_madt (enum acpi_madt_type id, acpi_table_entry_handler handler, unsigned int max_entries); 102 acpi_tbl_entry_handler handler,
103 unsigned int max_entries);
104int acpi_table_parse_madt(enum acpi_madt_type id,
105 acpi_tbl_entry_handler handler,
106 unsigned int max_entries);
102int acpi_parse_mcfg (struct acpi_table_header *header); 107int acpi_parse_mcfg (struct acpi_table_header *header);
103void acpi_table_print_madt_entry (struct acpi_subtable_header *madt); 108void acpi_table_print_madt_entry (struct acpi_subtable_header *madt);
104 109
@@ -358,8 +363,7 @@ extern acpi_status acpi_pci_osc_control_set(acpi_handle handle,
358#if defined(CONFIG_ACPI_HOTPLUG_CPU) && \ 363#if defined(CONFIG_ACPI_HOTPLUG_CPU) && \
359 (defined(CONFIG_ACPI_HOTPLUG_MEMORY) || \ 364 (defined(CONFIG_ACPI_HOTPLUG_MEMORY) || \
360 defined(CONFIG_ACPI_HOTPLUG_MEMORY_MODULE)) && \ 365 defined(CONFIG_ACPI_HOTPLUG_MEMORY_MODULE)) && \
361 (defined(CONFIG_ACPI_CONTAINER) || \ 366 defined(CONFIG_ACPI_CONTAINER)
362 defined(CONFIG_ACPI_CONTAINER_MODULE))
363#define ACPI_HOTPLUG_OST 367#define ACPI_HOTPLUG_OST
364#endif 368#endif
365 369
@@ -511,7 +515,7 @@ static inline int acpi_subsys_runtime_suspend(struct device *dev) { return 0; }
511static inline int acpi_subsys_runtime_resume(struct device *dev) { return 0; } 515static inline int acpi_subsys_runtime_resume(struct device *dev) { return 0; }
512#endif 516#endif
513 517
514#ifdef CONFIG_ACPI_SLEEP 518#if defined(CONFIG_ACPI) && defined(CONFIG_PM_SLEEP)
515int acpi_dev_suspend_late(struct device *dev); 519int acpi_dev_suspend_late(struct device *dev);
516int acpi_dev_resume_early(struct device *dev); 520int acpi_dev_resume_early(struct device *dev);
517int acpi_subsys_prepare(struct device *dev); 521int acpi_subsys_prepare(struct device *dev);
@@ -526,9 +530,14 @@ static inline int acpi_subsys_resume_early(struct device *dev) { return 0; }
526#endif 530#endif
527 531
528#if defined(CONFIG_ACPI) && defined(CONFIG_PM) 532#if defined(CONFIG_ACPI) && defined(CONFIG_PM)
533struct acpi_device *acpi_dev_pm_get_node(struct device *dev);
529int acpi_dev_pm_attach(struct device *dev, bool power_on); 534int acpi_dev_pm_attach(struct device *dev, bool power_on);
530void acpi_dev_pm_detach(struct device *dev, bool power_off); 535void acpi_dev_pm_detach(struct device *dev, bool power_off);
531#else 536#else
537static inline struct acpi_device *acpi_dev_pm_get_node(struct device *dev)
538{
539 return NULL;
540}
532static inline int acpi_dev_pm_attach(struct device *dev, bool power_on) 541static inline int acpi_dev_pm_attach(struct device *dev, bool power_on)
533{ 542{
534 return -ENODEV; 543 return -ENODEV;
diff --git a/include/linux/aer.h b/include/linux/aer.h
index 544abdb2238c..ec10e1b24c1c 100644
--- a/include/linux/aer.h
+++ b/include/linux/aer.h
@@ -49,8 +49,8 @@ static inline int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev)
49} 49}
50#endif 50#endif
51 51
52extern void cper_print_aer(const char *prefix, int cper_severity, 52extern void cper_print_aer(const char *prefix, struct pci_dev *dev,
53 struct aer_capability_regs *aer); 53 int cper_severity, struct aer_capability_regs *aer);
54extern int cper_severity_to_aer(int cper_severity); 54extern int cper_severity_to_aer(int cper_severity);
55extern void aer_recover_queue(int domain, unsigned int bus, unsigned int devfn, 55extern void aer_recover_queue(int domain, unsigned int bus, unsigned int devfn,
56 int severity); 56 int severity);
diff --git a/include/linux/amba/sp810.h b/include/linux/amba/sp810.h
new file mode 100644
index 000000000000..6636430dd0e6
--- /dev/null
+++ b/include/linux/amba/sp810.h
@@ -0,0 +1,64 @@
1/*
2 * arch/arm/include/asm/hardware/sp810.h
3 *
4 * ARM PrimeXsys System Controller SP810 header file
5 *
6 * Copyright (C) 2009 ST Microelectronics
7 * Viresh Kumar <viresh.linux@gmail.com>
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
14#ifndef __ASM_ARM_SP810_H
15#define __ASM_ARM_SP810_H
16
17#include <linux/io.h>
18
19/* sysctl registers offset */
20#define SCCTRL 0x000
21#define SCSYSSTAT 0x004
22#define SCIMCTRL 0x008
23#define SCIMSTAT 0x00C
24#define SCXTALCTRL 0x010
25#define SCPLLCTRL 0x014
26#define SCPLLFCTRL 0x018
27#define SCPERCTRL0 0x01C
28#define SCPERCTRL1 0x020
29#define SCPEREN 0x024
30#define SCPERDIS 0x028
31#define SCPERCLKEN 0x02C
32#define SCPERSTAT 0x030
33#define SCSYSID0 0xEE0
34#define SCSYSID1 0xEE4
35#define SCSYSID2 0xEE8
36#define SCSYSID3 0xEEC
37#define SCITCR 0xF00
38#define SCITIR0 0xF04
39#define SCITIR1 0xF08
40#define SCITOR 0xF0C
41#define SCCNTCTRL 0xF10
42#define SCCNTDATA 0xF14
43#define SCCNTSTEP 0xF18
44#define SCPERIPHID0 0xFE0
45#define SCPERIPHID1 0xFE4
46#define SCPERIPHID2 0xFE8
47#define SCPERIPHID3 0xFEC
48#define SCPCELLID0 0xFF0
49#define SCPCELLID1 0xFF4
50#define SCPCELLID2 0xFF8
51#define SCPCELLID3 0xFFC
52
53#define SCCTRL_TIMERENnSEL_SHIFT(n) (15 + ((n) * 2))
54
55static inline void sysctl_soft_reset(void __iomem *base)
56{
57 /* switch to slow mode */
58 writel(0x2, base + SCCTRL);
59
60 /* writing any value to SCSYSSTAT reg will reset system */
61 writel(0, base + SCSYSSTAT);
62}
63
64#endif /* __ASM_ARM_SP810_H */
diff --git a/include/linux/async.h b/include/linux/async.h
index 7a24fe9b44b4..a2e3f18b2ad6 100644
--- a/include/linux/async.h
+++ b/include/linux/async.h
@@ -19,8 +19,7 @@ typedef u64 async_cookie_t;
19typedef void (async_func_ptr) (void *data, async_cookie_t cookie); 19typedef void (async_func_ptr) (void *data, async_cookie_t cookie);
20struct async_domain { 20struct async_domain {
21 struct list_head node; 21 struct list_head node;
22 struct list_head domain; 22 struct list_head pending;
23 int count;
24 unsigned registered:1; 23 unsigned registered:1;
25}; 24};
26 25
@@ -29,8 +28,7 @@ struct async_domain {
29 */ 28 */
30#define ASYNC_DOMAIN(_name) \ 29#define ASYNC_DOMAIN(_name) \
31 struct async_domain _name = { .node = LIST_HEAD_INIT(_name.node), \ 30 struct async_domain _name = { .node = LIST_HEAD_INIT(_name.node), \
32 .domain = LIST_HEAD_INIT(_name.domain), \ 31 .pending = LIST_HEAD_INIT(_name.pending), \
33 .count = 0, \
34 .registered = 1 } 32 .registered = 1 }
35 33
36/* 34/*
@@ -39,8 +37,7 @@ struct async_domain {
39 */ 37 */
40#define ASYNC_DOMAIN_EXCLUSIVE(_name) \ 38#define ASYNC_DOMAIN_EXCLUSIVE(_name) \
41 struct async_domain _name = { .node = LIST_HEAD_INIT(_name.node), \ 39 struct async_domain _name = { .node = LIST_HEAD_INIT(_name.node), \
42 .domain = LIST_HEAD_INIT(_name.domain), \ 40 .pending = LIST_HEAD_INIT(_name.pending), \
43 .count = 0, \
44 .registered = 0 } 41 .registered = 0 }
45 42
46extern async_cookie_t async_schedule(async_func_ptr *ptr, void *data); 43extern async_cookie_t async_schedule(async_func_ptr *ptr, void *data);
@@ -52,4 +49,5 @@ extern void async_synchronize_full_domain(struct async_domain *domain);
52extern void async_synchronize_cookie(async_cookie_t cookie); 49extern void async_synchronize_cookie(async_cookie_t cookie);
53extern void async_synchronize_cookie_domain(async_cookie_t cookie, 50extern void async_synchronize_cookie_domain(async_cookie_t cookie,
54 struct async_domain *domain); 51 struct async_domain *domain);
52extern bool current_is_async(void);
55#endif 53#endif
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h
index 12731a19ef06..350459910fe1 100644
--- a/include/linux/backing-dev.h
+++ b/include/linux/backing-dev.h
@@ -254,6 +254,7 @@ int bdi_set_max_ratio(struct backing_dev_info *bdi, unsigned int max_ratio);
254#define BDI_CAP_EXEC_MAP 0x00000040 254#define BDI_CAP_EXEC_MAP 0x00000040
255#define BDI_CAP_NO_ACCT_WB 0x00000080 255#define BDI_CAP_NO_ACCT_WB 0x00000080
256#define BDI_CAP_SWAP_BACKED 0x00000100 256#define BDI_CAP_SWAP_BACKED 0x00000100
257#define BDI_CAP_STABLE_WRITES 0x00000200
257 258
258#define BDI_CAP_VMFLAGS \ 259#define BDI_CAP_VMFLAGS \
259 (BDI_CAP_READ_MAP | BDI_CAP_WRITE_MAP | BDI_CAP_EXEC_MAP) 260 (BDI_CAP_READ_MAP | BDI_CAP_WRITE_MAP | BDI_CAP_EXEC_MAP)
@@ -308,6 +309,11 @@ long wait_iff_congested(struct zone *zone, int sync, long timeout);
308int pdflush_proc_obsolete(struct ctl_table *table, int write, 309int pdflush_proc_obsolete(struct ctl_table *table, int write,
309 void __user *buffer, size_t *lenp, loff_t *ppos); 310 void __user *buffer, size_t *lenp, loff_t *ppos);
310 311
312static inline bool bdi_cap_stable_pages_required(struct backing_dev_info *bdi)
313{
314 return bdi->capabilities & BDI_CAP_STABLE_WRITES;
315}
316
311static inline bool bdi_cap_writeback_dirty(struct backing_dev_info *bdi) 317static inline bool bdi_cap_writeback_dirty(struct backing_dev_info *bdi)
312{ 318{
313 return !(bdi->capabilities & BDI_CAP_NO_WRITEBACK); 319 return !(bdi->capabilities & BDI_CAP_NO_WRITEBACK);
diff --git a/include/linux/bcm2835_timer.h b/include/linux/bcm2835_timer.h
deleted file mode 100644
index 25680fe0903c..000000000000
--- a/include/linux/bcm2835_timer.h
+++ /dev/null
@@ -1,22 +0,0 @@
1/*
2 * Copyright 2012 Simon Arlott
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14
15#ifndef __BCM2835_TIMER_H
16#define __BCM2835_TIMER_H
17
18#include <asm/mach/time.h>
19
20extern struct sys_timer bcm2835_timer;
21
22#endif
diff --git a/include/linux/bcma/bcma_driver_chipcommon.h b/include/linux/bcma/bcma_driver_chipcommon.h
index 9a0e3fa3ca95..1d002b58b60b 100644
--- a/include/linux/bcma/bcma_driver_chipcommon.h
+++ b/include/linux/bcma/bcma_driver_chipcommon.h
@@ -27,7 +27,7 @@
27#define BCMA_CC_FLASHT_NONE 0x00000000 /* No flash */ 27#define BCMA_CC_FLASHT_NONE 0x00000000 /* No flash */
28#define BCMA_CC_FLASHT_STSER 0x00000100 /* ST serial flash */ 28#define BCMA_CC_FLASHT_STSER 0x00000100 /* ST serial flash */
29#define BCMA_CC_FLASHT_ATSER 0x00000200 /* Atmel serial flash */ 29#define BCMA_CC_FLASHT_ATSER 0x00000200 /* Atmel serial flash */
30#define BCMA_CC_FLASHT_NFLASH 0x00000200 /* NAND flash */ 30#define BCMA_CC_FLASHT_NAND 0x00000300 /* NAND flash */
31#define BCMA_CC_FLASHT_PARA 0x00000700 /* Parallel flash */ 31#define BCMA_CC_FLASHT_PARA 0x00000700 /* Parallel flash */
32#define BCMA_CC_CAP_PLLT 0x00038000 /* PLL Type */ 32#define BCMA_CC_CAP_PLLT 0x00038000 /* PLL Type */
33#define BCMA_PLLTYPE_NONE 0x00000000 33#define BCMA_PLLTYPE_NONE 0x00000000
@@ -634,4 +634,6 @@ extern void bcma_chipco_regctl_maskset(struct bcma_drv_cc *cc,
634 u32 offset, u32 mask, u32 set); 634 u32 offset, u32 mask, u32 set);
635extern void bcma_pmu_spuravoid_pllupdate(struct bcma_drv_cc *cc, int spuravoid); 635extern void bcma_pmu_spuravoid_pllupdate(struct bcma_drv_cc *cc, int spuravoid);
636 636
637extern u32 bcma_pmu_get_bus_clock(struct bcma_drv_cc *cc);
638
637#endif /* LINUX_BCMA_DRIVER_CC_H_ */ 639#endif /* LINUX_BCMA_DRIVER_CC_H_ */
diff --git a/include/linux/bcma/bcma_driver_mips.h b/include/linux/bcma/bcma_driver_mips.h
index 0baf8a56b794..fb61f3fb4ddb 100644
--- a/include/linux/bcma/bcma_driver_mips.h
+++ b/include/linux/bcma/bcma_driver_mips.h
@@ -28,6 +28,7 @@
28#define BCMA_MIPS_MIPS74K_GPIOEN 0x0048 28#define BCMA_MIPS_MIPS74K_GPIOEN 0x0048
29#define BCMA_MIPS_MIPS74K_CLKCTLST 0x01E0 29#define BCMA_MIPS_MIPS74K_CLKCTLST 0x01E0
30 30
31#define BCMA_MIPS_OOBSELINA74 0x004
31#define BCMA_MIPS_OOBSELOUTA30 0x100 32#define BCMA_MIPS_OOBSELOUTA30 0x100
32 33
33struct bcma_device; 34struct bcma_device;
@@ -36,19 +37,23 @@ struct bcma_drv_mips {
36 struct bcma_device *core; 37 struct bcma_device *core;
37 u8 setup_done:1; 38 u8 setup_done:1;
38 u8 early_setup_done:1; 39 u8 early_setup_done:1;
39 unsigned int assigned_irqs;
40}; 40};
41 41
42#ifdef CONFIG_BCMA_DRIVER_MIPS 42#ifdef CONFIG_BCMA_DRIVER_MIPS
43extern void bcma_core_mips_init(struct bcma_drv_mips *mcore); 43extern void bcma_core_mips_init(struct bcma_drv_mips *mcore);
44extern void bcma_core_mips_early_init(struct bcma_drv_mips *mcore); 44extern void bcma_core_mips_early_init(struct bcma_drv_mips *mcore);
45
46extern unsigned int bcma_core_irq(struct bcma_device *core);
45#else 47#else
46static inline void bcma_core_mips_init(struct bcma_drv_mips *mcore) { } 48static inline void bcma_core_mips_init(struct bcma_drv_mips *mcore) { }
47static inline void bcma_core_mips_early_init(struct bcma_drv_mips *mcore) { } 49static inline void bcma_core_mips_early_init(struct bcma_drv_mips *mcore) { }
50
51static inline unsigned int bcma_core_irq(struct bcma_device *core)
52{
53 return 0;
54}
48#endif 55#endif
49 56
50extern u32 bcma_cpu_clock(struct bcma_drv_mips *mcore); 57extern u32 bcma_cpu_clock(struct bcma_drv_mips *mcore);
51 58
52extern unsigned int bcma_core_mips_irq(struct bcma_device *dev);
53
54#endif /* LINUX_BCMA_DRIVER_MIPS_H_ */ 59#endif /* LINUX_BCMA_DRIVER_MIPS_H_ */
diff --git a/include/linux/bcma/bcma_driver_pci.h b/include/linux/bcma/bcma_driver_pci.h
index c48d98d27b77..424760f01b9d 100644
--- a/include/linux/bcma/bcma_driver_pci.h
+++ b/include/linux/bcma/bcma_driver_pci.h
@@ -179,6 +179,8 @@ struct pci_dev;
179#define BCMA_CORE_PCI_CFG_FUN_MASK 7 /* Function mask */ 179#define BCMA_CORE_PCI_CFG_FUN_MASK 7 /* Function mask */
180#define BCMA_CORE_PCI_CFG_OFF_MASK 0xfff /* Register mask */ 180#define BCMA_CORE_PCI_CFG_OFF_MASK 0xfff /* Register mask */
181 181
182#define BCMA_CORE_PCI_CFG_DEVCTRL 0xd8
183
182/* PCIE Root Capability Register bits (Host mode only) */ 184/* PCIE Root Capability Register bits (Host mode only) */
183#define BCMA_CORE_PCI_RC_CRS_VISIBILITY 0x0001 185#define BCMA_CORE_PCI_RC_CRS_VISIBILITY 0x0001
184 186
diff --git a/include/linux/bma150.h b/include/linux/bma150.h
index 7911fda23bb4..97ade7cdc870 100644
--- a/include/linux/bma150.h
+++ b/include/linux/bma150.h
@@ -22,6 +22,18 @@
22 22
23#define BMA150_DRIVER "bma150" 23#define BMA150_DRIVER "bma150"
24 24
25#define BMA150_RANGE_2G 0
26#define BMA150_RANGE_4G 1
27#define BMA150_RANGE_8G 2
28
29#define BMA150_BW_25HZ 0
30#define BMA150_BW_50HZ 1
31#define BMA150_BW_100HZ 2
32#define BMA150_BW_190HZ 3
33#define BMA150_BW_375HZ 4
34#define BMA150_BW_750HZ 5
35#define BMA150_BW_1500HZ 6
36
25struct bma150_cfg { 37struct bma150_cfg {
26 bool any_motion_int; /* Set to enable any-motion interrupt */ 38 bool any_motion_int; /* Set to enable any-motion interrupt */
27 bool hg_int; /* Set to enable high-G interrupt */ 39 bool hg_int; /* Set to enable high-G interrupt */
@@ -34,8 +46,8 @@ struct bma150_cfg {
34 unsigned char lg_hyst; /* Low-G hysterisis */ 46 unsigned char lg_hyst; /* Low-G hysterisis */
35 unsigned char lg_dur; /* Low-G duration */ 47 unsigned char lg_dur; /* Low-G duration */
36 unsigned char lg_thres; /* Low-G threshold */ 48 unsigned char lg_thres; /* Low-G threshold */
37 unsigned char range; /* BMA0150_RANGE_xxx (in G) */ 49 unsigned char range; /* one of BMA0150_RANGE_xxx */
38 unsigned char bandwidth; /* BMA0150_BW_xxx (in Hz) */ 50 unsigned char bandwidth; /* one of BMA0150_BW_xxx */
39}; 51};
40 52
41struct bma150_platform_data { 53struct bma150_platform_data {
diff --git a/include/linux/bug.h b/include/linux/bug.h
index b1cf40de847e..7f4818673c41 100644
--- a/include/linux/bug.h
+++ b/include/linux/bug.h
@@ -2,6 +2,7 @@
2#define _LINUX_BUG_H 2#define _LINUX_BUG_H
3 3
4#include <asm/bug.h> 4#include <asm/bug.h>
5#include <linux/compiler.h>
5 6
6enum bug_trap_type { 7enum bug_trap_type {
7 BUG_TRAP_TYPE_NONE = 0, 8 BUG_TRAP_TYPE_NONE = 0,
@@ -12,11 +13,12 @@ enum bug_trap_type {
12struct pt_regs; 13struct pt_regs;
13 14
14#ifdef __CHECKER__ 15#ifdef __CHECKER__
15#define BUILD_BUG_ON_NOT_POWER_OF_2(n) 16#define BUILD_BUG_ON_NOT_POWER_OF_2(n) (0)
16#define BUILD_BUG_ON_ZERO(e) (0) 17#define BUILD_BUG_ON_ZERO(e) (0)
17#define BUILD_BUG_ON_NULL(e) ((void*)0) 18#define BUILD_BUG_ON_NULL(e) ((void*)0)
18#define BUILD_BUG_ON_INVALID(e) (0) 19#define BUILD_BUG_ON_INVALID(e) (0)
19#define BUILD_BUG_ON(condition) 20#define BUILD_BUG_ON_MSG(cond, msg) (0)
21#define BUILD_BUG_ON(condition) (0)
20#define BUILD_BUG() (0) 22#define BUILD_BUG() (0)
21#else /* __CHECKER__ */ 23#else /* __CHECKER__ */
22 24
@@ -39,29 +41,37 @@ struct pt_regs;
39#define BUILD_BUG_ON_INVALID(e) ((void)(sizeof((__force long)(e)))) 41#define BUILD_BUG_ON_INVALID(e) ((void)(sizeof((__force long)(e))))
40 42
41/** 43/**
44 * BUILD_BUG_ON_MSG - break compile if a condition is true & emit supplied
45 * error message.
46 * @condition: the condition which the compiler should know is false.
47 *
48 * See BUILD_BUG_ON for description.
49 */
50#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
51
52/**
42 * BUILD_BUG_ON - break compile if a condition is true. 53 * BUILD_BUG_ON - break compile if a condition is true.
43 * @condition: the condition which the compiler should know is false. 54 * @condition: the condition which the compiler should know is false.
44 * 55 *
45 * If you have some code which relies on certain constants being equal, or 56 * If you have some code which relies on certain constants being equal, or
46 * other compile-time-evaluated condition, you should use BUILD_BUG_ON to 57 * some other compile-time-evaluated condition, you should use BUILD_BUG_ON to
47 * detect if someone changes it. 58 * detect if someone changes it.
48 * 59 *
49 * The implementation uses gcc's reluctance to create a negative array, but 60 * The implementation uses gcc's reluctance to create a negative array, but gcc
50 * gcc (as of 4.4) only emits that error for obvious cases (eg. not arguments 61 * (as of 4.4) only emits that error for obvious cases (e.g. not arguments to
51 * to inline functions). So as a fallback we use the optimizer; if it can't 62 * inline functions). Luckily, in 4.3 they added the "error" function
52 * prove the condition is false, it will cause a link error on the undefined 63 * attribute just for this type of case. Thus, we use a negative sized array
53 * "__build_bug_on_failed". This error message can be harder to track down 64 * (should always create an error on gcc versions older than 4.4) and then call
54 * though, hence the two different methods. 65 * an undefined function with the error attribute (should always create an
66 * error on gcc 4.3 and later). If for some reason, neither creates a
67 * compile-time error, we'll still have a link-time error, which is harder to
68 * track down.
55 */ 69 */
56#ifndef __OPTIMIZE__ 70#ifndef __OPTIMIZE__
57#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)])) 71#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
58#else 72#else
59extern int __build_bug_on_failed; 73#define BUILD_BUG_ON(condition) \
60#define BUILD_BUG_ON(condition) \ 74 BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
61 do { \
62 ((void)sizeof(char[1 - 2*!!(condition)])); \
63 if (condition) __build_bug_on_failed = 1; \
64 } while(0)
65#endif 75#endif
66 76
67/** 77/**
@@ -71,12 +81,7 @@ extern int __build_bug_on_failed;
71 * build time, you should use BUILD_BUG to detect if it is 81 * build time, you should use BUILD_BUG to detect if it is
72 * unexpectedly used. 82 * unexpectedly used.
73 */ 83 */
74#define BUILD_BUG() \ 84#define BUILD_BUG() BUILD_BUG_ON_MSG(1, "BUILD_BUG failed")
75 do { \
76 extern void __build_bug_failed(void) \
77 __linktime_error("BUILD_BUG failed"); \
78 __build_bug_failed(); \
79 } while (0)
80 85
81#endif /* __CHECKER__ */ 86#endif /* __CHECKER__ */
82 87
diff --git a/include/linux/can/dev.h b/include/linux/can/dev.h
index 2b2fc345afca..fb0ab651a041 100644
--- a/include/linux/can/dev.h
+++ b/include/linux/can/dev.h
@@ -16,6 +16,7 @@
16#include <linux/can.h> 16#include <linux/can.h>
17#include <linux/can/netlink.h> 17#include <linux/can/netlink.h>
18#include <linux/can/error.h> 18#include <linux/can/error.h>
19#include <linux/can/led.h>
19 20
20/* 21/*
21 * CAN mode 22 * CAN mode
@@ -52,6 +53,13 @@ struct can_priv {
52 53
53 unsigned int echo_skb_max; 54 unsigned int echo_skb_max;
54 struct sk_buff **echo_skb; 55 struct sk_buff **echo_skb;
56
57#ifdef CONFIG_CAN_LEDS
58 struct led_trigger *tx_led_trig;
59 char tx_led_trig_name[CAN_LED_NAME_SZ];
60 struct led_trigger *rx_led_trig;
61 char rx_led_trig_name[CAN_LED_NAME_SZ];
62#endif
55}; 63};
56 64
57/* 65/*
@@ -98,6 +106,9 @@ u8 can_len2dlc(u8 len);
98struct net_device *alloc_candev(int sizeof_priv, unsigned int echo_skb_max); 106struct net_device *alloc_candev(int sizeof_priv, unsigned int echo_skb_max);
99void free_candev(struct net_device *dev); 107void free_candev(struct net_device *dev);
100 108
109/* a candev safe wrapper around netdev_priv */
110struct can_priv *safe_candev_priv(struct net_device *dev);
111
101int open_candev(struct net_device *dev); 112int open_candev(struct net_device *dev);
102void close_candev(struct net_device *dev); 113void close_candev(struct net_device *dev);
103 114
diff --git a/include/linux/can/led.h b/include/linux/can/led.h
new file mode 100644
index 000000000000..9c1167baf273
--- /dev/null
+++ b/include/linux/can/led.h
@@ -0,0 +1,51 @@
1/*
2 * Copyright 2012, Fabio Baltieri <fabio.baltieri@gmail.com>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#ifndef CAN_LED_H
10#define CAN_LED_H
11
12#include <linux/if.h>
13#include <linux/leds.h>
14
15enum can_led_event {
16 CAN_LED_EVENT_OPEN,
17 CAN_LED_EVENT_STOP,
18 CAN_LED_EVENT_TX,
19 CAN_LED_EVENT_RX,
20};
21
22#ifdef CONFIG_CAN_LEDS
23
24/* keep space for interface name + "-tx"/"-rx" suffix and null terminator */
25#define CAN_LED_NAME_SZ (IFNAMSIZ + 4)
26
27void can_led_event(struct net_device *netdev, enum can_led_event event);
28void devm_can_led_init(struct net_device *netdev);
29int __init can_led_notifier_init(void);
30void __exit can_led_notifier_exit(void);
31
32#else
33
34static inline void can_led_event(struct net_device *netdev,
35 enum can_led_event event)
36{
37}
38static inline void devm_can_led_init(struct net_device *netdev)
39{
40}
41static inline int can_led_notifier_init(void)
42{
43 return 0;
44}
45static inline void can_led_notifier_exit(void)
46{
47}
48
49#endif
50
51#endif
diff --git a/include/linux/can/skb.h b/include/linux/can/skb.h
new file mode 100644
index 000000000000..2f0543f7510c
--- /dev/null
+++ b/include/linux/can/skb.h
@@ -0,0 +1,45 @@
1/*
2 * linux/can/skb.h
3 *
4 * Definitions for the CAN network socket buffer
5 *
6 * Copyright (C) 2012 Oliver Hartkopp <socketcan@hartkopp.net>
7 *
8 */
9
10#ifndef CAN_SKB_H
11#define CAN_SKB_H
12
13#include <linux/types.h>
14#include <linux/can.h>
15
16/*
17 * The struct can_skb_priv is used to transport additional information along
18 * with the stored struct can(fd)_frame that can not be contained in existing
19 * struct sk_buff elements.
20 * N.B. that this information must not be modified in cloned CAN sk_buffs.
21 * To modify the CAN frame content or the struct can_skb_priv content
22 * skb_copy() needs to be used instead of skb_clone().
23 */
24
25/**
26 * struct can_skb_priv - private additional data inside CAN sk_buffs
27 * @ifindex: ifindex of the first interface the CAN frame appeared on
28 * @cf: align to the following CAN frame at skb->data
29 */
30struct can_skb_priv {
31 int ifindex;
32 struct can_frame cf[0];
33};
34
35static inline struct can_skb_priv *can_skb_prv(struct sk_buff *skb)
36{
37 return (struct can_skb_priv *)(skb->head);
38}
39
40static inline void can_skb_reserve(struct sk_buff *skb)
41{
42 skb_reserve(skb, sizeof(struct can_skb_priv));
43}
44
45#endif /* CAN_SKB_H */
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index 7d73905dcba2..900af5964f55 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -203,6 +203,7 @@ struct cgroup {
203 203
204 /* For RCU-protected deletion */ 204 /* For RCU-protected deletion */
205 struct rcu_head rcu_head; 205 struct rcu_head rcu_head;
206 struct work_struct free_work;
206 207
207 /* List of events which userspace want to receive */ 208 /* List of events which userspace want to receive */
208 struct list_head event_list; 209 struct list_head event_list;
@@ -558,6 +559,7 @@ static inline struct cgroup* task_cgroup(struct task_struct *task,
558 559
559struct cgroup *cgroup_next_descendant_pre(struct cgroup *pos, 560struct cgroup *cgroup_next_descendant_pre(struct cgroup *pos,
560 struct cgroup *cgroup); 561 struct cgroup *cgroup);
562struct cgroup *cgroup_rightmost_descendant(struct cgroup *pos);
561 563
562/** 564/**
563 * cgroup_for_each_descendant_pre - pre-order walk of a cgroup's descendants 565 * cgroup_for_each_descendant_pre - pre-order walk of a cgroup's descendants
@@ -706,7 +708,6 @@ struct cgroup_subsys_state *cgroup_css_from_dir(struct file *f, int id);
706static inline int cgroup_init_early(void) { return 0; } 708static inline int cgroup_init_early(void) { return 0; }
707static inline int cgroup_init(void) { return 0; } 709static inline int cgroup_init(void) { return 0; }
708static inline void cgroup_fork(struct task_struct *p) {} 710static inline void cgroup_fork(struct task_struct *p) {}
709static inline void cgroup_fork_callbacks(struct task_struct *p) {}
710static inline void cgroup_post_fork(struct task_struct *p) {} 711static inline void cgroup_post_fork(struct task_struct *p) {}
711static inline void cgroup_exit(struct task_struct *p, int callbacks) {} 712static inline void cgroup_exit(struct task_struct *p, int callbacks) {}
712 713
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
index 4989b8a7bed1..7f197d7addb0 100644
--- a/include/linux/clk-provider.h
+++ b/include/linux/clk-provider.h
@@ -379,7 +379,13 @@ struct clk_onecell_data {
379}; 379};
380struct clk *of_clk_src_onecell_get(struct of_phandle_args *clkspec, void *data); 380struct clk *of_clk_src_onecell_get(struct of_phandle_args *clkspec, void *data);
381const char *of_clk_get_parent_name(struct device_node *np, int index); 381const char *of_clk_get_parent_name(struct device_node *np, int index);
382
382void of_clk_init(const struct of_device_id *matches); 383void of_clk_init(const struct of_device_id *matches);
383 384
385#define CLK_OF_DECLARE(name, compat, fn) \
386 static const struct of_device_id __clk_of_table_##name \
387 __used __section(__clk_of_table) \
388 = { .compatible = compat, .data = fn };
389
384#endif /* CONFIG_COMMON_CLK */ 390#endif /* CONFIG_COMMON_CLK */
385#endif /* CLK_PROVIDER_H */ 391#endif /* CLK_PROVIDER_H */
diff --git a/include/linux/clk/sunxi.h b/include/linux/clk/sunxi.h
deleted file mode 100644
index e074fdd5a236..000000000000
--- a/include/linux/clk/sunxi.h
+++ /dev/null
@@ -1,22 +0,0 @@
1/*
2 * Copyright 2012 Maxime Ripard
3 *
4 * Maxime Ripard <maxime.ripard@free-electrons.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 */
16
17#ifndef __LINUX_CLK_SUNXI_H_
18#define __LINUX_CLK_SUNXI_H_
19
20void __init sunxi_init_clocks(void);
21
22#endif
diff --git a/include/linux/clk/tegra.h b/include/linux/clk/tegra.h
new file mode 100644
index 000000000000..404d6f940872
--- /dev/null
+++ b/include/linux/clk/tegra.h
@@ -0,0 +1,127 @@
1/*
2 * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#ifndef __LINUX_CLK_TEGRA_H_
18#define __LINUX_CLK_TEGRA_H_
19
20#include <linux/clk.h>
21
22/*
23 * Tegra CPU clock and reset control ops
24 *
25 * wait_for_reset:
26 * keep waiting until the CPU in reset state
27 * put_in_reset:
28 * put the CPU in reset state
29 * out_of_reset:
30 * release the CPU from reset state
31 * enable_clock:
32 * CPU clock un-gate
33 * disable_clock:
34 * CPU clock gate
35 * rail_off_ready:
36 * CPU is ready for rail off
37 * suspend:
38 * save the clock settings when CPU go into low-power state
39 * resume:
40 * restore the clock settings when CPU exit low-power state
41 */
42struct tegra_cpu_car_ops {
43 void (*wait_for_reset)(u32 cpu);
44 void (*put_in_reset)(u32 cpu);
45 void (*out_of_reset)(u32 cpu);
46 void (*enable_clock)(u32 cpu);
47 void (*disable_clock)(u32 cpu);
48#ifdef CONFIG_PM_SLEEP
49 bool (*rail_off_ready)(void);
50 void (*suspend)(void);
51 void (*resume)(void);
52#endif
53};
54
55extern struct tegra_cpu_car_ops *tegra_cpu_car_ops;
56
57static inline void tegra_wait_cpu_in_reset(u32 cpu)
58{
59 if (WARN_ON(!tegra_cpu_car_ops->wait_for_reset))
60 return;
61
62 tegra_cpu_car_ops->wait_for_reset(cpu);
63}
64
65static inline void tegra_put_cpu_in_reset(u32 cpu)
66{
67 if (WARN_ON(!tegra_cpu_car_ops->put_in_reset))
68 return;
69
70 tegra_cpu_car_ops->put_in_reset(cpu);
71}
72
73static inline void tegra_cpu_out_of_reset(u32 cpu)
74{
75 if (WARN_ON(!tegra_cpu_car_ops->out_of_reset))
76 return;
77
78 tegra_cpu_car_ops->out_of_reset(cpu);
79}
80
81static inline void tegra_enable_cpu_clock(u32 cpu)
82{
83 if (WARN_ON(!tegra_cpu_car_ops->enable_clock))
84 return;
85
86 tegra_cpu_car_ops->enable_clock(cpu);
87}
88
89static inline void tegra_disable_cpu_clock(u32 cpu)
90{
91 if (WARN_ON(!tegra_cpu_car_ops->disable_clock))
92 return;
93
94 tegra_cpu_car_ops->disable_clock(cpu);
95}
96
97#ifdef CONFIG_PM_SLEEP
98static inline bool tegra_cpu_rail_off_ready(void)
99{
100 if (WARN_ON(!tegra_cpu_car_ops->rail_off_ready))
101 return false;
102
103 return tegra_cpu_car_ops->rail_off_ready();
104}
105
106static inline void tegra_cpu_clock_suspend(void)
107{
108 if (WARN_ON(!tegra_cpu_car_ops->suspend))
109 return;
110
111 tegra_cpu_car_ops->suspend();
112}
113
114static inline void tegra_cpu_clock_resume(void)
115{
116 if (WARN_ON(!tegra_cpu_car_ops->resume))
117 return;
118
119 tegra_cpu_car_ops->resume();
120}
121#endif
122
123void tegra_periph_reset_deassert(struct clk *c);
124void tegra_periph_reset_assert(struct clk *c);
125void tegra_clocks_init(void);
126
127#endif /* __LINUX_CLK_TEGRA_H_ */
diff --git a/include/linux/clockchips.h b/include/linux/clockchips.h
index 8a7096fcb01e..66346521cb65 100644
--- a/include/linux/clockchips.h
+++ b/include/linux/clockchips.h
@@ -161,6 +161,15 @@ clockevents_calc_mult_shift(struct clock_event_device *ce, u32 freq, u32 minsec)
161extern void clockevents_suspend(void); 161extern void clockevents_suspend(void);
162extern void clockevents_resume(void); 162extern void clockevents_resume(void);
163 163
164#ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST
165#ifdef CONFIG_ARCH_HAS_TICK_BROADCAST
166extern void tick_broadcast(const struct cpumask *mask);
167#else
168#define tick_broadcast NULL
169#endif
170extern int tick_receive_broadcast(void);
171#endif
172
164#ifdef CONFIG_GENERIC_CLOCKEVENTS 173#ifdef CONFIG_GENERIC_CLOCKEVENTS
165extern void clockevents_notify(unsigned long reason, void *arg); 174extern void clockevents_notify(unsigned long reason, void *arg);
166#else 175#else
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index 4dceaf8ae152..27cfda427dd9 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -332,4 +332,15 @@ extern int clocksource_mmio_init(void __iomem *, const char *,
332 332
333extern int clocksource_i8253_init(void); 333extern int clocksource_i8253_init(void);
334 334
335#ifdef CONFIG_CLKSRC_OF
336extern void clocksource_of_init(void);
337
338#define CLOCKSOURCE_OF_DECLARE(name, compat, fn) \
339 static const struct of_device_id __clksrc_of_table_##name \
340 __used __section(__clksrc_of_table) \
341 = { .compatible = compat, .data = fn };
342#else
343#define CLOCKSOURCE_OF_DECLARE(name, compat, fn)
344#endif
345
335#endif /* _LINUX_CLOCKSOURCE_H */ 346#endif /* _LINUX_CLOCKSOURCE_H */
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
index 6a6d7aefe12d..24545cd90a25 100644
--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc.h
@@ -5,6 +5,9 @@
5/* 5/*
6 * Common definitions for all gcc versions go here. 6 * Common definitions for all gcc versions go here.
7 */ 7 */
8#define GCC_VERSION (__GNUC__ * 10000 \
9 + __GNUC_MINOR__ * 100 \
10 + __GNUC_PATCHLEVEL__)
8 11
9 12
10/* Optimization barrier */ 13/* Optimization barrier */
diff --git a/include/linux/compiler-gcc3.h b/include/linux/compiler-gcc3.h
index 37d412436d0f..7d89febe4d79 100644
--- a/include/linux/compiler-gcc3.h
+++ b/include/linux/compiler-gcc3.h
@@ -2,22 +2,22 @@
2#error "Please don't include <linux/compiler-gcc3.h> directly, include <linux/compiler.h> instead." 2#error "Please don't include <linux/compiler-gcc3.h> directly, include <linux/compiler.h> instead."
3#endif 3#endif
4 4
5#if __GNUC_MINOR__ < 2 5#if GCC_VERSION < 30200
6# error Sorry, your compiler is too old - please upgrade it. 6# error Sorry, your compiler is too old - please upgrade it.
7#endif 7#endif
8 8
9#if __GNUC_MINOR__ >= 3 9#if GCC_VERSION >= 30300
10# define __used __attribute__((__used__)) 10# define __used __attribute__((__used__))
11#else 11#else
12# define __used __attribute__((__unused__)) 12# define __used __attribute__((__unused__))
13#endif 13#endif
14 14
15#if __GNUC_MINOR__ >= 4 15#if GCC_VERSION >= 30400
16#define __must_check __attribute__((warn_unused_result)) 16#define __must_check __attribute__((warn_unused_result))
17#endif 17#endif
18 18
19#ifdef CONFIG_GCOV_KERNEL 19#ifdef CONFIG_GCOV_KERNEL
20# if __GNUC_MINOR__ < 4 20# if GCC_VERSION < 30400
21# error "GCOV profiling support for gcc versions below 3.4 not included" 21# error "GCOV profiling support for gcc versions below 3.4 not included"
22# endif /* __GNUC_MINOR__ */ 22# endif /* __GNUC_MINOR__ */
23#endif /* CONFIG_GCOV_KERNEL */ 23#endif /* CONFIG_GCOV_KERNEL */
diff --git a/include/linux/compiler-gcc4.h b/include/linux/compiler-gcc4.h
index 662fd1b4c42a..68b162d92254 100644
--- a/include/linux/compiler-gcc4.h
+++ b/include/linux/compiler-gcc4.h
@@ -4,7 +4,7 @@
4 4
5/* GCC 4.1.[01] miscompiles __weak */ 5/* GCC 4.1.[01] miscompiles __weak */
6#ifdef __KERNEL__ 6#ifdef __KERNEL__
7# if __GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ <= 1 7# if GCC_VERSION >= 40100 && GCC_VERSION <= 40101
8# error Your version of gcc miscompiles the __weak directive 8# error Your version of gcc miscompiles the __weak directive
9# endif 9# endif
10#endif 10#endif
@@ -13,7 +13,11 @@
13#define __must_check __attribute__((warn_unused_result)) 13#define __must_check __attribute__((warn_unused_result))
14#define __compiler_offsetof(a,b) __builtin_offsetof(a,b) 14#define __compiler_offsetof(a,b) __builtin_offsetof(a,b)
15 15
16#if __GNUC_MINOR__ >= 3 16#if GCC_VERSION >= 40100
17# define __compiletime_object_size(obj) __builtin_object_size(obj, 0)
18#endif
19
20#if GCC_VERSION >= 40300
17/* Mark functions as cold. gcc will assume any path leading to a call 21/* Mark functions as cold. gcc will assume any path leading to a call
18 to them will be unlikely. This means a lot of manual unlikely()s 22 to them will be unlikely. This means a lot of manual unlikely()s
19 are unnecessary now for any paths leading to the usual suspects 23 are unnecessary now for any paths leading to the usual suspects
@@ -29,11 +33,15 @@
29 the kernel context */ 33 the kernel context */
30#define __cold __attribute__((__cold__)) 34#define __cold __attribute__((__cold__))
31 35
32#define __linktime_error(message) __attribute__((__error__(message)))
33
34#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__) 36#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
35 37
36#if __GNUC_MINOR__ >= 5 38#ifndef __CHECKER__
39# define __compiletime_warning(message) __attribute__((warning(message)))
40# define __compiletime_error(message) __attribute__((error(message)))
41#endif /* __CHECKER__ */
42#endif /* GCC_VERSION >= 40300 */
43
44#if GCC_VERSION >= 40500
37/* 45/*
38 * Mark a position in code as unreachable. This can be used to 46 * Mark a position in code as unreachable. This can be used to
39 * suppress control flow warnings after asm blocks that transfer 47 * suppress control flow warnings after asm blocks that transfer
@@ -48,30 +56,22 @@
48/* Mark a function definition as prohibited from being cloned. */ 56/* Mark a function definition as prohibited from being cloned. */
49#define __noclone __attribute__((__noclone__)) 57#define __noclone __attribute__((__noclone__))
50 58
51#endif 59#endif /* GCC_VERSION >= 40500 */
52#endif
53 60
54#if __GNUC_MINOR__ >= 6 61#if GCC_VERSION >= 40600
55/* 62/*
56 * Tell the optimizer that something else uses this function or variable. 63 * Tell the optimizer that something else uses this function or variable.
57 */ 64 */
58#define __visible __attribute__((externally_visible)) 65#define __visible __attribute__((externally_visible))
59#endif 66#endif
60 67
61#if __GNUC_MINOR__ > 0
62#define __compiletime_object_size(obj) __builtin_object_size(obj, 0)
63#endif
64#if __GNUC_MINOR__ >= 3 && !defined(__CHECKER__)
65#define __compiletime_warning(message) __attribute__((warning(message)))
66#define __compiletime_error(message) __attribute__((error(message)))
67#endif
68 68
69#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP 69#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP
70#if __GNUC_MINOR__ >= 4 70#if GCC_VERSION >= 40400
71#define __HAVE_BUILTIN_BSWAP32__ 71#define __HAVE_BUILTIN_BSWAP32__
72#define __HAVE_BUILTIN_BSWAP64__ 72#define __HAVE_BUILTIN_BSWAP64__
73#endif 73#endif
74#if __GNUC_MINOR__ >= 8 || (defined(__powerpc__) && __GNUC_MINOR__ >= 6) 74#if GCC_VERSION >= 40800 || (defined(__powerpc__) && GCC_VERSION >= 40600)
75#define __HAVE_BUILTIN_BSWAP16__ 75#define __HAVE_BUILTIN_BSWAP16__
76#endif 76#endif
77#endif 77#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index dd852b73b286..10b8f23fab0f 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -307,10 +307,36 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect);
307#endif 307#endif
308#ifndef __compiletime_error 308#ifndef __compiletime_error
309# define __compiletime_error(message) 309# define __compiletime_error(message)
310# define __compiletime_error_fallback(condition) \
311 do { ((void)sizeof(char[1 - 2 * condition])); } while (0)
312#else
313# define __compiletime_error_fallback(condition) do { } while (0)
310#endif 314#endif
311#ifndef __linktime_error 315
312# define __linktime_error(message) 316#define __compiletime_assert(condition, msg, prefix, suffix) \
313#endif 317 do { \
318 bool __cond = !(condition); \
319 extern void prefix ## suffix(void) __compiletime_error(msg); \
320 if (__cond) \
321 prefix ## suffix(); \
322 __compiletime_error_fallback(__cond); \
323 } while (0)
324
325#define _compiletime_assert(condition, msg, prefix, suffix) \
326 __compiletime_assert(condition, msg, prefix, suffix)
327
328/**
329 * compiletime_assert - break build and emit msg if condition is false
330 * @condition: a compile-time constant condition to check
331 * @msg: a message to emit if condition is false
332 *
333 * In tradition of POSIX assert, this macro will break the build if the
334 * supplied condition is *false*, emitting the supplied error message if the
335 * compiler has support to do so.
336 */
337#define compiletime_assert(condition, msg) \
338 _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
339
314/* 340/*
315 * Prevent the compiler from merging or refetching accesses. The compiler 341 * Prevent the compiler from merging or refetching accesses. The compiler
316 * is also forbidden from reordering successive instances of ACCESS_ONCE(), 342 * is also forbidden from reordering successive instances of ACCESS_ONCE(),
diff --git a/include/linux/console.h b/include/linux/console.h
index dedb082fe50f..3b709da1786e 100644
--- a/include/linux/console.h
+++ b/include/linux/console.h
@@ -157,7 +157,12 @@ extern int is_console_locked(void);
157extern int braille_register_console(struct console *, int index, 157extern int braille_register_console(struct console *, int index,
158 char *console_options, char *braille_options); 158 char *console_options, char *braille_options);
159extern int braille_unregister_console(struct console *); 159extern int braille_unregister_console(struct console *);
160#ifdef CONFIG_TTY
160extern void console_sysfs_notify(void); 161extern void console_sysfs_notify(void);
162#else
163static inline void console_sysfs_notify(void)
164{ }
165#endif
161extern bool console_suspend_enabled; 166extern bool console_suspend_enabled;
162 167
163/* Suspend and resume console messages over PM events */ 168/* Suspend and resume console messages over PM events */
diff --git a/include/linux/context_tracking.h b/include/linux/context_tracking.h
index e24339ccb7f0..b28d161c1091 100644
--- a/include/linux/context_tracking.h
+++ b/include/linux/context_tracking.h
@@ -3,12 +3,40 @@
3 3
4#ifdef CONFIG_CONTEXT_TRACKING 4#ifdef CONFIG_CONTEXT_TRACKING
5#include <linux/sched.h> 5#include <linux/sched.h>
6#include <linux/percpu.h>
7
8struct context_tracking {
9 /*
10 * When active is false, probes are unset in order
11 * to minimize overhead: TIF flags are cleared
12 * and calls to user_enter/exit are ignored. This
13 * may be further optimized using static keys.
14 */
15 bool active;
16 enum {
17 IN_KERNEL = 0,
18 IN_USER,
19 } state;
20};
21
22DECLARE_PER_CPU(struct context_tracking, context_tracking);
23
24static inline bool context_tracking_in_user(void)
25{
26 return __this_cpu_read(context_tracking.state) == IN_USER;
27}
28
29static inline bool context_tracking_active(void)
30{
31 return __this_cpu_read(context_tracking.active);
32}
6 33
7extern void user_enter(void); 34extern void user_enter(void);
8extern void user_exit(void); 35extern void user_exit(void);
9extern void context_tracking_task_switch(struct task_struct *prev, 36extern void context_tracking_task_switch(struct task_struct *prev,
10 struct task_struct *next); 37 struct task_struct *next);
11#else 38#else
39static inline bool context_tracking_in_user(void) { return false; }
12static inline void user_enter(void) { } 40static inline void user_enter(void) { }
13static inline void user_exit(void) { } 41static inline void user_exit(void) { }
14static inline void context_tracking_task_switch(struct task_struct *prev, 42static inline void context_tracking_task_switch(struct task_struct *prev,
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index a55b88eaf96a..a22944ca0526 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -89,11 +89,15 @@ struct cpufreq_real_policy {
89}; 89};
90 90
91struct cpufreq_policy { 91struct cpufreq_policy {
92 cpumask_var_t cpus; /* CPUs requiring sw coordination */ 92 /* CPUs sharing clock, require sw coordination */
93 cpumask_var_t related_cpus; /* CPUs with any coordination */ 93 cpumask_var_t cpus; /* Online CPUs only */
94 unsigned int shared_type; /* ANY or ALL affected CPUs 94 cpumask_var_t related_cpus; /* Online + Offline CPUs */
95
96 unsigned int shared_type; /* ACPI: ANY or ALL affected CPUs
95 should set cpufreq */ 97 should set cpufreq */
96 unsigned int cpu; /* cpu nr of registered CPU */ 98 unsigned int cpu; /* cpu nr of CPU managing this policy */
99 unsigned int last_cpu; /* cpu nr of previous CPU that managed
100 * this policy */
97 struct cpufreq_cpuinfo cpuinfo;/* see above */ 101 struct cpufreq_cpuinfo cpuinfo;/* see above */
98 102
99 unsigned int min; /* in kHz */ 103 unsigned int min; /* in kHz */
@@ -112,16 +116,23 @@ struct cpufreq_policy {
112 struct completion kobj_unregister; 116 struct completion kobj_unregister;
113}; 117};
114 118
115#define CPUFREQ_ADJUST (0) 119#define CPUFREQ_ADJUST (0)
116#define CPUFREQ_INCOMPATIBLE (1) 120#define CPUFREQ_INCOMPATIBLE (1)
117#define CPUFREQ_NOTIFY (2) 121#define CPUFREQ_NOTIFY (2)
118#define CPUFREQ_START (3) 122#define CPUFREQ_START (3)
123#define CPUFREQ_UPDATE_POLICY_CPU (4)
119 124
125/* Only for ACPI */
120#define CPUFREQ_SHARED_TYPE_NONE (0) /* None */ 126#define CPUFREQ_SHARED_TYPE_NONE (0) /* None */
121#define CPUFREQ_SHARED_TYPE_HW (1) /* HW does needed coordination */ 127#define CPUFREQ_SHARED_TYPE_HW (1) /* HW does needed coordination */
122#define CPUFREQ_SHARED_TYPE_ALL (2) /* All dependent CPUs should set freq */ 128#define CPUFREQ_SHARED_TYPE_ALL (2) /* All dependent CPUs should set freq */
123#define CPUFREQ_SHARED_TYPE_ANY (3) /* Freq can be set from any dependent CPU*/ 129#define CPUFREQ_SHARED_TYPE_ANY (3) /* Freq can be set from any dependent CPU*/
124 130
131static inline bool policy_is_shared(struct cpufreq_policy *policy)
132{
133 return cpumask_weight(policy->cpus) > 1;
134}
135
125/******************** cpufreq transition notifiers *******************/ 136/******************** cpufreq transition notifiers *******************/
126 137
127#define CPUFREQ_PRECHANGE (0) 138#define CPUFREQ_PRECHANGE (0)
@@ -173,6 +184,7 @@ static inline unsigned long cpufreq_scale(unsigned long old, u_int div, u_int mu
173 184
174struct cpufreq_governor { 185struct cpufreq_governor {
175 char name[CPUFREQ_NAME_LEN]; 186 char name[CPUFREQ_NAME_LEN];
187 int initialized;
176 int (*governor) (struct cpufreq_policy *policy, 188 int (*governor) (struct cpufreq_policy *policy,
177 unsigned int event); 189 unsigned int event);
178 ssize_t (*show_setspeed) (struct cpufreq_policy *policy, 190 ssize_t (*show_setspeed) (struct cpufreq_policy *policy,
@@ -308,6 +320,9 @@ __ATTR(_name, 0444, show_##_name, NULL)
308static struct global_attr _name = \ 320static struct global_attr _name = \
309__ATTR(_name, 0644, show_##_name, store_##_name) 321__ATTR(_name, 0644, show_##_name, store_##_name)
310 322
323struct cpufreq_policy *cpufreq_cpu_get(unsigned int cpu);
324void cpufreq_cpu_put(struct cpufreq_policy *data);
325const char *cpufreq_get_current_driver(void);
311 326
312/********************************************************************* 327/*********************************************************************
313 * CPUFREQ 2.6. INTERFACE * 328 * CPUFREQ 2.6. INTERFACE *
@@ -397,14 +412,13 @@ int cpufreq_frequency_table_target(struct cpufreq_policy *policy,
397 412
398/* the following 3 funtions are for cpufreq core use only */ 413/* the following 3 funtions are for cpufreq core use only */
399struct cpufreq_frequency_table *cpufreq_frequency_get_table(unsigned int cpu); 414struct cpufreq_frequency_table *cpufreq_frequency_get_table(unsigned int cpu);
400struct cpufreq_policy *cpufreq_cpu_get(unsigned int cpu);
401void cpufreq_cpu_put(struct cpufreq_policy *data);
402 415
403/* the following are really really optional */ 416/* the following are really really optional */
404extern struct freq_attr cpufreq_freq_attr_scaling_available_freqs; 417extern struct freq_attr cpufreq_freq_attr_scaling_available_freqs;
405 418
406void cpufreq_frequency_table_get_attr(struct cpufreq_frequency_table *table, 419void cpufreq_frequency_table_get_attr(struct cpufreq_frequency_table *table,
407 unsigned int cpu); 420 unsigned int cpu);
421void cpufreq_frequency_table_update_policy_cpu(struct cpufreq_policy *policy);
408 422
409void cpufreq_frequency_table_put_attr(unsigned int cpu); 423void cpufreq_frequency_table_put_attr(unsigned int cpu);
410#endif /* _LINUX_CPUFREQ_H */ 424#endif /* _LINUX_CPUFREQ_H */
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
index 24cd1037b6d6..480c14dc1ddd 100644
--- a/include/linux/cpuidle.h
+++ b/include/linux/cpuidle.h
@@ -32,8 +32,6 @@ struct cpuidle_driver;
32 ****************************/ 32 ****************************/
33 33
34struct cpuidle_state_usage { 34struct cpuidle_state_usage {
35 void *driver_data;
36
37 unsigned long long disable; 35 unsigned long long disable;
38 unsigned long long usage; 36 unsigned long long usage;
39 unsigned long long time; /* in US */ 37 unsigned long long time; /* in US */
@@ -62,26 +60,6 @@ struct cpuidle_state {
62 60
63#define CPUIDLE_DRIVER_FLAGS_MASK (0xFFFF0000) 61#define CPUIDLE_DRIVER_FLAGS_MASK (0xFFFF0000)
64 62
65/**
66 * cpuidle_get_statedata - retrieves private driver state data
67 * @st_usage: the state usage statistics
68 */
69static inline void *cpuidle_get_statedata(struct cpuidle_state_usage *st_usage)
70{
71 return st_usage->driver_data;
72}
73
74/**
75 * cpuidle_set_statedata - stores private driver state data
76 * @st_usage: the state usage statistics
77 * @data: the private data
78 */
79static inline void
80cpuidle_set_statedata(struct cpuidle_state_usage *st_usage, void *data)
81{
82 st_usage->driver_data = data;
83}
84
85struct cpuidle_device { 63struct cpuidle_device {
86 unsigned int registered:1; 64 unsigned int registered:1;
87 unsigned int enabled:1; 65 unsigned int enabled:1;
diff --git a/include/linux/cyclomx.h b/include/linux/cyclomx.h
deleted file mode 100644
index b88f7f428e58..000000000000
--- a/include/linux/cyclomx.h
+++ /dev/null
@@ -1,77 +0,0 @@
1#ifndef _CYCLOMX_H
2#define _CYCLOMX_H
3/*
4* cyclomx.h Cyclom 2X WAN Link Driver.
5* User-level API definitions.
6*
7* Author: Arnaldo Carvalho de Melo <acme@conectiva.com.br>
8*
9* Copyright: (c) 1998-2003 Arnaldo Carvalho de Melo
10*
11* Based on wanpipe.h by Gene Kozin <genek@compuserve.com>
12*
13* This program is free software; you can redistribute it and/or
14* modify it under the terms of the GNU General Public License
15* as published by the Free Software Foundation; either version
16* 2 of the License, or (at your option) any later version.
17* ============================================================================
18* 2000/07/13 acme remove crap #if KERNEL_VERSION > blah
19* 2000/01/21 acme rename cyclomx_open to cyclomx_mod_inc_use_count
20* and cyclomx_close to cyclomx_mod_dec_use_count
21* 1999/05/19 acme wait_queue_head_t wait_stats(support for 2.3.*)
22* 1999/01/03 acme judicious use of data types
23* 1998/12/27 acme cleanup: PACKED not needed
24* 1998/08/08 acme Version 0.0.1
25*/
26
27#include <linux/wanrouter.h>
28#include <linux/spinlock.h>
29
30#ifdef __KERNEL__
31/* Kernel Interface */
32
33#include <linux/cycx_drv.h> /* Cyclom 2X support module API definitions */
34#include <linux/cycx_cfm.h> /* Cyclom 2X firmware module definitions */
35#ifdef CONFIG_CYCLOMX_X25
36#include <linux/cycx_x25.h>
37#endif
38
39/* Adapter Data Space.
40 * This structure is needed because we handle multiple cards, otherwise
41 * static data would do it.
42 */
43struct cycx_device {
44 char devname[WAN_DRVNAME_SZ + 1];/* card name */
45 struct cycx_hw hw; /* hardware configuration */
46 struct wan_device wandev; /* WAN device data space */
47 u32 state_tick; /* link state timestamp */
48 spinlock_t lock;
49 char in_isr; /* interrupt-in-service flag */
50 char buff_int_mode_unbusy; /* flag for carrying out dev_tint */
51 wait_queue_head_t wait_stats; /* to wait for the STATS indication */
52 void __iomem *mbox; /* -> mailbox */
53 void (*isr)(struct cycx_device* card); /* interrupt service routine */
54 int (*exec)(struct cycx_device* card, void* u_cmd, void* u_data);
55 union {
56#ifdef CONFIG_CYCLOMX_X25
57 struct { /* X.25 specific data */
58 u32 lo_pvc;
59 u32 hi_pvc;
60 u32 lo_svc;
61 u32 hi_svc;
62 struct cycx_x25_stats stats;
63 spinlock_t lock;
64 u32 connection_keys;
65 } x;
66#endif
67 } u;
68};
69
70/* Public Functions */
71void cycx_set_state(struct cycx_device *card, int state);
72
73#ifdef CONFIG_CYCLOMX_X25
74int cycx_x25_wan_init(struct cycx_device *card, wandev_conf_t *conf);
75#endif
76#endif /* __KERNEL__ */
77#endif /* _CYCLOMX_H */
diff --git a/include/linux/cycx_drv.h b/include/linux/cycx_drv.h
deleted file mode 100644
index 12fe6b0bfcff..000000000000
--- a/include/linux/cycx_drv.h
+++ /dev/null
@@ -1,64 +0,0 @@
1/*
2* cycx_drv.h CYCX Support Module. Kernel API Definitions.
3*
4* Author: Arnaldo Carvalho de Melo <acme@conectiva.com.br>
5*
6* Copyright: (c) 1998-2003 Arnaldo Carvalho de Melo
7*
8* Based on sdladrv.h by Gene Kozin <genek@compuserve.com>
9*
10* This program is free software; you can redistribute it and/or
11* modify it under the terms of the GNU General Public License
12* as published by the Free Software Foundation; either version
13* 2 of the License, or (at your option) any later version.
14* ============================================================================
15* 1999/10/23 acme cycxhw_t cleanup
16* 1999/01/03 acme more judicious use of data types...
17* uclong, ucchar, etc deleted, the u8, u16, u32
18* types are the portable way to go.
19* 1999/01/03 acme judicious use of data types... u16, u32, etc
20* 1998/12/26 acme FIXED_BUFFERS, CONF_OFFSET,
21* removal of cy_read{bwl}
22* 1998/08/08 acme Initial version.
23*/
24#ifndef _CYCX_DRV_H
25#define _CYCX_DRV_H
26
27#define CYCX_WINDOWSIZE 0x4000 /* default dual-port memory window size */
28#define GEN_CYCX_INTR 0x02
29#define RST_ENABLE 0x04
30#define START_CPU 0x06
31#define RST_DISABLE 0x08
32#define FIXED_BUFFERS 0x08
33#define TEST_PATTERN 0xaa55
34#define CMD_OFFSET 0x20
35#define CONF_OFFSET 0x0380
36#define RESET_OFFSET 0x3c00 /* For reset file load */
37#define DATA_OFFSET 0x0100 /* For code and data files load */
38#define START_OFFSET 0x3ff0 /* 80186 starts here */
39
40/**
41 * struct cycx_hw - Adapter hardware configuration
42 * @fwid - firmware ID
43 * @irq - interrupt request level
44 * @dpmbase - dual-port memory base
45 * @dpmsize - dual-port memory size
46 * @reserved - reserved for future use
47 */
48struct cycx_hw {
49 u32 fwid;
50 int irq;
51 void __iomem *dpmbase;
52 u32 dpmsize;
53 u32 reserved[5];
54};
55
56/* Function Prototypes */
57extern int cycx_setup(struct cycx_hw *hw, void *sfm, u32 len, unsigned long base);
58extern int cycx_down(struct cycx_hw *hw);
59extern int cycx_peek(struct cycx_hw *hw, u32 addr, void *buf, u32 len);
60extern int cycx_poke(struct cycx_hw *hw, u32 addr, void *buf, u32 len);
61extern int cycx_exec(void __iomem *addr);
62
63extern void cycx_intr(struct cycx_hw *hw);
64#endif /* _CYCX_DRV_H */
diff --git a/include/linux/debugfs.h b/include/linux/debugfs.h
index 66c434f5dd1e..63f2465807d4 100644
--- a/include/linux/debugfs.h
+++ b/include/linux/debugfs.h
@@ -33,7 +33,7 @@ struct debugfs_reg32 {
33}; 33};
34 34
35struct debugfs_regset32 { 35struct debugfs_regset32 {
36 struct debugfs_reg32 *regs; 36 const struct debugfs_reg32 *regs;
37 int nregs; 37 int nregs;
38 void __iomem *base; 38 void __iomem *base;
39}; 39};
diff --git a/include/linux/device.h b/include/linux/device.h
index 43dcda937ddf..9d6464ea99c6 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -21,6 +21,7 @@
21#include <linux/compiler.h> 21#include <linux/compiler.h>
22#include <linux/types.h> 22#include <linux/types.h>
23#include <linux/mutex.h> 23#include <linux/mutex.h>
24#include <linux/pinctrl/devinfo.h>
24#include <linux/pm.h> 25#include <linux/pm.h>
25#include <linux/atomic.h> 26#include <linux/atomic.h>
26#include <linux/ratelimit.h> 27#include <linux/ratelimit.h>
@@ -395,8 +396,8 @@ extern int class_for_each_device(struct class *class, struct device *start,
395 void *data, 396 void *data,
396 int (*fn)(struct device *dev, void *data)); 397 int (*fn)(struct device *dev, void *data));
397extern struct device *class_find_device(struct class *class, 398extern struct device *class_find_device(struct class *class,
398 struct device *start, void *data, 399 struct device *start, const void *data,
399 int (*match)(struct device *, void *)); 400 int (*match)(struct device *, const void *));
400 401
401struct class_attribute { 402struct class_attribute {
402 struct attribute attr; 403 struct attribute attr;
@@ -573,6 +574,7 @@ extern int devres_release_group(struct device *dev, void *id);
573extern void *devm_kzalloc(struct device *dev, size_t size, gfp_t gfp); 574extern void *devm_kzalloc(struct device *dev, size_t size, gfp_t gfp);
574extern void devm_kfree(struct device *dev, void *p); 575extern void devm_kfree(struct device *dev, void *p);
575 576
577void __iomem *devm_ioremap_resource(struct device *dev, struct resource *res);
576void __iomem *devm_request_and_ioremap(struct device *dev, 578void __iomem *devm_request_and_ioremap(struct device *dev,
577 struct resource *res); 579 struct resource *res);
578 580
@@ -620,6 +622,8 @@ struct acpi_dev_node {
620 * @pm_domain: Provide callbacks that are executed during system suspend, 622 * @pm_domain: Provide callbacks that are executed during system suspend,
621 * hibernation, system resume and during runtime PM transitions 623 * hibernation, system resume and during runtime PM transitions
622 * along with subsystem-level and driver-level callbacks. 624 * along with subsystem-level and driver-level callbacks.
625 * @pins: For device pin management.
626 * See Documentation/pinctrl.txt for details.
623 * @numa_node: NUMA node this device is close to. 627 * @numa_node: NUMA node this device is close to.
624 * @dma_mask: Dma mask (if dma'ble device). 628 * @dma_mask: Dma mask (if dma'ble device).
625 * @coherent_dma_mask: Like dma_mask, but for alloc_coherent mapping as not all 629 * @coherent_dma_mask: Like dma_mask, but for alloc_coherent mapping as not all
@@ -672,6 +676,10 @@ struct device {
672 struct dev_pm_info power; 676 struct dev_pm_info power;
673 struct dev_pm_domain *pm_domain; 677 struct dev_pm_domain *pm_domain;
674 678
679#ifdef CONFIG_PINCTRL
680 struct dev_pin_info *pins;
681#endif
682
675#ifdef CONFIG_NUMA 683#ifdef CONFIG_NUMA
676 int numa_node; /* NUMA node this device is close to */ 684 int numa_node; /* NUMA node this device is close to */
677#endif 685#endif
diff --git a/include/linux/dma-buf.h b/include/linux/dma-buf.h
index bd2e52ccc4f2..3d754a394e92 100644
--- a/include/linux/dma-buf.h
+++ b/include/linux/dma-buf.h
@@ -53,7 +53,7 @@ struct dma_buf_attachment;
53 * @begin_cpu_access: [optional] called before cpu access to invalidate cpu 53 * @begin_cpu_access: [optional] called before cpu access to invalidate cpu
54 * caches and allocate backing storage (if not yet done) 54 * caches and allocate backing storage (if not yet done)
55 * respectively pin the objet into memory. 55 * respectively pin the objet into memory.
56 * @end_cpu_access: [optional] called after cpu access to flush cashes. 56 * @end_cpu_access: [optional] called after cpu access to flush caches.
57 * @kmap_atomic: maps a page from the buffer into kernel address 57 * @kmap_atomic: maps a page from the buffer into kernel address
58 * space, users may not block until the subsequent unmap call. 58 * space, users may not block until the subsequent unmap call.
59 * This callback must not sleep. 59 * This callback must not sleep.
diff --git a/include/linux/dw_apb_timer.h b/include/linux/dw_apb_timer.h
index 1148575fd134..dd755ce2a5eb 100644
--- a/include/linux/dw_apb_timer.h
+++ b/include/linux/dw_apb_timer.h
@@ -53,5 +53,5 @@ void dw_apb_clocksource_start(struct dw_apb_clocksource *dw_cs);
53cycle_t dw_apb_clocksource_read(struct dw_apb_clocksource *dw_cs); 53cycle_t dw_apb_clocksource_read(struct dw_apb_clocksource *dw_cs);
54void dw_apb_clocksource_unregister(struct dw_apb_clocksource *dw_cs); 54void dw_apb_clocksource_unregister(struct dw_apb_clocksource *dw_cs);
55 55
56extern struct sys_timer dw_apb_timer; 56extern void dw_apb_timer_init(void);
57#endif /* __DW_APB_TIMER_H__ */ 57#endif /* __DW_APB_TIMER_H__ */
diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h
index 6dd4787a798a..2fe93b26b42f 100644
--- a/include/linux/dynamic_debug.h
+++ b/include/linux/dynamic_debug.h
@@ -95,6 +95,17 @@ do { \
95 ##__VA_ARGS__); \ 95 ##__VA_ARGS__); \
96} while (0) 96} while (0)
97 97
98#define dynamic_hex_dump(prefix_str, prefix_type, rowsize, \
99 groupsize, buf, len, ascii) \
100do { \
101 DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, \
102 __builtin_constant_p(prefix_str) ? prefix_str : "hexdump");\
103 if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT)) \
104 print_hex_dump(KERN_DEBUG, prefix_str, \
105 prefix_type, rowsize, groupsize, \
106 buf, len, ascii); \
107} while (0)
108
98#else 109#else
99 110
100#include <linux/string.h> 111#include <linux/string.h>
diff --git a/include/linux/efi.h b/include/linux/efi.h
index 8b84916dc671..9bf2f1fcae27 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -618,18 +618,30 @@ extern int __init efi_setup_pcdp_console(char *);
618#endif 618#endif
619 619
620/* 620/*
621 * We play games with efi_enabled so that the compiler will, if possible, remove 621 * We play games with efi_enabled so that the compiler will, if
622 * EFI-related code altogether. 622 * possible, remove EFI-related code altogether.
623 */ 623 */
624#define EFI_BOOT 0 /* Were we booted from EFI? */
625#define EFI_SYSTEM_TABLES 1 /* Can we use EFI system tables? */
626#define EFI_CONFIG_TABLES 2 /* Can we use EFI config tables? */
627#define EFI_RUNTIME_SERVICES 3 /* Can we use runtime services? */
628#define EFI_MEMMAP 4 /* Can we use EFI memory map? */
629#define EFI_64BIT 5 /* Is the firmware 64-bit? */
630
624#ifdef CONFIG_EFI 631#ifdef CONFIG_EFI
625# ifdef CONFIG_X86 632# ifdef CONFIG_X86
626 extern int efi_enabled; 633extern int efi_enabled(int facility);
627 extern bool efi_64bit;
628# else 634# else
629# define efi_enabled 1 635static inline int efi_enabled(int facility)
636{
637 return 1;
638}
630# endif 639# endif
631#else 640#else
632# define efi_enabled 0 641static inline int efi_enabled(int facility)
642{
643 return 0;
644}
633#endif 645#endif
634 646
635/* 647/*
@@ -728,7 +740,8 @@ struct efivars {
728 * 1) ->list - adds, removals, reads, writes 740 * 1) ->list - adds, removals, reads, writes
729 * 2) ops.[gs]et_variable() calls. 741 * 2) ops.[gs]et_variable() calls.
730 * It must not be held when creating sysfs entries or calling kmalloc. 742 * It must not be held when creating sysfs entries or calling kmalloc.
731 * ops.get_next_variable() is only called from register_efivars(), 743 * ops.get_next_variable() is only called from register_efivars()
744 * or efivar_update_sysfs_entries(),
732 * which is protected by the BKL, so that path is safe. 745 * which is protected by the BKL, so that path is safe.
733 */ 746 */
734 spinlock_t lock; 747 spinlock_t lock;
diff --git a/include/linux/elevator.h b/include/linux/elevator.h
index c03af7687bb4..186620631750 100644
--- a/include/linux/elevator.h
+++ b/include/linux/elevator.h
@@ -138,6 +138,7 @@ extern void elv_drain_elevator(struct request_queue *);
138/* 138/*
139 * io scheduler registration 139 * io scheduler registration
140 */ 140 */
141extern void __init load_default_elevator_module(void);
141extern int elv_register(struct elevator_type *); 142extern int elv_register(struct elevator_type *);
142extern void elv_unregister(struct elevator_type *); 143extern void elv_unregister(struct elevator_type *);
143 144
@@ -206,5 +207,9 @@ enum {
206 INIT_LIST_HEAD(&(rq)->csd.list); \ 207 INIT_LIST_HEAD(&(rq)->csd.list); \
207 } while (0) 208 } while (0)
208 209
210#else /* CONFIG_BLOCK */
211
212static inline void load_default_elevator_module(void) { }
213
209#endif /* CONFIG_BLOCK */ 214#endif /* CONFIG_BLOCK */
210#endif 215#endif
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
index 243eea1e33d8..c623861964e4 100644
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -40,6 +40,8 @@ extern int eth_header_cache(const struct neighbour *neigh, struct hh_cache *hh,
40extern void eth_header_cache_update(struct hh_cache *hh, 40extern void eth_header_cache_update(struct hh_cache *hh,
41 const struct net_device *dev, 41 const struct net_device *dev,
42 const unsigned char *haddr); 42 const unsigned char *haddr);
43extern int eth_prepare_mac_addr_change(struct net_device *dev, void *p);
44extern void eth_commit_mac_addr_change(struct net_device *dev, void *p);
43extern int eth_mac_addr(struct net_device *dev, void *p); 45extern int eth_mac_addr(struct net_device *dev, void *p);
44extern int eth_change_mtu(struct net_device *dev, int new_mtu); 46extern int eth_change_mtu(struct net_device *dev, int new_mtu);
45extern int eth_validate_addr(struct net_device *dev); 47extern int eth_validate_addr(struct net_device *dev);
@@ -192,7 +194,7 @@ static inline void eth_zero_addr(u8 *addr)
192 */ 194 */
193static inline void eth_hw_addr_random(struct net_device *dev) 195static inline void eth_hw_addr_random(struct net_device *dev)
194{ 196{
195 dev->addr_assign_type |= NET_ADDR_RANDOM; 197 dev->addr_assign_type = NET_ADDR_RANDOM;
196 eth_random_addr(dev->dev_addr); 198 eth_random_addr(dev->dev_addr);
197} 199}
198 200
diff --git a/include/linux/extcon/extcon_gpio.h b/include/linux/extcon/extcon-gpio.h
index 2d8307f7d67d..2d8307f7d67d 100644
--- a/include/linux/extcon/extcon_gpio.h
+++ b/include/linux/extcon/extcon-gpio.h
diff --git a/include/linux/freezer.h b/include/linux/freezer.h
index e4238ceaa4d6..e70df40d84f6 100644
--- a/include/linux/freezer.h
+++ b/include/linux/freezer.h
@@ -13,6 +13,11 @@ extern bool pm_freezing; /* PM freezing in effect */
13extern bool pm_nosig_freezing; /* PM nosig freezing in effect */ 13extern bool pm_nosig_freezing; /* PM nosig freezing in effect */
14 14
15/* 15/*
16 * Timeout for stopping processes
17 */
18extern unsigned int freeze_timeout_msecs;
19
20/*
16 * Check if a process has been frozen 21 * Check if a process has been frozen
17 */ 22 */
18static inline bool frozen(struct task_struct *p) 23static inline bool frozen(struct task_struct *p)
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 7617ee04f066..7d2e893ec3d1 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -301,7 +301,7 @@ size_t iov_iter_copy_from_user(struct page *page,
301 struct iov_iter *i, unsigned long offset, size_t bytes); 301 struct iov_iter *i, unsigned long offset, size_t bytes);
302void iov_iter_advance(struct iov_iter *i, size_t bytes); 302void iov_iter_advance(struct iov_iter *i, size_t bytes);
303int iov_iter_fault_in_readable(struct iov_iter *i, size_t bytes); 303int iov_iter_fault_in_readable(struct iov_iter *i, size_t bytes);
304size_t iov_iter_single_seg_count(struct iov_iter *i); 304size_t iov_iter_single_seg_count(const struct iov_iter *i);
305 305
306static inline void iov_iter_init(struct iov_iter *i, 306static inline void iov_iter_init(struct iov_iter *i,
307 const struct iovec *iov, unsigned long nr_segs, 307 const struct iovec *iov, unsigned long nr_segs,
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index 92691d85c320..e5ca8ef50e9b 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -74,7 +74,7 @@ typedef void (*ftrace_func_t)(unsigned long ip, unsigned long parent_ip,
74 * SAVE_REGS - The ftrace_ops wants regs saved at each function called 74 * SAVE_REGS - The ftrace_ops wants regs saved at each function called
75 * and passed to the callback. If this flag is set, but the 75 * and passed to the callback. If this flag is set, but the
76 * architecture does not support passing regs 76 * architecture does not support passing regs
77 * (ARCH_SUPPORTS_FTRACE_SAVE_REGS is not defined), then the 77 * (CONFIG_DYNAMIC_FTRACE_WITH_REGS is not defined), then the
78 * ftrace_ops will fail to register, unless the next flag 78 * ftrace_ops will fail to register, unless the next flag
79 * is set. 79 * is set.
80 * SAVE_REGS_IF_SUPPORTED - This is the same as SAVE_REGS, but if the 80 * SAVE_REGS_IF_SUPPORTED - This is the same as SAVE_REGS, but if the
@@ -418,7 +418,7 @@ void ftrace_modify_all_code(int command);
418#endif 418#endif
419 419
420#ifndef FTRACE_REGS_ADDR 420#ifndef FTRACE_REGS_ADDR
421#ifdef ARCH_SUPPORTS_FTRACE_SAVE_REGS 421#ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS
422# define FTRACE_REGS_ADDR ((unsigned long)ftrace_regs_caller) 422# define FTRACE_REGS_ADDR ((unsigned long)ftrace_regs_caller)
423#else 423#else
424# define FTRACE_REGS_ADDR FTRACE_ADDR 424# define FTRACE_REGS_ADDR FTRACE_ADDR
@@ -480,7 +480,7 @@ extern int ftrace_make_nop(struct module *mod,
480 */ 480 */
481extern int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr); 481extern int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr);
482 482
483#ifdef ARCH_SUPPORTS_FTRACE_SAVE_REGS 483#ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS
484/** 484/**
485 * ftrace_modify_call - convert from one addr to another (no nop) 485 * ftrace_modify_call - convert from one addr to another (no nop)
486 * @rec: the mcount call site record 486 * @rec: the mcount call site record
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
index a3d489531d83..13a54d0bdfa8 100644
--- a/include/linux/ftrace_event.h
+++ b/include/linux/ftrace_event.h
@@ -49,7 +49,6 @@ struct trace_entry {
49 unsigned char flags; 49 unsigned char flags;
50 unsigned char preempt_count; 50 unsigned char preempt_count;
51 int pid; 51 int pid;
52 int padding;
53}; 52};
54 53
55#define FTRACE_MAX_EVENT \ 54#define FTRACE_MAX_EVENT \
@@ -84,6 +83,9 @@ struct trace_iterator {
84 long idx; 83 long idx;
85 84
86 cpumask_var_t started; 85 cpumask_var_t started;
86
87 /* it's true when current open file is snapshot */
88 bool snapshot;
87}; 89};
88 90
89enum trace_iter_flags { 91enum trace_iter_flags {
@@ -272,7 +274,7 @@ extern int trace_define_field(struct ftrace_event_call *call, const char *type,
272extern int trace_add_event_call(struct ftrace_event_call *call); 274extern int trace_add_event_call(struct ftrace_event_call *call);
273extern void trace_remove_event_call(struct ftrace_event_call *call); 275extern void trace_remove_event_call(struct ftrace_event_call *call);
274 276
275#define is_signed_type(type) (((type)(-1)) < 0) 277#define is_signed_type(type) (((type)(-1)) < (type)0)
276 278
277int trace_set_clr_event(const char *system, const char *event, int set); 279int trace_set_clr_event(const char *system, const char *event, int set);
278 280
diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h
index 624ef3f45c8e..29eb805ea4a6 100644
--- a/include/linux/hardirq.h
+++ b/include/linux/hardirq.h
@@ -153,7 +153,7 @@ extern void rcu_nmi_exit(void);
153 */ 153 */
154#define __irq_enter() \ 154#define __irq_enter() \
155 do { \ 155 do { \
156 vtime_account_irq_enter(current); \ 156 account_irq_enter_time(current); \
157 add_preempt_count(HARDIRQ_OFFSET); \ 157 add_preempt_count(HARDIRQ_OFFSET); \
158 trace_hardirq_enter(); \ 158 trace_hardirq_enter(); \
159 } while (0) 159 } while (0)
@@ -169,7 +169,7 @@ extern void irq_enter(void);
169#define __irq_exit() \ 169#define __irq_exit() \
170 do { \ 170 do { \
171 trace_hardirq_exit(); \ 171 trace_hardirq_exit(); \
172 vtime_account_irq_exit(current); \ 172 account_irq_exit_time(current); \
173 sub_preempt_count(HARDIRQ_OFFSET); \ 173 sub_preempt_count(HARDIRQ_OFFSET); \
174 } while (0) 174 } while (0)
175 175
@@ -180,10 +180,10 @@ extern void irq_exit(void);
180 180
181#define nmi_enter() \ 181#define nmi_enter() \
182 do { \ 182 do { \
183 lockdep_off(); \
183 ftrace_nmi_enter(); \ 184 ftrace_nmi_enter(); \
184 BUG_ON(in_nmi()); \ 185 BUG_ON(in_nmi()); \
185 add_preempt_count(NMI_OFFSET + HARDIRQ_OFFSET); \ 186 add_preempt_count(NMI_OFFSET + HARDIRQ_OFFSET); \
186 lockdep_off(); \
187 rcu_nmi_enter(); \ 187 rcu_nmi_enter(); \
188 trace_hardirq_enter(); \ 188 trace_hardirq_enter(); \
189 } while (0) 189 } while (0)
@@ -192,10 +192,10 @@ extern void irq_exit(void);
192 do { \ 192 do { \
193 trace_hardirq_exit(); \ 193 trace_hardirq_exit(); \
194 rcu_nmi_exit(); \ 194 rcu_nmi_exit(); \
195 lockdep_on(); \
196 BUG_ON(!in_nmi()); \ 195 BUG_ON(!in_nmi()); \
197 sub_preempt_count(NMI_OFFSET + HARDIRQ_OFFSET); \ 196 sub_preempt_count(NMI_OFFSET + HARDIRQ_OFFSET); \
198 ftrace_nmi_exit(); \ 197 ftrace_nmi_exit(); \
198 lockdep_on(); \
199 } while (0) 199 } while (0)
200 200
201#endif /* LINUX_HARDIRQ_H */ 201#endif /* LINUX_HARDIRQ_H */
diff --git a/include/linux/hid-sensor-hub.h b/include/linux/hid-sensor-hub.h
index 0aa5f4c42ae6..ecefb7311dd6 100644
--- a/include/linux/hid-sensor-hub.h
+++ b/include/linux/hid-sensor-hub.h
@@ -157,4 +157,42 @@ int sensor_hub_set_feature(struct hid_sensor_hub_device *hsdev, u32 report_id,
157*/ 157*/
158int sensor_hub_get_feature(struct hid_sensor_hub_device *hsdev, u32 report_id, 158int sensor_hub_get_feature(struct hid_sensor_hub_device *hsdev, u32 report_id,
159 u32 field_index, s32 *value); 159 u32 field_index, s32 *value);
160
161/* hid-sensor-attributes */
162
163/* Common hid sensor iio structure */
164struct hid_sensor_common {
165 struct hid_sensor_hub_device *hsdev;
166 struct platform_device *pdev;
167 unsigned usage_id;
168 bool data_ready;
169 struct hid_sensor_hub_attribute_info poll;
170 struct hid_sensor_hub_attribute_info report_state;
171 struct hid_sensor_hub_attribute_info power_state;
172 struct hid_sensor_hub_attribute_info sensitivity;
173};
174
175/*Convert from hid unit expo to regular exponent*/
176static inline int hid_sensor_convert_exponent(int unit_expo)
177{
178 if (unit_expo < 0x08)
179 return unit_expo;
180 else if (unit_expo <= 0x0f)
181 return -(0x0f-unit_expo+1);
182 else
183 return 0;
184}
185
186int hid_sensor_parse_common_attributes(struct hid_sensor_hub_device *hsdev,
187 u32 usage_id,
188 struct hid_sensor_common *st);
189int hid_sensor_write_raw_hyst_value(struct hid_sensor_common *st,
190 int val1, int val2);
191int hid_sensor_read_raw_hyst_value(struct hid_sensor_common *st,
192 int *val1, int *val2);
193int hid_sensor_write_samp_freq_value(struct hid_sensor_common *st,
194 int val1, int val2);
195int hid_sensor_read_samp_freq_value(struct hid_sensor_common *st,
196 int *val1, int *val2);
197
160#endif 198#endif
diff --git a/include/linux/hid-sensor-ids.h b/include/linux/hid-sensor-ids.h
index 55f277372fed..6f24446e7669 100644
--- a/include/linux/hid-sensor-ids.h
+++ b/include/linux/hid-sensor-ids.h
@@ -66,6 +66,15 @@
66#define HID_USAGE_SENSOR_ORIENT_MAGN_FLUX_Y_AXIS 0x200486 66#define HID_USAGE_SENSOR_ORIENT_MAGN_FLUX_Y_AXIS 0x200486
67#define HID_USAGE_SENSOR_ORIENT_MAGN_FLUX_Z_AXIS 0x200487 67#define HID_USAGE_SENSOR_ORIENT_MAGN_FLUX_Z_AXIS 0x200487
68 68
69/* Time (2000a0) */
70#define HID_USAGE_SENSOR_TIME 0x2000a0
71#define HID_USAGE_SENSOR_TIME_YEAR 0x200521
72#define HID_USAGE_SENSOR_TIME_MONTH 0x200522
73#define HID_USAGE_SENSOR_TIME_DAY 0x200523
74#define HID_USAGE_SENSOR_TIME_HOUR 0x200525
75#define HID_USAGE_SENSOR_TIME_MINUTE 0x200526
76#define HID_USAGE_SENSOR_TIME_SECOND 0x200527
77
69/* Units */ 78/* Units */
70#define HID_USAGE_SENSOR_UNITS_NOT_SPECIFIED 0x00 79#define HID_USAGE_SENSOR_UNITS_NOT_SPECIFIED 0x00
71#define HID_USAGE_SENSOR_UNITS_LUX 0x01 80#define HID_USAGE_SENSOR_UNITS_LUX 0x01
diff --git a/include/linux/hid.h b/include/linux/hid.h
index 7330a0fef0c0..e14b465b1146 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -589,6 +589,7 @@ struct hid_usage_id {
589 * @raw_event: if report in report_table, this hook is called (NULL means nop) 589 * @raw_event: if report in report_table, this hook is called (NULL means nop)
590 * @usage_table: on which events to call event (NULL means all) 590 * @usage_table: on which events to call event (NULL means all)
591 * @event: if usage in usage_table, this hook is called (NULL means nop) 591 * @event: if usage in usage_table, this hook is called (NULL means nop)
592 * @report: this hook is called after parsing a report (NULL means nop)
592 * @report_fixup: called before report descriptor parsing (NULL means nop) 593 * @report_fixup: called before report descriptor parsing (NULL means nop)
593 * @input_mapping: invoked on input registering before mapping an usage 594 * @input_mapping: invoked on input registering before mapping an usage
594 * @input_mapped: invoked on input registering after mapping an usage 595 * @input_mapped: invoked on input registering after mapping an usage
@@ -627,6 +628,7 @@ struct hid_driver {
627 const struct hid_usage_id *usage_table; 628 const struct hid_usage_id *usage_table;
628 int (*event)(struct hid_device *hdev, struct hid_field *field, 629 int (*event)(struct hid_device *hdev, struct hid_field *field,
629 struct hid_usage *usage, __s32 value); 630 struct hid_usage *usage, __s32 value);
631 void (*report)(struct hid_device *hdev, struct hid_report *report);
630 632
631 __u8 *(*report_fixup)(struct hid_device *hdev, __u8 *buf, 633 __u8 *(*report_fixup)(struct hid_device *hdev, __u8 *buf,
632 unsigned int *size); 634 unsigned int *size);
@@ -700,6 +702,18 @@ extern int __must_check __hid_register_driver(struct hid_driver *,
700 702
701extern void hid_unregister_driver(struct hid_driver *); 703extern void hid_unregister_driver(struct hid_driver *);
702 704
705/**
706 * module_hid_driver() - Helper macro for registering a HID driver
707 * @__hid_driver: hid_driver struct
708 *
709 * Helper macro for HID drivers which do not do anything special in module
710 * init/exit. This eliminates a lot of boilerplate. Each module may only
711 * use this macro once, and calling it replaces module_init() and module_exit()
712 */
713#define module_hid_driver(__hid_driver) \
714 module_driver(__hid_driver, hid_register_driver, \
715 hid_unregister_driver)
716
703extern void hidinput_hid_event(struct hid_device *, struct hid_field *, struct hid_usage *, __s32); 717extern void hidinput_hid_event(struct hid_device *, struct hid_field *, struct hid_usage *, __s32);
704extern void hidinput_report_event(struct hid_device *hid, struct hid_report *report); 718extern void hidinput_report_event(struct hid_device *hid, struct hid_report *report);
705extern int hidinput_connect(struct hid_device *hid, unsigned int force); 719extern int hidinput_connect(struct hid_device *hid, unsigned int force);
@@ -872,9 +886,6 @@ static inline int hid_hw_power(struct hid_device *hdev, int level)
872int hid_report_raw_event(struct hid_device *hid, int type, u8 *data, int size, 886int hid_report_raw_event(struct hid_device *hid, int type, u8 *data, int size,
873 int interrupt); 887 int interrupt);
874 888
875extern int hid_generic_init(void);
876extern void hid_generic_exit(void);
877
878/* HID quirks API */ 889/* HID quirks API */
879u32 usbhid_lookup_quirk(const u16 idVendor, const u16 idProduct); 890u32 usbhid_lookup_quirk(const u16 idVendor, const u16 idProduct);
880int usbhid_quirks_init(char **quirks_param); 891int usbhid_quirks_init(char **quirks_param);
diff --git a/include/linux/hwmon.h b/include/linux/hwmon.h
index 82b29ae6ebb0..b2514f70d591 100644
--- a/include/linux/hwmon.h
+++ b/include/linux/hwmon.h
@@ -20,16 +20,4 @@ struct device *hwmon_device_register(struct device *dev);
20 20
21void hwmon_device_unregister(struct device *dev); 21void hwmon_device_unregister(struct device *dev);
22 22
23/* Scale user input to sensible values */
24static inline int SENSORS_LIMIT(long value, long low, long high)
25{
26 if (value < low)
27 return low;
28 else if (value > high)
29 return high;
30 else
31 return value;
32}
33
34#endif 23#endif
35
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index e73b852156b1..df77ba9a8166 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -325,14 +325,28 @@ struct hv_ring_buffer {
325 325
326 u32 interrupt_mask; 326 u32 interrupt_mask;
327 327
328 /* Pad it to PAGE_SIZE so that data starts on page boundary */ 328 /*
329 u8 reserved[4084]; 329 * Win8 uses some of the reserved bits to implement
330 330 * interrupt driven flow management. On the send side
331 /* NOTE: 331 * we can request that the receiver interrupt the sender
332 * The interrupt_mask field is used only for channels but since our 332 * when the ring transitions from being full to being able
333 * vmbus connection also uses this data structure and its data starts 333 * to handle a message of size "pending_send_sz".
334 * here, we commented out this field. 334 *
335 * Add necessary state for this enhancement.
335 */ 336 */
337 u32 pending_send_sz;
338
339 u32 reserved1[12];
340
341 union {
342 struct {
343 u32 feat_pending_send_sz:1;
344 };
345 u32 value;
346 } feature_bits;
347
348 /* Pad it to PAGE_SIZE so that data starts on page boundary */
349 u8 reserved2[4028];
336 350
337 /* 351 /*
338 * Ring data starts here + RingDataStartOffset 352 * Ring data starts here + RingDataStartOffset
@@ -405,12 +419,22 @@ hv_get_ringbuffer_availbytes(struct hv_ring_buffer_info *rbi,
405 */ 419 */
406#define HV_DRV_VERSION "3.1" 420#define HV_DRV_VERSION "3.1"
407 421
408
409/* 422/*
410 * A revision number of vmbus that is used for ensuring both ends on a 423 * VMBUS version is 32 bit entity broken up into
411 * partition are using compatible versions. 424 * two 16 bit quantities: major_number. minor_number.
425 *
426 * 0 . 13 (Windows Server 2008)
427 * 1 . 1 (Windows 7)
428 * 2 . 4 (Windows 8)
412 */ 429 */
413#define VMBUS_REVISION_NUMBER 13 430
431#define VERSION_WS2008 ((0 << 16) | (13))
432#define VERSION_WIN7 ((1 << 16) | (1))
433#define VERSION_WIN8 ((2 << 16) | (4))
434
435#define VERSION_INVAL -1
436
437#define VERSION_CURRENT VERSION_WIN8
414 438
415/* Make maximum size of pipe payload of 16K */ 439/* Make maximum size of pipe payload of 16K */
416#define MAX_PIPE_DATA_PAYLOAD (sizeof(u8) * 16384) 440#define MAX_PIPE_DATA_PAYLOAD (sizeof(u8) * 16384)
@@ -432,9 +456,13 @@ hv_get_ringbuffer_availbytes(struct hv_ring_buffer_info *rbi,
432struct vmbus_channel_offer { 456struct vmbus_channel_offer {
433 uuid_le if_type; 457 uuid_le if_type;
434 uuid_le if_instance; 458 uuid_le if_instance;
435 u64 int_latency; /* in 100ns units */ 459
436 u32 if_revision; 460 /*
437 u32 server_ctx_size; /* in bytes */ 461 * These two fields are not currently used.
462 */
463 u64 reserved1;
464 u64 reserved2;
465
438 u16 chn_flags; 466 u16 chn_flags;
439 u16 mmio_megabytes; /* in bytes * 1024 * 1024 */ 467 u16 mmio_megabytes; /* in bytes * 1024 * 1024 */
440 468
@@ -456,7 +484,11 @@ struct vmbus_channel_offer {
456 unsigned char user_def[MAX_PIPE_USER_DEFINED_BYTES]; 484 unsigned char user_def[MAX_PIPE_USER_DEFINED_BYTES];
457 } pipe; 485 } pipe;
458 } u; 486 } u;
459 u32 padding; 487 /*
488 * The sub_channel_index is defined in win8.
489 */
490 u16 sub_channel_index;
491 u16 reserved3;
460} __packed; 492} __packed;
461 493
462/* Server Flags */ 494/* Server Flags */
@@ -652,7 +684,25 @@ struct vmbus_channel_offer_channel {
652 struct vmbus_channel_offer offer; 684 struct vmbus_channel_offer offer;
653 u32 child_relid; 685 u32 child_relid;
654 u8 monitorid; 686 u8 monitorid;
655 u8 monitor_allocated; 687 /*
688 * win7 and beyond splits this field into a bit field.
689 */
690 u8 monitor_allocated:1;
691 u8 reserved:7;
692 /*
693 * These are new fields added in win7 and later.
694 * Do not access these fields without checking the
695 * negotiated protocol.
696 *
697 * If "is_dedicated_interrupt" is set, we must not set the
698 * associated bit in the channel bitmap while sending the
699 * interrupt to the host.
700 *
701 * connection_id is to be used in signaling the host.
702 */
703 u16 is_dedicated_interrupt:1;
704 u16 reserved1:15;
705 u32 connection_id;
656} __packed; 706} __packed;
657 707
658/* Rescind Offer parameters */ 708/* Rescind Offer parameters */
@@ -683,8 +733,15 @@ struct vmbus_channel_open_channel {
683 /* GPADL for the channel's ring buffer. */ 733 /* GPADL for the channel's ring buffer. */
684 u32 ringbuffer_gpadlhandle; 734 u32 ringbuffer_gpadlhandle;
685 735
686 /* GPADL for the channel's server context save area. */ 736 /*
687 u32 server_contextarea_gpadlhandle; 737 * Starting with win8, this field will be used to specify
738 * the target virtual processor on which to deliver the interrupt for
739 * the host to guest communication.
740 * Prior to win8, incoming channel interrupts would only
741 * be delivered on cpu 0. Setting this value to 0 would
742 * preserve the earlier behavior.
743 */
744 u32 target_vp;
688 745
689 /* 746 /*
690 * The upstream ring buffer begins at offset zero in the memory 747 * The upstream ring buffer begins at offset zero in the memory
@@ -848,6 +905,27 @@ struct vmbus_close_msg {
848 struct vmbus_channel_close_channel msg; 905 struct vmbus_channel_close_channel msg;
849}; 906};
850 907
908/* Define connection identifier type. */
909union hv_connection_id {
910 u32 asu32;
911 struct {
912 u32 id:24;
913 u32 reserved:8;
914 } u;
915};
916
917/* Definition of the hv_signal_event hypercall input structure. */
918struct hv_input_signal_event {
919 union hv_connection_id connectionid;
920 u16 flag_number;
921 u16 rsvdz;
922};
923
924struct hv_input_signal_event_buffer {
925 u64 align8;
926 struct hv_input_signal_event event;
927};
928
851struct vmbus_channel { 929struct vmbus_channel {
852 struct list_head listentry; 930 struct list_head listentry;
853 931
@@ -882,8 +960,42 @@ struct vmbus_channel {
882 960
883 void (*onchannel_callback)(void *context); 961 void (*onchannel_callback)(void *context);
884 void *channel_callback_context; 962 void *channel_callback_context;
963
964 /*
965 * A channel can be marked for efficient (batched)
966 * reading:
967 * If batched_reading is set to "true", we read until the
968 * channel is empty and hold off interrupts from the host
969 * during the entire read process.
970 * If batched_reading is set to "false", the client is not
971 * going to perform batched reading.
972 *
973 * By default we will enable batched reading; specific
974 * drivers that don't want this behavior can turn it off.
975 */
976
977 bool batched_reading;
978
979 bool is_dedicated_interrupt;
980 struct hv_input_signal_event_buffer sig_buf;
981 struct hv_input_signal_event *sig_event;
982
983 /*
984 * Starting with win8, this field will be used to specify
985 * the target virtual processor on which to deliver the interrupt for
986 * the host to guest communication.
987 * Prior to win8, incoming channel interrupts would only
988 * be delivered on cpu 0. Setting this value to 0 would
989 * preserve the earlier behavior.
990 */
991 u32 target_vp;
885}; 992};
886 993
994static inline void set_channel_read_state(struct vmbus_channel *c, bool state)
995{
996 c->batched_reading = state;
997}
998
887void vmbus_onmessage(void *context); 999void vmbus_onmessage(void *context);
888 1000
889int vmbus_request_offers(void); 1001int vmbus_request_offers(void);
@@ -1047,6 +1159,100 @@ void vmbus_driver_unregister(struct hv_driver *hv_driver);
1047 g8, g9, ga, gb, gc, gd, ge, gf }, 1159 g8, g9, ga, gb, gc, gd, ge, gf },
1048 1160
1049/* 1161/*
1162 * GUID definitions of various offer types - services offered to the guest.
1163 */
1164
1165/*
1166 * Network GUID
1167 * {f8615163-df3e-46c5-913f-f2d2f965ed0e}
1168 */
1169#define HV_NIC_GUID \
1170 .guid = { \
1171 0x63, 0x51, 0x61, 0xf8, 0x3e, 0xdf, 0xc5, 0x46, \
1172 0x91, 0x3f, 0xf2, 0xd2, 0xf9, 0x65, 0xed, 0x0e \
1173 }
1174
1175/*
1176 * IDE GUID
1177 * {32412632-86cb-44a2-9b5c-50d1417354f5}
1178 */
1179#define HV_IDE_GUID \
1180 .guid = { \
1181 0x32, 0x26, 0x41, 0x32, 0xcb, 0x86, 0xa2, 0x44, \
1182 0x9b, 0x5c, 0x50, 0xd1, 0x41, 0x73, 0x54, 0xf5 \
1183 }
1184
1185/*
1186 * SCSI GUID
1187 * {ba6163d9-04a1-4d29-b605-72e2ffb1dc7f}
1188 */
1189#define HV_SCSI_GUID \
1190 .guid = { \
1191 0xd9, 0x63, 0x61, 0xba, 0xa1, 0x04, 0x29, 0x4d, \
1192 0xb6, 0x05, 0x72, 0xe2, 0xff, 0xb1, 0xdc, 0x7f \
1193 }
1194
1195/*
1196 * Shutdown GUID
1197 * {0e0b6031-5213-4934-818b-38d90ced39db}
1198 */
1199#define HV_SHUTDOWN_GUID \
1200 .guid = { \
1201 0x31, 0x60, 0x0b, 0x0e, 0x13, 0x52, 0x34, 0x49, \
1202 0x81, 0x8b, 0x38, 0xd9, 0x0c, 0xed, 0x39, 0xdb \
1203 }
1204
1205/*
1206 * Time Synch GUID
1207 * {9527E630-D0AE-497b-ADCE-E80AB0175CAF}
1208 */
1209#define HV_TS_GUID \
1210 .guid = { \
1211 0x30, 0xe6, 0x27, 0x95, 0xae, 0xd0, 0x7b, 0x49, \
1212 0xad, 0xce, 0xe8, 0x0a, 0xb0, 0x17, 0x5c, 0xaf \
1213 }
1214
1215/*
1216 * Heartbeat GUID
1217 * {57164f39-9115-4e78-ab55-382f3bd5422d}
1218 */
1219#define HV_HEART_BEAT_GUID \
1220 .guid = { \
1221 0x39, 0x4f, 0x16, 0x57, 0x15, 0x91, 0x78, 0x4e, \
1222 0xab, 0x55, 0x38, 0x2f, 0x3b, 0xd5, 0x42, 0x2d \
1223 }
1224
1225/*
1226 * KVP GUID
1227 * {a9a0f4e7-5a45-4d96-b827-8a841e8c03e6}
1228 */
1229#define HV_KVP_GUID \
1230 .guid = { \
1231 0xe7, 0xf4, 0xa0, 0xa9, 0x45, 0x5a, 0x96, 0x4d, \
1232 0xb8, 0x27, 0x8a, 0x84, 0x1e, 0x8c, 0x3, 0xe6 \
1233 }
1234
1235/*
1236 * Dynamic memory GUID
1237 * {525074dc-8985-46e2-8057-a307dc18a502}
1238 */
1239#define HV_DM_GUID \
1240 .guid = { \
1241 0xdc, 0x74, 0x50, 0X52, 0x85, 0x89, 0xe2, 0x46, \
1242 0x80, 0x57, 0xa3, 0x07, 0xdc, 0x18, 0xa5, 0x02 \
1243 }
1244
1245/*
1246 * Mouse GUID
1247 * {cfa8b69e-5b4a-4cc0-b98b-8ba1a1f3f95a}
1248 */
1249#define HV_MOUSE_GUID \
1250 .guid = { \
1251 0x9e, 0xb6, 0xa8, 0xcf, 0x4a, 0x5b, 0xc0, 0x4c, \
1252 0xb9, 0x8b, 0x8b, 0xa1, 0xa1, 0xf3, 0xf9, 0x5a \
1253 }
1254
1255/*
1050 * Common header for Hyper-V ICs 1256 * Common header for Hyper-V ICs
1051 */ 1257 */
1052 1258
@@ -1150,5 +1356,11 @@ int hv_kvp_init(struct hv_util_service *);
1150void hv_kvp_deinit(void); 1356void hv_kvp_deinit(void);
1151void hv_kvp_onchannelcallback(void *); 1357void hv_kvp_onchannelcallback(void *);
1152 1358
1359/*
1360 * Negotiated version with the Host.
1361 */
1362
1363extern __u32 vmbus_proto_version;
1364
1153#endif /* __KERNEL__ */ 1365#endif /* __KERNEL__ */
1154#endif /* _HYPERV_H */ 1366#endif /* _HYPERV_H */
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index f0859cc73861..7e24fe0cfbcd 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -151,6 +151,11 @@
151/* Mesh Control 802.11s */ 151/* Mesh Control 802.11s */
152#define IEEE80211_QOS_CTL_MESH_CONTROL_PRESENT 0x0100 152#define IEEE80211_QOS_CTL_MESH_CONTROL_PRESENT 0x0100
153 153
154/* Mesh Power Save Level */
155#define IEEE80211_QOS_CTL_MESH_PS_LEVEL 0x0200
156/* Mesh Receiver Service Period Initiated */
157#define IEEE80211_QOS_CTL_RSPI 0x0400
158
154/* U-APSD queue for WMM IEs sent by AP */ 159/* U-APSD queue for WMM IEs sent by AP */
155#define IEEE80211_WMM_IE_AP_QOSINFO_UAPSD (1<<7) 160#define IEEE80211_WMM_IE_AP_QOSINFO_UAPSD (1<<7)
156#define IEEE80211_WMM_IE_AP_QOSINFO_PARAM_SET_CNT_MASK 0x0f 161#define IEEE80211_WMM_IE_AP_QOSINFO_PARAM_SET_CNT_MASK 0x0f
@@ -180,7 +185,7 @@ struct ieee80211_hdr {
180 u8 addr3[6]; 185 u8 addr3[6];
181 __le16 seq_ctrl; 186 __le16 seq_ctrl;
182 u8 addr4[6]; 187 u8 addr4[6];
183} __attribute__ ((packed)); 188} __packed;
184 189
185struct ieee80211_hdr_3addr { 190struct ieee80211_hdr_3addr {
186 __le16 frame_control; 191 __le16 frame_control;
@@ -189,7 +194,7 @@ struct ieee80211_hdr_3addr {
189 u8 addr2[6]; 194 u8 addr2[6];
190 u8 addr3[6]; 195 u8 addr3[6];
191 __le16 seq_ctrl; 196 __le16 seq_ctrl;
192} __attribute__ ((packed)); 197} __packed;
193 198
194struct ieee80211_qos_hdr { 199struct ieee80211_qos_hdr {
195 __le16 frame_control; 200 __le16 frame_control;
@@ -199,7 +204,7 @@ struct ieee80211_qos_hdr {
199 u8 addr3[6]; 204 u8 addr3[6];
200 __le16 seq_ctrl; 205 __le16 seq_ctrl;
201 __le16 qos_ctrl; 206 __le16 qos_ctrl;
202} __attribute__ ((packed)); 207} __packed;
203 208
204/** 209/**
205 * ieee80211_has_tods - check if IEEE80211_FCTL_TODS is set 210 * ieee80211_has_tods - check if IEEE80211_FCTL_TODS is set
@@ -576,7 +581,7 @@ struct ieee80211s_hdr {
576 __le32 seqnum; 581 __le32 seqnum;
577 u8 eaddr1[6]; 582 u8 eaddr1[6];
578 u8 eaddr2[6]; 583 u8 eaddr2[6];
579} __attribute__ ((packed)); 584} __packed;
580 585
581/* Mesh flags */ 586/* Mesh flags */
582#define MESH_FLAGS_AE_A4 0x1 587#define MESH_FLAGS_AE_A4 0x1
@@ -614,7 +619,7 @@ struct ieee80211_quiet_ie {
614 u8 period; 619 u8 period;
615 __le16 duration; 620 __le16 duration;
616 __le16 offset; 621 __le16 offset;
617} __attribute__ ((packed)); 622} __packed;
618 623
619/** 624/**
620 * struct ieee80211_msrment_ie 625 * struct ieee80211_msrment_ie
@@ -626,7 +631,7 @@ struct ieee80211_msrment_ie {
626 u8 mode; 631 u8 mode;
627 u8 type; 632 u8 type;
628 u8 request[0]; 633 u8 request[0];
629} __attribute__ ((packed)); 634} __packed;
630 635
631/** 636/**
632 * struct ieee80211_channel_sw_ie 637 * struct ieee80211_channel_sw_ie
@@ -637,7 +642,7 @@ struct ieee80211_channel_sw_ie {
637 u8 mode; 642 u8 mode;
638 u8 new_ch_num; 643 u8 new_ch_num;
639 u8 count; 644 u8 count;
640} __attribute__ ((packed)); 645} __packed;
641 646
642/** 647/**
643 * struct ieee80211_tim 648 * struct ieee80211_tim
@@ -650,7 +655,7 @@ struct ieee80211_tim_ie {
650 u8 bitmap_ctrl; 655 u8 bitmap_ctrl;
651 /* variable size: 1 - 251 bytes */ 656 /* variable size: 1 - 251 bytes */
652 u8 virtual_map[1]; 657 u8 virtual_map[1];
653} __attribute__ ((packed)); 658} __packed;
654 659
655/** 660/**
656 * struct ieee80211_meshconf_ie 661 * struct ieee80211_meshconf_ie
@@ -665,7 +670,7 @@ struct ieee80211_meshconf_ie {
665 u8 meshconf_auth; 670 u8 meshconf_auth;
666 u8 meshconf_form; 671 u8 meshconf_form;
667 u8 meshconf_cap; 672 u8 meshconf_cap;
668} __attribute__ ((packed)); 673} __packed;
669 674
670/** 675/**
671 * enum mesh_config_capab_flags - Mesh Configuration IE capability field flags 676 * enum mesh_config_capab_flags - Mesh Configuration IE capability field flags
@@ -675,11 +680,14 @@ struct ieee80211_meshconf_ie {
675 * @IEEE80211_MESHCONF_CAPAB_FORWARDING: the STA forwards MSDUs 680 * @IEEE80211_MESHCONF_CAPAB_FORWARDING: the STA forwards MSDUs
676 * @IEEE80211_MESHCONF_CAPAB_TBTT_ADJUSTING: TBTT adjustment procedure 681 * @IEEE80211_MESHCONF_CAPAB_TBTT_ADJUSTING: TBTT adjustment procedure
677 * is ongoing 682 * is ongoing
683 * @IEEE80211_MESHCONF_CAPAB_POWER_SAVE_LEVEL: STA is in deep sleep mode or has
684 * neighbors in deep sleep mode
678 */ 685 */
679enum mesh_config_capab_flags { 686enum mesh_config_capab_flags {
680 IEEE80211_MESHCONF_CAPAB_ACCEPT_PLINKS = 0x01, 687 IEEE80211_MESHCONF_CAPAB_ACCEPT_PLINKS = 0x01,
681 IEEE80211_MESHCONF_CAPAB_FORWARDING = 0x08, 688 IEEE80211_MESHCONF_CAPAB_FORWARDING = 0x08,
682 IEEE80211_MESHCONF_CAPAB_TBTT_ADJUSTING = 0x20, 689 IEEE80211_MESHCONF_CAPAB_TBTT_ADJUSTING = 0x20,
690 IEEE80211_MESHCONF_CAPAB_POWER_SAVE_LEVEL = 0x40,
683}; 691};
684 692
685/** 693/**
@@ -695,12 +703,41 @@ struct ieee80211_rann_ie {
695 __le32 rann_seq; 703 __le32 rann_seq;
696 __le32 rann_interval; 704 __le32 rann_interval;
697 __le32 rann_metric; 705 __le32 rann_metric;
698} __attribute__ ((packed)); 706} __packed;
699 707
700enum ieee80211_rann_flags { 708enum ieee80211_rann_flags {
701 RANN_FLAG_IS_GATE = 1 << 0, 709 RANN_FLAG_IS_GATE = 1 << 0,
702}; 710};
703 711
712enum ieee80211_ht_chanwidth_values {
713 IEEE80211_HT_CHANWIDTH_20MHZ = 0,
714 IEEE80211_HT_CHANWIDTH_ANY = 1,
715};
716
717/**
718 * enum ieee80211_opmode_bits - VHT operating mode field bits
719 * @IEEE80211_OPMODE_NOTIF_CHANWIDTH_MASK: channel width mask
720 * @IEEE80211_OPMODE_NOTIF_CHANWIDTH_20MHZ: 20 MHz channel width
721 * @IEEE80211_OPMODE_NOTIF_CHANWIDTH_40MHZ: 40 MHz channel width
722 * @IEEE80211_OPMODE_NOTIF_CHANWIDTH_80MHZ: 80 MHz channel width
723 * @IEEE80211_OPMODE_NOTIF_CHANWIDTH_160MHZ: 160 MHz or 80+80 MHz channel width
724 * @IEEE80211_OPMODE_NOTIF_RX_NSS_MASK: number of spatial streams mask
725 * (the NSS value is the value of this field + 1)
726 * @IEEE80211_OPMODE_NOTIF_RX_NSS_SHIFT: number of spatial streams shift
727 * @IEEE80211_OPMODE_NOTIF_RX_NSS_TYPE_BF: indicates streams in SU-MIMO PPDU
728 * using a beamforming steering matrix
729 */
730enum ieee80211_vht_opmode_bits {
731 IEEE80211_OPMODE_NOTIF_CHANWIDTH_MASK = 3,
732 IEEE80211_OPMODE_NOTIF_CHANWIDTH_20MHZ = 0,
733 IEEE80211_OPMODE_NOTIF_CHANWIDTH_40MHZ = 1,
734 IEEE80211_OPMODE_NOTIF_CHANWIDTH_80MHZ = 2,
735 IEEE80211_OPMODE_NOTIF_CHANWIDTH_160MHZ = 3,
736 IEEE80211_OPMODE_NOTIF_RX_NSS_MASK = 0x70,
737 IEEE80211_OPMODE_NOTIF_RX_NSS_SHIFT = 4,
738 IEEE80211_OPMODE_NOTIF_RX_NSS_TYPE_BF = 0x80,
739};
740
704#define WLAN_SA_QUERY_TR_ID_LEN 2 741#define WLAN_SA_QUERY_TR_ID_LEN 2
705 742
706struct ieee80211_mgmt { 743struct ieee80211_mgmt {
@@ -717,33 +754,33 @@ struct ieee80211_mgmt {
717 __le16 status_code; 754 __le16 status_code;
718 /* possibly followed by Challenge text */ 755 /* possibly followed by Challenge text */
719 u8 variable[0]; 756 u8 variable[0];
720 } __attribute__ ((packed)) auth; 757 } __packed auth;
721 struct { 758 struct {
722 __le16 reason_code; 759 __le16 reason_code;
723 } __attribute__ ((packed)) deauth; 760 } __packed deauth;
724 struct { 761 struct {
725 __le16 capab_info; 762 __le16 capab_info;
726 __le16 listen_interval; 763 __le16 listen_interval;
727 /* followed by SSID and Supported rates */ 764 /* followed by SSID and Supported rates */
728 u8 variable[0]; 765 u8 variable[0];
729 } __attribute__ ((packed)) assoc_req; 766 } __packed assoc_req;
730 struct { 767 struct {
731 __le16 capab_info; 768 __le16 capab_info;
732 __le16 status_code; 769 __le16 status_code;
733 __le16 aid; 770 __le16 aid;
734 /* followed by Supported rates */ 771 /* followed by Supported rates */
735 u8 variable[0]; 772 u8 variable[0];
736 } __attribute__ ((packed)) assoc_resp, reassoc_resp; 773 } __packed assoc_resp, reassoc_resp;
737 struct { 774 struct {
738 __le16 capab_info; 775 __le16 capab_info;
739 __le16 listen_interval; 776 __le16 listen_interval;
740 u8 current_ap[6]; 777 u8 current_ap[6];
741 /* followed by SSID and Supported rates */ 778 /* followed by SSID and Supported rates */
742 u8 variable[0]; 779 u8 variable[0];
743 } __attribute__ ((packed)) reassoc_req; 780 } __packed reassoc_req;
744 struct { 781 struct {
745 __le16 reason_code; 782 __le16 reason_code;
746 } __attribute__ ((packed)) disassoc; 783 } __packed disassoc;
747 struct { 784 struct {
748 __le64 timestamp; 785 __le64 timestamp;
749 __le16 beacon_int; 786 __le16 beacon_int;
@@ -751,11 +788,11 @@ struct ieee80211_mgmt {
751 /* followed by some of SSID, Supported rates, 788 /* followed by some of SSID, Supported rates,
752 * FH Params, DS Params, CF Params, IBSS Params, TIM */ 789 * FH Params, DS Params, CF Params, IBSS Params, TIM */
753 u8 variable[0]; 790 u8 variable[0];
754 } __attribute__ ((packed)) beacon; 791 } __packed beacon;
755 struct { 792 struct {
756 /* only variable items: SSID, Supported rates */ 793 /* only variable items: SSID, Supported rates */
757 u8 variable[0]; 794 u8 variable[0];
758 } __attribute__ ((packed)) probe_req; 795 } __packed probe_req;
759 struct { 796 struct {
760 __le64 timestamp; 797 __le64 timestamp;
761 __le16 beacon_int; 798 __le16 beacon_int;
@@ -763,7 +800,7 @@ struct ieee80211_mgmt {
763 /* followed by some of SSID, Supported rates, 800 /* followed by some of SSID, Supported rates,
764 * FH Params, DS Params, CF Params, IBSS Params */ 801 * FH Params, DS Params, CF Params, IBSS Params */
765 u8 variable[0]; 802 u8 variable[0];
766 } __attribute__ ((packed)) probe_resp; 803 } __packed probe_resp;
767 struct { 804 struct {
768 u8 category; 805 u8 category;
769 union { 806 union {
@@ -772,65 +809,73 @@ struct ieee80211_mgmt {
772 u8 dialog_token; 809 u8 dialog_token;
773 u8 status_code; 810 u8 status_code;
774 u8 variable[0]; 811 u8 variable[0];
775 } __attribute__ ((packed)) wme_action; 812 } __packed wme_action;
776 struct{ 813 struct{
777 u8 action_code; 814 u8 action_code;
778 u8 element_id; 815 u8 element_id;
779 u8 length; 816 u8 length;
780 struct ieee80211_channel_sw_ie sw_elem; 817 struct ieee80211_channel_sw_ie sw_elem;
781 } __attribute__((packed)) chan_switch; 818 } __packed chan_switch;
782 struct{ 819 struct{
783 u8 action_code; 820 u8 action_code;
784 u8 dialog_token; 821 u8 dialog_token;
785 u8 element_id; 822 u8 element_id;
786 u8 length; 823 u8 length;
787 struct ieee80211_msrment_ie msr_elem; 824 struct ieee80211_msrment_ie msr_elem;
788 } __attribute__((packed)) measurement; 825 } __packed measurement;
789 struct{ 826 struct{
790 u8 action_code; 827 u8 action_code;
791 u8 dialog_token; 828 u8 dialog_token;
792 __le16 capab; 829 __le16 capab;
793 __le16 timeout; 830 __le16 timeout;
794 __le16 start_seq_num; 831 __le16 start_seq_num;
795 } __attribute__((packed)) addba_req; 832 } __packed addba_req;
796 struct{ 833 struct{
797 u8 action_code; 834 u8 action_code;
798 u8 dialog_token; 835 u8 dialog_token;
799 __le16 status; 836 __le16 status;
800 __le16 capab; 837 __le16 capab;
801 __le16 timeout; 838 __le16 timeout;
802 } __attribute__((packed)) addba_resp; 839 } __packed addba_resp;
803 struct{ 840 struct{
804 u8 action_code; 841 u8 action_code;
805 __le16 params; 842 __le16 params;
806 __le16 reason_code; 843 __le16 reason_code;
807 } __attribute__((packed)) delba; 844 } __packed delba;
808 struct { 845 struct {
809 u8 action_code; 846 u8 action_code;
810 u8 variable[0]; 847 u8 variable[0];
811 } __attribute__((packed)) self_prot; 848 } __packed self_prot;
812 struct{ 849 struct{
813 u8 action_code; 850 u8 action_code;
814 u8 variable[0]; 851 u8 variable[0];
815 } __attribute__((packed)) mesh_action; 852 } __packed mesh_action;
816 struct { 853 struct {
817 u8 action; 854 u8 action;
818 u8 trans_id[WLAN_SA_QUERY_TR_ID_LEN]; 855 u8 trans_id[WLAN_SA_QUERY_TR_ID_LEN];
819 } __attribute__ ((packed)) sa_query; 856 } __packed sa_query;
820 struct { 857 struct {
821 u8 action; 858 u8 action;
822 u8 smps_control; 859 u8 smps_control;
823 } __attribute__ ((packed)) ht_smps; 860 } __packed ht_smps;
861 struct {
862 u8 action_code;
863 u8 chanwidth;
864 } __packed ht_notify_cw;
824 struct { 865 struct {
825 u8 action_code; 866 u8 action_code;
826 u8 dialog_token; 867 u8 dialog_token;
827 __le16 capability; 868 __le16 capability;
828 u8 variable[0]; 869 u8 variable[0];
829 } __packed tdls_discover_resp; 870 } __packed tdls_discover_resp;
871 struct {
872 u8 action_code;
873 u8 operating_mode;
874 } __packed vht_opmode_notif;
830 } u; 875 } u;
831 } __attribute__ ((packed)) action; 876 } __packed action;
832 } u; 877 } u;
833} __attribute__ ((packed)); 878} __packed;
834 879
835/* Supported Rates value encodings in 802.11n-2009 7.3.2.2 */ 880/* Supported Rates value encodings in 802.11n-2009 7.3.2.2 */
836#define BSS_MEMBERSHIP_SELECTOR_HT_PHY 127 881#define BSS_MEMBERSHIP_SELECTOR_HT_PHY 127
@@ -846,7 +891,7 @@ struct ieee80211_mmie {
846 __le16 key_id; 891 __le16 key_id;
847 u8 sequence_number[6]; 892 u8 sequence_number[6];
848 u8 mic[8]; 893 u8 mic[8];
849} __attribute__ ((packed)); 894} __packed;
850 895
851struct ieee80211_vendor_ie { 896struct ieee80211_vendor_ie {
852 u8 element_id; 897 u8 element_id;
@@ -861,20 +906,20 @@ struct ieee80211_rts {
861 __le16 duration; 906 __le16 duration;
862 u8 ra[6]; 907 u8 ra[6];
863 u8 ta[6]; 908 u8 ta[6];
864} __attribute__ ((packed)); 909} __packed;
865 910
866struct ieee80211_cts { 911struct ieee80211_cts {
867 __le16 frame_control; 912 __le16 frame_control;
868 __le16 duration; 913 __le16 duration;
869 u8 ra[6]; 914 u8 ra[6];
870} __attribute__ ((packed)); 915} __packed;
871 916
872struct ieee80211_pspoll { 917struct ieee80211_pspoll {
873 __le16 frame_control; 918 __le16 frame_control;
874 __le16 aid; 919 __le16 aid;
875 u8 bssid[6]; 920 u8 bssid[6];
876 u8 ta[6]; 921 u8 ta[6];
877} __attribute__ ((packed)); 922} __packed;
878 923
879/* TDLS */ 924/* TDLS */
880 925
@@ -967,7 +1012,7 @@ struct ieee80211_bar {
967 __u8 ta[6]; 1012 __u8 ta[6];
968 __le16 control; 1013 __le16 control;
969 __le16 start_seq_num; 1014 __le16 start_seq_num;
970} __attribute__((packed)); 1015} __packed;
971 1016
972/* 802.11 BAR control masks */ 1017/* 802.11 BAR control masks */
973#define IEEE80211_BAR_CTRL_ACK_POLICY_NORMAL 0x0000 1018#define IEEE80211_BAR_CTRL_ACK_POLICY_NORMAL 0x0000
@@ -992,7 +1037,7 @@ struct ieee80211_mcs_info {
992 __le16 rx_highest; 1037 __le16 rx_highest;
993 u8 tx_params; 1038 u8 tx_params;
994 u8 reserved[3]; 1039 u8 reserved[3];
995} __attribute__((packed)); 1040} __packed;
996 1041
997/* 802.11n HT capability MSC set */ 1042/* 802.11n HT capability MSC set */
998#define IEEE80211_HT_MCS_RX_HIGHEST_MASK 0x3ff 1043#define IEEE80211_HT_MCS_RX_HIGHEST_MASK 0x3ff
@@ -1031,7 +1076,7 @@ struct ieee80211_ht_cap {
1031 __le16 extended_ht_cap_info; 1076 __le16 extended_ht_cap_info;
1032 __le32 tx_BF_cap_info; 1077 __le32 tx_BF_cap_info;
1033 u8 antenna_selection_info; 1078 u8 antenna_selection_info;
1034} __attribute__ ((packed)); 1079} __packed;
1035 1080
1036/* 802.11n HT capabilities masks (for cap_info) */ 1081/* 802.11n HT capabilities masks (for cap_info) */
1037#define IEEE80211_HT_CAP_LDPC_CODING 0x0001 1082#define IEEE80211_HT_CAP_LDPC_CODING 0x0001
@@ -1102,7 +1147,7 @@ struct ieee80211_ht_operation {
1102 __le16 operation_mode; 1147 __le16 operation_mode;
1103 __le16 stbc_param; 1148 __le16 stbc_param;
1104 u8 basic_set[16]; 1149 u8 basic_set[16];
1105} __attribute__ ((packed)); 1150} __packed;
1106 1151
1107/* for ht_param */ 1152/* for ht_param */
1108#define IEEE80211_HT_PARAM_CHA_SEC_OFFSET 0x03 1153#define IEEE80211_HT_PARAM_CHA_SEC_OFFSET 0x03
@@ -1256,6 +1301,7 @@ struct ieee80211_vht_operation {
1256#define IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454 0x00000002 1301#define IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454 0x00000002
1257#define IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ 0x00000004 1302#define IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ 0x00000004
1258#define IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ 0x00000008 1303#define IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ 0x00000008
1304#define IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK 0x0000000C
1259#define IEEE80211_VHT_CAP_RXLDPC 0x00000010 1305#define IEEE80211_VHT_CAP_RXLDPC 0x00000010
1260#define IEEE80211_VHT_CAP_SHORT_GI_80 0x00000020 1306#define IEEE80211_VHT_CAP_SHORT_GI_80 0x00000020
1261#define IEEE80211_VHT_CAP_SHORT_GI_160 0x00000040 1307#define IEEE80211_VHT_CAP_SHORT_GI_160 0x00000040
@@ -1311,16 +1357,21 @@ struct ieee80211_vht_operation {
1311#define WLAN_CAPABILITY_SPECTRUM_MGMT (1<<8) 1357#define WLAN_CAPABILITY_SPECTRUM_MGMT (1<<8)
1312#define WLAN_CAPABILITY_QOS (1<<9) 1358#define WLAN_CAPABILITY_QOS (1<<9)
1313#define WLAN_CAPABILITY_SHORT_SLOT_TIME (1<<10) 1359#define WLAN_CAPABILITY_SHORT_SLOT_TIME (1<<10)
1360#define WLAN_CAPABILITY_APSD (1<<11)
1361#define WLAN_CAPABILITY_RADIO_MEASURE (1<<12)
1314#define WLAN_CAPABILITY_DSSS_OFDM (1<<13) 1362#define WLAN_CAPABILITY_DSSS_OFDM (1<<13)
1363#define WLAN_CAPABILITY_DEL_BACK (1<<14)
1364#define WLAN_CAPABILITY_IMM_BACK (1<<15)
1315 1365
1316/* DMG (60gHz) 802.11ad */ 1366/* DMG (60gHz) 802.11ad */
1317/* type - bits 0..1 */ 1367/* type - bits 0..1 */
1368#define WLAN_CAPABILITY_DMG_TYPE_MASK (3<<0)
1318#define WLAN_CAPABILITY_DMG_TYPE_IBSS (1<<0) /* Tx by: STA */ 1369#define WLAN_CAPABILITY_DMG_TYPE_IBSS (1<<0) /* Tx by: STA */
1319#define WLAN_CAPABILITY_DMG_TYPE_PBSS (2<<0) /* Tx by: PCP */ 1370#define WLAN_CAPABILITY_DMG_TYPE_PBSS (2<<0) /* Tx by: PCP */
1320#define WLAN_CAPABILITY_DMG_TYPE_AP (3<<0) /* Tx by: AP */ 1371#define WLAN_CAPABILITY_DMG_TYPE_AP (3<<0) /* Tx by: AP */
1321 1372
1322#define WLAN_CAPABILITY_DMG_CBAP_ONLY (1<<2) 1373#define WLAN_CAPABILITY_DMG_CBAP_ONLY (1<<2)
1323#define WLAN_CAPABILITY_DMG_CBAP_SOURCE (1<<3) 1374#define WLAN_CAPABILITY_DMG_CBAP_SOURCE (1<<3)
1324#define WLAN_CAPABILITY_DMG_PRIVACY (1<<4) 1375#define WLAN_CAPABILITY_DMG_PRIVACY (1<<4)
1325#define WLAN_CAPABILITY_DMG_ECPAC (1<<5) 1376#define WLAN_CAPABILITY_DMG_ECPAC (1<<5)
1326 1377
@@ -1576,6 +1627,7 @@ enum ieee80211_eid {
1576 1627
1577 WLAN_EID_VHT_CAPABILITY = 191, 1628 WLAN_EID_VHT_CAPABILITY = 191,
1578 WLAN_EID_VHT_OPERATION = 192, 1629 WLAN_EID_VHT_OPERATION = 192,
1630 WLAN_EID_OPMODE_NOTIF = 199,
1579 1631
1580 /* 802.11ad */ 1632 /* 802.11ad */
1581 WLAN_EID_NON_TX_BSSID_CAP = 83, 1633 WLAN_EID_NON_TX_BSSID_CAP = 83,
@@ -1630,6 +1682,7 @@ enum ieee80211_category {
1630 WLAN_CATEGORY_WMM = 17, 1682 WLAN_CATEGORY_WMM = 17,
1631 WLAN_CATEGORY_FST = 18, 1683 WLAN_CATEGORY_FST = 18,
1632 WLAN_CATEGORY_UNPROT_DMG = 20, 1684 WLAN_CATEGORY_UNPROT_DMG = 20,
1685 WLAN_CATEGORY_VHT = 21,
1633 WLAN_CATEGORY_VENDOR_SPECIFIC_PROTECTED = 126, 1686 WLAN_CATEGORY_VENDOR_SPECIFIC_PROTECTED = 126,
1634 WLAN_CATEGORY_VENDOR_SPECIFIC = 127, 1687 WLAN_CATEGORY_VENDOR_SPECIFIC = 127,
1635}; 1688};
@@ -1655,6 +1708,13 @@ enum ieee80211_ht_actioncode {
1655 WLAN_HT_ACTION_ASEL_IDX_FEEDBACK = 7, 1708 WLAN_HT_ACTION_ASEL_IDX_FEEDBACK = 7,
1656}; 1709};
1657 1710
1711/* VHT action codes */
1712enum ieee80211_vht_actioncode {
1713 WLAN_VHT_ACTION_COMPRESSED_BF = 0,
1714 WLAN_VHT_ACTION_GROUPID_MGMT = 1,
1715 WLAN_VHT_ACTION_OPMODE_NOTIF = 2,
1716};
1717
1658/* Self Protected Action codes */ 1718/* Self Protected Action codes */
1659enum ieee80211_self_protected_actioncode { 1719enum ieee80211_self_protected_actioncode {
1660 WLAN_SP_RESERVED = 0, 1720 WLAN_SP_RESERVED = 0,
@@ -1716,6 +1776,8 @@ enum ieee80211_tdls_actioncode {
1716#define WLAN_EXT_CAPA5_TDLS_ENABLED BIT(5) 1776#define WLAN_EXT_CAPA5_TDLS_ENABLED BIT(5)
1717#define WLAN_EXT_CAPA5_TDLS_PROHIBITED BIT(6) 1777#define WLAN_EXT_CAPA5_TDLS_PROHIBITED BIT(6)
1718 1778
1779#define WLAN_EXT_CAPA8_OPMODE_NOTIF BIT(6)
1780
1719/* TDLS specific payload type in the LLC/SNAP header */ 1781/* TDLS specific payload type in the LLC/SNAP header */
1720#define WLAN_TDLS_SNAP_RFTYPE 0x2 1782#define WLAN_TDLS_SNAP_RFTYPE 0x2
1721 1783
@@ -1834,14 +1896,14 @@ struct ieee80211_country_ie_triplet {
1834 u8 first_channel; 1896 u8 first_channel;
1835 u8 num_channels; 1897 u8 num_channels;
1836 s8 max_power; 1898 s8 max_power;
1837 } __attribute__ ((packed)) chans; 1899 } __packed chans;
1838 struct { 1900 struct {
1839 u8 reg_extension_id; 1901 u8 reg_extension_id;
1840 u8 reg_class; 1902 u8 reg_class;
1841 u8 coverage_class; 1903 u8 coverage_class;
1842 } __attribute__ ((packed)) ext; 1904 } __packed ext;
1843 }; 1905 };
1844} __attribute__ ((packed)); 1906} __packed;
1845 1907
1846enum ieee80211_timeout_interval_type { 1908enum ieee80211_timeout_interval_type {
1847 WLAN_TIMEOUT_REASSOC_DEADLINE = 1 /* 802.11r */, 1909 WLAN_TIMEOUT_REASSOC_DEADLINE = 1 /* 802.11r */,
@@ -1884,7 +1946,10 @@ enum ieee80211_sa_query_action {
1884/* AKM suite selectors */ 1946/* AKM suite selectors */
1885#define WLAN_AKM_SUITE_8021X 0x000FAC01 1947#define WLAN_AKM_SUITE_8021X 0x000FAC01
1886#define WLAN_AKM_SUITE_PSK 0x000FAC02 1948#define WLAN_AKM_SUITE_PSK 0x000FAC02
1887#define WLAN_AKM_SUITE_SAE 0x000FAC08 1949#define WLAN_AKM_SUITE_8021X_SHA256 0x000FAC05
1950#define WLAN_AKM_SUITE_PSK_SHA256 0x000FAC06
1951#define WLAN_AKM_SUITE_TDLS 0x000FAC07
1952#define WLAN_AKM_SUITE_SAE 0x000FAC08
1888#define WLAN_AKM_SUITE_FT_OVER_SAE 0x000FAC09 1953#define WLAN_AKM_SUITE_FT_OVER_SAE 0x000FAC09
1889 1954
1890#define WLAN_MAX_KEY_LEN 32 1955#define WLAN_MAX_KEY_LEN 32
@@ -2089,7 +2154,7 @@ static inline unsigned long ieee80211_tu_to_usec(unsigned long tu)
2089 * @tim_len: length of the TIM IE 2154 * @tim_len: length of the TIM IE
2090 * @aid: the AID to look for 2155 * @aid: the AID to look for
2091 */ 2156 */
2092static inline bool ieee80211_check_tim(struct ieee80211_tim_ie *tim, 2157static inline bool ieee80211_check_tim(const struct ieee80211_tim_ie *tim,
2093 u8 tim_len, u16 aid) 2158 u8 tim_len, u16 aid)
2094{ 2159{
2095 u8 mask; 2160 u8 mask;
diff --git a/include/linux/if_macvlan.h b/include/linux/if_macvlan.h
index f65e8d250f7e..84dde1dd1da4 100644
--- a/include/linux/if_macvlan.h
+++ b/include/linux/if_macvlan.h
@@ -52,6 +52,9 @@ struct macvlan_pcpu_stats {
52 */ 52 */
53#define MAX_MACVTAP_QUEUES (NR_CPUS < 16 ? NR_CPUS : 16) 53#define MAX_MACVTAP_QUEUES (NR_CPUS < 16 ? NR_CPUS : 16)
54 54
55#define MACVLAN_MC_FILTER_BITS 8
56#define MACVLAN_MC_FILTER_SZ (1 << MACVLAN_MC_FILTER_BITS)
57
55struct macvlan_dev { 58struct macvlan_dev {
56 struct net_device *dev; 59 struct net_device *dev;
57 struct list_head list; 60 struct list_head list;
@@ -59,6 +62,9 @@ struct macvlan_dev {
59 struct macvlan_port *port; 62 struct macvlan_port *port;
60 struct net_device *lowerdev; 63 struct net_device *lowerdev;
61 struct macvlan_pcpu_stats __percpu *pcpu_stats; 64 struct macvlan_pcpu_stats __percpu *pcpu_stats;
65
66 DECLARE_BITMAP(mc_filter, MACVLAN_MC_FILTER_SZ);
67
62 enum macvlan_mode mode; 68 enum macvlan_mode mode;
63 u16 flags; 69 u16 flags;
64 int (*receive)(struct sk_buff *skb); 70 int (*receive)(struct sk_buff *skb);
diff --git a/include/linux/if_team.h b/include/linux/if_team.h
index 0245def2aa93..4648d8021244 100644
--- a/include/linux/if_team.h
+++ b/include/linux/if_team.h
@@ -186,6 +186,7 @@ struct team {
186 186
187 const struct team_mode *mode; 187 const struct team_mode *mode;
188 struct team_mode_ops ops; 188 struct team_mode_ops ops;
189 bool user_carrier_enabled;
189 bool queue_override_enabled; 190 bool queue_override_enabled;
190 struct list_head *qom_lists; /* array of queue override mapping lists */ 191 struct list_head *qom_lists; /* array of queue override mapping lists */
191 long mode_priv[TEAM_MODE_PRIV_LONGS]; 192 long mode_priv[TEAM_MODE_PRIV_LONGS];
diff --git a/include/linux/iio/buffer.h b/include/linux/iio/buffer.h
index f3eea18fdf46..2bac0eb8948d 100644
--- a/include/linux/iio/buffer.h
+++ b/include/linux/iio/buffer.h
@@ -103,19 +103,6 @@ int iio_update_buffers(struct iio_dev *indio_dev,
103 **/ 103 **/
104void iio_buffer_init(struct iio_buffer *buffer); 104void iio_buffer_init(struct iio_buffer *buffer);
105 105
106/**
107 * __iio_update_buffer() - update common elements of buffers
108 * @buffer: buffer that is the event source
109 * @bytes_per_datum: size of individual datum including timestamp
110 * @length: number of datums in buffer
111 **/
112static inline void __iio_update_buffer(struct iio_buffer *buffer,
113 int bytes_per_datum, int length)
114{
115 buffer->bytes_per_datum = bytes_per_datum;
116 buffer->length = length;
117}
118
119int iio_scan_mask_query(struct iio_dev *indio_dev, 106int iio_scan_mask_query(struct iio_dev *indio_dev,
120 struct iio_buffer *buffer, int bit); 107 struct iio_buffer *buffer, int bit);
121 108
diff --git a/include/linux/iio/common/st_sensors.h b/include/linux/iio/common/st_sensors.h
new file mode 100644
index 000000000000..1f86a97ab2e2
--- /dev/null
+++ b/include/linux/iio/common/st_sensors.h
@@ -0,0 +1,280 @@
1/*
2 * STMicroelectronics sensors library driver
3 *
4 * Copyright 2012-2013 STMicroelectronics Inc.
5 *
6 * Denis Ciocca <denis.ciocca@st.com>
7 *
8 * Licensed under the GPL-2.
9 */
10
11#ifndef ST_SENSORS_H
12#define ST_SENSORS_H
13
14#include <linux/i2c.h>
15#include <linux/spi/spi.h>
16#include <linux/irqreturn.h>
17#include <linux/iio/trigger.h>
18
19#define ST_SENSORS_TX_MAX_LENGTH 2
20#define ST_SENSORS_RX_MAX_LENGTH 6
21
22#define ST_SENSORS_ODR_LIST_MAX 10
23#define ST_SENSORS_FULLSCALE_AVL_MAX 10
24
25#define ST_SENSORS_NUMBER_ALL_CHANNELS 4
26#define ST_SENSORS_NUMBER_DATA_CHANNELS 3
27#define ST_SENSORS_ENABLE_ALL_AXIS 0x07
28#define ST_SENSORS_BYTE_FOR_CHANNEL 2
29#define ST_SENSORS_SCAN_X 0
30#define ST_SENSORS_SCAN_Y 1
31#define ST_SENSORS_SCAN_Z 2
32#define ST_SENSORS_DEFAULT_12_REALBITS 12
33#define ST_SENSORS_DEFAULT_16_REALBITS 16
34#define ST_SENSORS_DEFAULT_POWER_ON_VALUE 0x01
35#define ST_SENSORS_DEFAULT_POWER_OFF_VALUE 0x00
36#define ST_SENSORS_DEFAULT_WAI_ADDRESS 0x0f
37#define ST_SENSORS_DEFAULT_AXIS_ADDR 0x20
38#define ST_SENSORS_DEFAULT_AXIS_MASK 0x07
39#define ST_SENSORS_DEFAULT_AXIS_N_BIT 3
40
41#define ST_SENSORS_MAX_NAME 17
42#define ST_SENSORS_MAX_4WAI 7
43
44#define ST_SENSORS_LSM_CHANNELS(device_type, index, mod, endian, bits, addr) \
45{ \
46 .type = device_type, \
47 .modified = 1, \
48 .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \
49 IIO_CHAN_INFO_SCALE_SEPARATE_BIT, \
50 .scan_index = index, \
51 .channel2 = mod, \
52 .address = addr, \
53 .scan_type = { \
54 .sign = 's', \
55 .realbits = bits, \
56 .shift = 16 - bits, \
57 .storagebits = 16, \
58 .endianness = endian, \
59 }, \
60}
61
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() \
68 IIO_DEV_ATTR_SAMP_FREQ_AVAIL( \
69 st_sensors_sysfs_sampling_frequency_avail)
70
71#define ST_SENSORS_DEV_ATTR_SCALE_AVAIL(name) \
72 IIO_DEVICE_ATTR(name, S_IRUGO, \
73 st_sensors_sysfs_scale_avail, NULL , 0);
74
75struct st_sensor_odr_avl {
76 unsigned int hz;
77 u8 value;
78};
79
80struct st_sensor_odr {
81 u8 addr;
82 u8 mask;
83 struct st_sensor_odr_avl odr_avl[ST_SENSORS_ODR_LIST_MAX];
84};
85
86struct st_sensor_power {
87 u8 addr;
88 u8 mask;
89 u8 value_off;
90 u8 value_on;
91};
92
93struct st_sensor_axis {
94 u8 addr;
95 u8 mask;
96};
97
98struct st_sensor_fullscale_avl {
99 unsigned int num;
100 u8 value;
101 unsigned int gain;
102 unsigned int gain2;
103};
104
105struct st_sensor_fullscale {
106 u8 addr;
107 u8 mask;
108 struct st_sensor_fullscale_avl fs_avl[ST_SENSORS_FULLSCALE_AVL_MAX];
109};
110
111/**
112 * struct st_sensor_bdu - ST sensor device block data update
113 * @addr: address of the register.
114 * @mask: mask to write the block data update flag.
115 */
116struct st_sensor_bdu {
117 u8 addr;
118 u8 mask;
119};
120
121/**
122 * struct st_sensor_data_ready_irq - ST sensor device data-ready interrupt
123 * @addr: address of the register.
124 * @mask: mask to write the on/off value.
125 * struct ig1 - represents the Interrupt Generator 1 of sensors.
126 * @en_addr: address of the enable ig1 register.
127 * @en_mask: mask to write the on/off value for enable.
128 */
129struct st_sensor_data_ready_irq {
130 u8 addr;
131 u8 mask;
132 struct {
133 u8 en_addr;
134 u8 en_mask;
135 } ig1;
136};
137
138/**
139 * struct st_sensor_transfer_buffer - ST sensor device I/O buffer
140 * @buf_lock: Mutex to protect rx and tx buffers.
141 * @tx_buf: Buffer used by SPI transfer function to send data to the sensors.
142 * This buffer is used to avoid DMA not-aligned issue.
143 * @rx_buf: Buffer used by SPI transfer to receive data from sensors.
144 * This buffer is used to avoid DMA not-aligned issue.
145 */
146struct st_sensor_transfer_buffer {
147 struct mutex buf_lock;
148 u8 rx_buf[ST_SENSORS_RX_MAX_LENGTH];
149 u8 tx_buf[ST_SENSORS_TX_MAX_LENGTH] ____cacheline_aligned;
150};
151
152/**
153 * struct st_sensor_transfer_function - ST sensor device I/O function
154 * @read_byte: Function used to read one byte.
155 * @write_byte: Function used to write one byte.
156 * @read_multiple_byte: Function used to read multiple byte.
157 */
158struct st_sensor_transfer_function {
159 int (*read_byte) (struct st_sensor_transfer_buffer *tb,
160 struct device *dev, u8 reg_addr, u8 *res_byte);
161 int (*write_byte) (struct st_sensor_transfer_buffer *tb,
162 struct device *dev, u8 reg_addr, u8 data);
163 int (*read_multiple_byte) (struct st_sensor_transfer_buffer *tb,
164 struct device *dev, u8 reg_addr, int len, u8 *data,
165 bool multiread_bit);
166};
167
168/**
169 * struct st_sensors - ST sensors list
170 * @wai: Contents of WhoAmI register.
171 * @sensors_supported: List of supported sensors by struct itself.
172 * @ch: IIO channels for the sensor.
173 * @odr: Output data rate register and ODR list available.
174 * @pw: Power register of the sensor.
175 * @enable_axis: Enable one or more axis of the sensor.
176 * @fs: Full scale register and full scale list available.
177 * @bdu: Block data update register.
178 * @drdy_irq: Data ready register of the sensor.
179 * @multi_read_bit: Use or not particular bit for [I2C/SPI] multi-read.
180 * @bootime: samples to discard when sensor passing from power-down to power-up.
181 */
182struct st_sensors {
183 u8 wai;
184 char sensors_supported[ST_SENSORS_MAX_4WAI][ST_SENSORS_MAX_NAME];
185 struct iio_chan_spec *ch;
186 struct st_sensor_odr odr;
187 struct st_sensor_power pw;
188 struct st_sensor_axis enable_axis;
189 struct st_sensor_fullscale fs;
190 struct st_sensor_bdu bdu;
191 struct st_sensor_data_ready_irq drdy_irq;
192 bool multi_read_bit;
193 unsigned int bootime;
194};
195
196/**
197 * struct st_sensor_data - ST sensor device status
198 * @dev: Pointer to instance of struct device (I2C or SPI).
199 * @trig: The trigger in use by the core driver.
200 * @sensor: Pointer to the current sensor struct in use.
201 * @current_fullscale: Maximum range of measure by the sensor.
202 * @enabled: Status of the sensor (false->off, true->on).
203 * @multiread_bit: Use or not particular bit for [I2C/SPI] multiread.
204 * @buffer_data: Data used by buffer part.
205 * @odr: Output data rate of the sensor [Hz].
206 * @get_irq_data_ready: Function to get the IRQ used for data ready signal.
207 * @tf: Transfer function structure used by I/O operations.
208 * @tb: Transfer buffers and mutex used by I/O operations.
209 */
210struct st_sensor_data {
211 struct device *dev;
212 struct iio_trigger *trig;
213 struct st_sensors *sensor;
214 struct st_sensor_fullscale_avl *current_fullscale;
215
216 bool enabled;
217 bool multiread_bit;
218
219 char *buffer_data;
220
221 unsigned int odr;
222
223 unsigned int (*get_irq_data_ready) (struct iio_dev *indio_dev);
224
225 const struct st_sensor_transfer_function *tf;
226 struct st_sensor_transfer_buffer tb;
227};
228
229#ifdef CONFIG_IIO_BUFFER
230int st_sensors_allocate_trigger(struct iio_dev *indio_dev,
231 const struct iio_trigger_ops *trigger_ops);
232
233void st_sensors_deallocate_trigger(struct iio_dev *indio_dev);
234
235irqreturn_t st_sensors_trigger_handler(int irq, void *p);
236
237int st_sensors_get_buffer_element(struct iio_dev *indio_dev, u8 *buf);
238#else
239static inline int st_sensors_allocate_trigger(struct iio_dev *indio_dev,
240 const struct iio_trigger_ops *trigger_ops)
241{
242 return 0;
243}
244static inline void st_sensors_deallocate_trigger(struct iio_dev *indio_dev)
245{
246 return;
247}
248#endif
249
250int st_sensors_init_sensor(struct iio_dev *indio_dev);
251
252int st_sensors_set_enable(struct iio_dev *indio_dev, bool enable);
253
254int st_sensors_set_axis_enable(struct iio_dev *indio_dev, u8 axis_enable);
255
256int st_sensors_set_odr(struct iio_dev *indio_dev, unsigned int odr);
257
258int st_sensors_set_dataready_irq(struct iio_dev *indio_dev, bool enable);
259
260int st_sensors_set_fullscale_by_gain(struct iio_dev *indio_dev, int scale);
261
262int st_sensors_read_info_raw(struct iio_dev *indio_dev,
263 struct iio_chan_spec const *ch, int *val);
264
265int st_sensors_check_device_support(struct iio_dev *indio_dev,
266 int num_sensors_list, const struct st_sensors *sensors);
267
268ssize_t st_sensors_sysfs_get_sampling_frequency(struct device *dev,
269 struct device_attribute *attr, char *buf);
270
271ssize_t st_sensors_sysfs_set_sampling_frequency(struct device *dev,
272 struct device_attribute *attr, const char *buf, size_t size);
273
274ssize_t st_sensors_sysfs_sampling_frequency_avail(struct device *dev,
275 struct device_attribute *attr, char *buf);
276
277ssize_t st_sensors_sysfs_scale_avail(struct device *dev,
278 struct device_attribute *attr, char *buf);
279
280#endif /* ST_SENSORS_H */
diff --git a/include/linux/iio/common/st_sensors_i2c.h b/include/linux/iio/common/st_sensors_i2c.h
new file mode 100644
index 000000000000..67d845385ae2
--- /dev/null
+++ b/include/linux/iio/common/st_sensors_i2c.h
@@ -0,0 +1,20 @@
1/*
2 * STMicroelectronics sensors i2c library driver
3 *
4 * Copyright 2012-2013 STMicroelectronics Inc.
5 *
6 * Denis Ciocca <denis.ciocca@st.com>
7 *
8 * Licensed under the GPL-2.
9 */
10
11#ifndef ST_SENSORS_I2C_H
12#define ST_SENSORS_I2C_H
13
14#include <linux/i2c.h>
15#include <linux/iio/common/st_sensors.h>
16
17void st_sensors_i2c_configure(struct iio_dev *indio_dev,
18 struct i2c_client *client, struct st_sensor_data *sdata);
19
20#endif /* ST_SENSORS_I2C_H */
diff --git a/include/linux/iio/common/st_sensors_spi.h b/include/linux/iio/common/st_sensors_spi.h
new file mode 100644
index 000000000000..d964a3563dc6
--- /dev/null
+++ b/include/linux/iio/common/st_sensors_spi.h
@@ -0,0 +1,20 @@
1/*
2 * STMicroelectronics sensors spi library driver
3 *
4 * Copyright 2012-2013 STMicroelectronics Inc.
5 *
6 * Denis Ciocca <denis.ciocca@st.com>
7 *
8 * Licensed under the GPL-2.
9 */
10
11#ifndef ST_SENSORS_SPI_H
12#define ST_SENSORS_SPI_H
13
14#include <linux/spi/spi.h>
15#include <linux/iio/common/st_sensors.h>
16
17void st_sensors_spi_configure(struct iio_dev *indio_dev,
18 struct spi_device *spi, struct st_sensor_data *sdata);
19
20#endif /* ST_SENSORS_SPI_H */
diff --git a/include/linux/iio/consumer.h b/include/linux/iio/consumer.h
index 16c35ac045bd..833926c91aa8 100644
--- a/include/linux/iio/consumer.h
+++ b/include/linux/iio/consumer.h
@@ -15,6 +15,7 @@
15 15
16struct iio_dev; 16struct iio_dev;
17struct iio_chan_spec; 17struct iio_chan_spec;
18struct device;
18 19
19/** 20/**
20 * struct iio_channel - everything needed for a consumer to use a channel 21 * struct iio_channel - everything needed for a consumer to use a channel
@@ -30,14 +31,15 @@ struct iio_channel {
30 31
31/** 32/**
32 * iio_channel_get() - get description of all that is needed to access channel. 33 * iio_channel_get() - get description of all that is needed to access channel.
33 * @name: Unique name of the device as provided in the iio_map 34 * @dev: Pointer to consumer device. Device name must match
35 * the name of the device as provided in the iio_map
34 * with which the desired provider to consumer mapping 36 * with which the desired provider to consumer mapping
35 * was registered. 37 * was registered.
36 * @consumer_channel: Unique name to identify the channel on the consumer 38 * @consumer_channel: Unique name to identify the channel on the consumer
37 * side. This typically describes the channels use within 39 * side. This typically describes the channels use within
38 * the consumer. E.g. 'battery_voltage' 40 * the consumer. E.g. 'battery_voltage'
39 */ 41 */
40struct iio_channel *iio_channel_get(const char *name, 42struct iio_channel *iio_channel_get(struct device *dev,
41 const char *consumer_channel); 43 const char *consumer_channel);
42 44
43/** 45/**
@@ -48,14 +50,14 @@ void iio_channel_release(struct iio_channel *chan);
48 50
49/** 51/**
50 * iio_channel_get_all() - get all channels associated with a client 52 * iio_channel_get_all() - get all channels associated with a client
51 * @name: name of consumer device. 53 * @dev: Pointer to consumer device.
52 * 54 *
53 * Returns an array of iio_channel structures terminated with one with 55 * Returns an array of iio_channel structures terminated with one with
54 * null iio_dev pointer. 56 * null iio_dev pointer.
55 * This function is used by fairly generic consumers to get all the 57 * This function is used by fairly generic consumers to get all the
56 * channels registered as having this consumer. 58 * channels registered as having this consumer.
57 */ 59 */
58struct iio_channel *iio_channel_get_all(const char *name); 60struct iio_channel *iio_channel_get_all(struct device *dev);
59 61
60/** 62/**
61 * iio_channel_release_all() - reverse iio_channel_get_all 63 * iio_channel_release_all() - reverse iio_channel_get_all
@@ -66,7 +68,7 @@ void iio_channel_release_all(struct iio_channel *chan);
66struct iio_cb_buffer; 68struct iio_cb_buffer;
67/** 69/**
68 * iio_channel_get_all_cb() - register callback for triggered capture 70 * iio_channel_get_all_cb() - register callback for triggered capture
69 * @name: Name of client device. 71 * @dev: Pointer to client device.
70 * @cb: Callback function. 72 * @cb: Callback function.
71 * @private: Private data passed to callback. 73 * @private: Private data passed to callback.
72 * 74 *
@@ -74,7 +76,7 @@ struct iio_cb_buffer;
74 * So if the channels requested come from different devices this will 76 * So if the channels requested come from different devices this will
75 * fail. 77 * fail.
76 */ 78 */
77struct iio_cb_buffer *iio_channel_get_all_cb(const char *name, 79struct iio_cb_buffer *iio_channel_get_all_cb(struct device *dev,
78 int (*cb)(u8 *data, 80 int (*cb)(u8 *data,
79 void *private), 81 void *private),
80 void *private); 82 void *private);
diff --git a/include/linux/iio/driver.h b/include/linux/iio/driver.h
index a4f8b2e05af5..7dfb10ee2669 100644
--- a/include/linux/iio/driver.h
+++ b/include/linux/iio/driver.h
@@ -22,13 +22,10 @@ int iio_map_array_register(struct iio_dev *indio_dev,
22 struct iio_map *map); 22 struct iio_map *map);
23 23
24/** 24/**
25 * iio_map_array_unregister() - tell the core to remove consumer mappings 25 * iio_map_array_unregister() - tell the core to remove consumer mappings for
26 * the given provider device
26 * @indio_dev: provider device 27 * @indio_dev: provider device
27 * @map: array of mappings to remove. Note these must have same memory
28 * addresses as those originally added not just equal parameter
29 * values.
30 */ 28 */
31int iio_map_array_unregister(struct iio_dev *indio_dev, 29int iio_map_array_unregister(struct iio_dev *indio_dev);
32 struct iio_map *map);
33 30
34#endif 31#endif
diff --git a/include/linux/iio/gyro/itg3200.h b/include/linux/iio/gyro/itg3200.h
new file mode 100644
index 000000000000..c53f16914b77
--- /dev/null
+++ b/include/linux/iio/gyro/itg3200.h
@@ -0,0 +1,154 @@
1/*
2 * itg3200.h -- support InvenSense ITG3200
3 * Digital 3-Axis Gyroscope driver
4 *
5 * Copyright (c) 2011 Christian Strobel <christian.strobel@iis.fraunhofer.de>
6 * Copyright (c) 2011 Manuel Stahl <manuel.stahl@iis.fraunhofer.de>
7 * Copyright (c) 2012 Thorsten Nowak <thorsten.nowak@iis.fraunhofer.de>
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 version 2 as
11 * published by the Free Software Foundation.
12 */
13
14#ifndef I2C_ITG3200_H_
15#define I2C_ITG3200_H_
16
17#include <linux/iio/iio.h>
18
19/* Register with I2C address (34h) */
20#define ITG3200_REG_ADDRESS 0x00
21
22/* Sample rate divider
23 * Range: 0 to 255
24 * Default value: 0x00 */
25#define ITG3200_REG_SAMPLE_RATE_DIV 0x15
26
27/* Digital low pass filter settings */
28#define ITG3200_REG_DLPF 0x16
29/* DLPF full scale range */
30#define ITG3200_DLPF_FS_SEL_2000 0x18
31/* Bandwidth (Hz) and internal sample rate
32 * (kHz) of DLPF */
33#define ITG3200_DLPF_256_8 0x00
34#define ITG3200_DLPF_188_1 0x01
35#define ITG3200_DLPF_98_1 0x02
36#define ITG3200_DLPF_42_1 0x03
37#define ITG3200_DLPF_20_1 0x04
38#define ITG3200_DLPF_10_1 0x05
39#define ITG3200_DLPF_5_1 0x06
40
41#define ITG3200_DLPF_CFG_MASK 0x07
42
43/* Configuration for interrupt operations */
44#define ITG3200_REG_IRQ_CONFIG 0x17
45/* Logic level */
46#define ITG3200_IRQ_ACTIVE_LOW 0x80
47#define ITG3200_IRQ_ACTIVE_HIGH 0x00
48/* Drive type */
49#define ITG3200_IRQ_OPEN_DRAIN 0x40
50#define ITG3200_IRQ_PUSH_PULL 0x00
51/* Latch mode */
52#define ITG3200_IRQ_LATCH_UNTIL_CLEARED 0x20
53#define ITG3200_IRQ_LATCH_50US_PULSE 0x00
54/* Latch clear method */
55#define ITG3200_IRQ_LATCH_CLEAR_ANY 0x10
56#define ITG3200_IRQ_LATCH_CLEAR_STATUS 0x00
57/* Enable interrupt when device is ready */
58#define ITG3200_IRQ_DEVICE_RDY_ENABLE 0x04
59/* Enable interrupt when data is available */
60#define ITG3200_IRQ_DATA_RDY_ENABLE 0x01
61
62/* Determine the status of ITG-3200 interrupts */
63#define ITG3200_REG_IRQ_STATUS 0x1A
64/* Status of 'device is ready'-interrupt */
65#define ITG3200_IRQ_DEVICE_RDY_STATUS 0x04
66/* Status of 'data is available'-interrupt */
67#define ITG3200_IRQ_DATA_RDY_STATUS 0x01
68
69/* Sensor registers */
70#define ITG3200_REG_TEMP_OUT_H 0x1B
71#define ITG3200_REG_TEMP_OUT_L 0x1C
72#define ITG3200_REG_GYRO_XOUT_H 0x1D
73#define ITG3200_REG_GYRO_XOUT_L 0x1E
74#define ITG3200_REG_GYRO_YOUT_H 0x1F
75#define ITG3200_REG_GYRO_YOUT_L 0x20
76#define ITG3200_REG_GYRO_ZOUT_H 0x21
77#define ITG3200_REG_GYRO_ZOUT_L 0x22
78
79/* Power management */
80#define ITG3200_REG_POWER_MANAGEMENT 0x3E
81/* Reset device and internal registers to the
82 * power-up-default settings */
83#define ITG3200_RESET 0x80
84/* Enable low power sleep mode */
85#define ITG3200_SLEEP 0x40
86/* Put according gyroscope in standby mode */
87#define ITG3200_STANDBY_GYRO_X 0x20
88#define ITG3200_STANDBY_GYRO_Y 0x10
89#define ITG3200_STANDBY_GYRO_Z 0x08
90/* Determine the device clock source */
91#define ITG3200_CLK_INTERNAL 0x00
92#define ITG3200_CLK_GYRO_X 0x01
93#define ITG3200_CLK_GYRO_Y 0x02
94#define ITG3200_CLK_GYRO_Z 0x03
95#define ITG3200_CLK_EXT_32K 0x04
96#define ITG3200_CLK_EXT_19M 0x05
97
98
99/**
100 * struct itg3200 - device instance specific data
101 * @i2c: actual i2c_client
102 * @trig: data ready trigger from itg3200 pin
103 **/
104struct itg3200 {
105 struct i2c_client *i2c;
106 struct iio_trigger *trig;
107};
108
109enum ITG3200_SCAN_INDEX {
110 ITG3200_SCAN_TEMP,
111 ITG3200_SCAN_GYRO_X,
112 ITG3200_SCAN_GYRO_Y,
113 ITG3200_SCAN_GYRO_Z,
114 ITG3200_SCAN_ELEMENTS,
115};
116
117int itg3200_write_reg_8(struct iio_dev *indio_dev,
118 u8 reg_address, u8 val);
119
120int itg3200_read_reg_8(struct iio_dev *indio_dev,
121 u8 reg_address, u8 *val);
122
123
124#ifdef CONFIG_IIO_BUFFER
125
126void itg3200_remove_trigger(struct iio_dev *indio_dev);
127int itg3200_probe_trigger(struct iio_dev *indio_dev);
128
129int itg3200_buffer_configure(struct iio_dev *indio_dev);
130void itg3200_buffer_unconfigure(struct iio_dev *indio_dev);
131
132#else /* CONFIG_IIO_BUFFER */
133
134static inline void itg3200_remove_trigger(struct iio_dev *indio_dev)
135{
136}
137
138static inline int itg3200_probe_trigger(struct iio_dev *indio_dev)
139{
140 return 0;
141}
142
143static inline int itg3200_buffer_configure(struct iio_dev *indio_dev)
144{
145 return 0;
146}
147
148static inline void itg3200_buffer_unconfigure(struct iio_dev *indio_dev)
149{
150}
151
152#endif /* CONFIG_IIO_RING_BUFFER */
153
154#endif /* ITG3200_H_ */
diff --git a/include/linux/iio/trigger.h b/include/linux/iio/trigger.h
index 20239da1d0f7..c66e0a96f6e8 100644
--- a/include/linux/iio/trigger.h
+++ b/include/linux/iio/trigger.h
@@ -12,6 +12,7 @@
12#ifndef _IIO_TRIGGER_H_ 12#ifndef _IIO_TRIGGER_H_
13#define _IIO_TRIGGER_H_ 13#define _IIO_TRIGGER_H_
14 14
15#ifdef CONFIG_IIO_TRIGGER
15struct iio_subirq { 16struct iio_subirq {
16 bool enabled; 17 bool enabled;
17}; 18};
@@ -117,4 +118,8 @@ irqreturn_t iio_trigger_generic_data_rdy_poll(int irq, void *private);
117__printf(1, 2) struct iio_trigger *iio_trigger_alloc(const char *fmt, ...); 118__printf(1, 2) struct iio_trigger *iio_trigger_alloc(const char *fmt, ...);
118void iio_trigger_free(struct iio_trigger *trig); 119void iio_trigger_free(struct iio_trigger *trig);
119 120
121#else
122struct iio_trigger;
123struct iio_trigger_ops;
124#endif
120#endif /* _IIO_TRIGGER_H_ */ 125#endif /* _IIO_TRIGGER_H_ */
diff --git a/include/linux/in6.h b/include/linux/in6.h
index 9e2ae26fb598..34edf1f6c9a3 100644
--- a/include/linux/in6.h
+++ b/include/linux/in6.h
@@ -22,6 +22,10 @@
22 22
23#include <uapi/linux/in6.h> 23#include <uapi/linux/in6.h>
24 24
25/* IPv6 Wildcard Address (::) and Loopback Address (::1) defined in RFC2553
26 * NOTE: Be aware the IN6ADDR_* constants and in6addr_* externals are defined
27 * in network byte order, not in host byte order as are the IPv4 equivalents
28 */
25extern const struct in6_addr in6addr_any; 29extern const struct in6_addr in6addr_any;
26#define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } } 30#define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }
27extern const struct in6_addr in6addr_loopback; 31extern const struct in6_addr in6addr_loopback;
@@ -32,4 +36,13 @@ extern const struct in6_addr in6addr_linklocal_allnodes;
32extern const struct in6_addr in6addr_linklocal_allrouters; 36extern const struct in6_addr in6addr_linklocal_allrouters;
33#define IN6ADDR_LINKLOCAL_ALLROUTERS_INIT \ 37#define IN6ADDR_LINKLOCAL_ALLROUTERS_INIT \
34 { { { 0xff,2,0,0,0,0,0,0,0,0,0,0,0,0,0,2 } } } 38 { { { 0xff,2,0,0,0,0,0,0,0,0,0,0,0,0,0,2 } } }
39extern const struct in6_addr in6addr_interfacelocal_allnodes;
40#define IN6ADDR_INTERFACELOCAL_ALLNODES_INIT \
41 { { { 0xff,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }
42extern const struct in6_addr in6addr_interfacelocal_allrouters;
43#define IN6ADDR_INTERFACELOCAL_ALLROUTERS_INIT \
44 { { { 0xff,1,0,0,0,0,0,0,0,0,0,0,0,0,0,2 } } }
45extern const struct in6_addr in6addr_sitelocal_allrouters;
46#define IN6ADDR_SITELOCAL_ALLROUTERS_INIT \
47 { { { 0xff,5,0,0,0,0,0,0,0,0,0,0,0,0,0,2 } } }
35#endif 48#endif
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h
index a9d828976a77..ea1e3b863890 100644
--- a/include/linux/inetdevice.h
+++ b/include/linux/inetdevice.h
@@ -166,6 +166,12 @@ struct in_ifaddr {
166 unsigned char ifa_flags; 166 unsigned char ifa_flags;
167 unsigned char ifa_prefixlen; 167 unsigned char ifa_prefixlen;
168 char ifa_label[IFNAMSIZ]; 168 char ifa_label[IFNAMSIZ];
169
170 /* In seconds, relative to tstamp. Expiry is at tstamp + HZ * lft. */
171 __u32 ifa_valid_lft;
172 __u32 ifa_preferred_lft;
173 unsigned long ifa_cstamp; /* created timestamp */
174 unsigned long ifa_tstamp; /* updated timestamp */
169}; 175};
170 176
171extern int register_inetaddr_notifier(struct notifier_block *nb); 177extern int register_inetaddr_notifier(struct notifier_block *nb);
diff --git a/include/linux/init.h b/include/linux/init.h
index 10ed4f436458..861814710d52 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -153,6 +153,7 @@ extern unsigned int reset_devices;
153/* used by init/main.c */ 153/* used by init/main.c */
154void setup_arch(char **); 154void setup_arch(char **);
155void prepare_namespace(void); 155void prepare_namespace(void);
156void __init load_default_modules(void);
156 157
157extern void (*late_time_init)(void); 158extern void (*late_time_init)(void);
158 159
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index 6d087c5f57f7..5cd0f0949927 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -10,7 +10,9 @@
10#include <linux/pid_namespace.h> 10#include <linux/pid_namespace.h>
11#include <linux/user_namespace.h> 11#include <linux/user_namespace.h>
12#include <linux/securebits.h> 12#include <linux/securebits.h>
13#include <linux/seqlock.h>
13#include <net/net_namespace.h> 14#include <net/net_namespace.h>
15#include <linux/sched/rt.h>
14 16
15#ifdef CONFIG_SMP 17#ifdef CONFIG_SMP
16# define INIT_PUSHABLE_TASKS(tsk) \ 18# define INIT_PUSHABLE_TASKS(tsk) \
@@ -141,6 +143,15 @@ extern struct task_group root_task_group;
141# define INIT_PERF_EVENTS(tsk) 143# define INIT_PERF_EVENTS(tsk)
142#endif 144#endif
143 145
146#ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN
147# define INIT_VTIME(tsk) \
148 .vtime_seqlock = __SEQLOCK_UNLOCKED(tsk.vtime_seqlock), \
149 .vtime_snap = 0, \
150 .vtime_snap_whence = VTIME_SYS,
151#else
152# define INIT_VTIME(tsk)
153#endif
154
144#define INIT_TASK_COMM "swapper" 155#define INIT_TASK_COMM "swapper"
145 156
146/* 157/*
@@ -210,6 +221,7 @@ extern struct task_group root_task_group;
210 INIT_TRACE_RECURSION \ 221 INIT_TRACE_RECURSION \
211 INIT_TASK_RCU_PREEMPT(tsk) \ 222 INIT_TASK_RCU_PREEMPT(tsk) \
212 INIT_CPUSET_SEQ \ 223 INIT_CPUSET_SEQ \
224 INIT_VTIME(tsk) \
213} 225}
214 226
215 227
diff --git a/include/linux/input/adxl34x.h b/include/linux/input/adxl34x.h
index 57e01a7cb006..010d98175efa 100644
--- a/include/linux/input/adxl34x.h
+++ b/include/linux/input/adxl34x.h
@@ -13,6 +13,8 @@
13#ifndef __LINUX_INPUT_ADXL34X_H__ 13#ifndef __LINUX_INPUT_ADXL34X_H__
14#define __LINUX_INPUT_ADXL34X_H__ 14#define __LINUX_INPUT_ADXL34X_H__
15 15
16#include <linux/input.h>
17
16struct adxl34x_platform_data { 18struct adxl34x_platform_data {
17 19
18 /* 20 /*
diff --git a/include/linux/input/tegra_kbc.h b/include/linux/input/tegra_kbc.h
deleted file mode 100644
index a13025612939..000000000000
--- a/include/linux/input/tegra_kbc.h
+++ /dev/null
@@ -1,62 +0,0 @@
1/*
2 * Platform definitions for tegra-kbc keyboard input driver
3 *
4 * Copyright (c) 2010-2011, NVIDIA Corporation.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 */
20
21#ifndef ASMARM_ARCH_TEGRA_KBC_H
22#define ASMARM_ARCH_TEGRA_KBC_H
23
24#include <linux/types.h>
25#include <linux/input/matrix_keypad.h>
26
27#define KBC_MAX_GPIO 24
28#define KBC_MAX_KPENT 8
29
30#define KBC_MAX_ROW 16
31#define KBC_MAX_COL 8
32#define KBC_MAX_KEY (KBC_MAX_ROW * KBC_MAX_COL)
33
34enum tegra_pin_type {
35 PIN_CFG_IGNORE,
36 PIN_CFG_COL,
37 PIN_CFG_ROW,
38};
39
40struct tegra_kbc_pin_cfg {
41 enum tegra_pin_type type;
42 unsigned char num;
43};
44
45struct tegra_kbc_wake_key {
46 u8 row:4;
47 u8 col:4;
48};
49
50struct tegra_kbc_platform_data {
51 unsigned int debounce_cnt;
52 unsigned int repeat_cnt;
53
54 struct tegra_kbc_pin_cfg pin_cfg[KBC_MAX_GPIO];
55 const struct matrix_keymap_data *keymap_data;
56
57 u32 wakeup_key;
58 bool wakeup;
59 bool use_fn_map;
60 bool use_ghost_filter;
61};
62#endif
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index faed1e357dd6..850e95bc766c 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -77,11 +77,6 @@ static inline struct ipv6hdr *ipipv6_hdr(const struct sk_buff *skb)
77 return (struct ipv6hdr *)skb_transport_header(skb); 77 return (struct ipv6hdr *)skb_transport_header(skb);
78} 78}
79 79
80static inline __u8 ipv6_tclass(const struct ipv6hdr *iph)
81{
82 return (ntohl(*(__be32 *)iph) >> 20) & 0xff;
83}
84
85/* 80/*
86 This structure contains results of exthdrs parsing 81 This structure contains results of exthdrs parsing
87 as offsets from skb->nh. 82 as offsets from skb->nh.
@@ -89,7 +84,7 @@ static inline __u8 ipv6_tclass(const struct ipv6hdr *iph)
89 84
90struct inet6_skb_parm { 85struct inet6_skb_parm {
91 int iif; 86 int iif;
92 __u16 ra; 87 __be16 ra;
93 __u16 hop; 88 __u16 hop;
94 __u16 dst0; 89 __u16 dst0;
95 __u16 srcrt; 90 __u16 srcrt;
@@ -105,6 +100,7 @@ struct inet6_skb_parm {
105#define IP6SKB_XFRM_TRANSFORMED 1 100#define IP6SKB_XFRM_TRANSFORMED 1
106#define IP6SKB_FORWARDED 2 101#define IP6SKB_FORWARDED 2
107#define IP6SKB_REROUTED 4 102#define IP6SKB_REROUTED 4
103#define IP6SKB_ROUTERALERT 8
108}; 104};
109 105
110#define IP6CB(skb) ((struct inet6_skb_parm*)((skb)->cb)) 106#define IP6CB(skb) ((struct inet6_skb_parm*)((skb)->cb))
@@ -218,7 +214,7 @@ struct ipv6_pinfo {
218 214
219 struct ipv6_mc_socklist __rcu *ipv6_mc_list; 215 struct ipv6_mc_socklist __rcu *ipv6_mc_list;
220 struct ipv6_ac_socklist *ipv6_ac_list; 216 struct ipv6_ac_socklist *ipv6_ac_list;
221 struct ipv6_fl_socklist *ipv6_fl_list; 217 struct ipv6_fl_socklist __rcu *ipv6_fl_list;
222 218
223 struct ipv6_txoptions *opt; 219 struct ipv6_txoptions *opt;
224 struct sk_buff *pktoptions; 220 struct sk_buff *pktoptions;
diff --git a/include/linux/irq.h b/include/linux/irq.h
index fdf2c4a238cc..bc4e06611958 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -509,8 +509,11 @@ static inline void irq_set_percpu_devid_flags(unsigned int irq)
509 509
510/* Handle dynamic irq creation and destruction */ 510/* Handle dynamic irq creation and destruction */
511extern unsigned int create_irq_nr(unsigned int irq_want, int node); 511extern unsigned int create_irq_nr(unsigned int irq_want, int node);
512extern unsigned int __create_irqs(unsigned int from, unsigned int count,
513 int node);
512extern int create_irq(void); 514extern int create_irq(void);
513extern void destroy_irq(unsigned int irq); 515extern void destroy_irq(unsigned int irq);
516extern void destroy_irqs(unsigned int irq, unsigned int count);
514 517
515/* 518/*
516 * Dynamic irq helper functions. Obsolete. Use irq_alloc_desc* and 519 * Dynamic irq helper functions. Obsolete. Use irq_alloc_desc* and
@@ -528,6 +531,8 @@ extern int irq_set_handler_data(unsigned int irq, void *data);
528extern int irq_set_chip_data(unsigned int irq, void *data); 531extern int irq_set_chip_data(unsigned int irq, void *data);
529extern int irq_set_irq_type(unsigned int irq, unsigned int type); 532extern int irq_set_irq_type(unsigned int irq, unsigned int type);
530extern int irq_set_msi_desc(unsigned int irq, struct msi_desc *entry); 533extern int irq_set_msi_desc(unsigned int irq, struct msi_desc *entry);
534extern int irq_set_msi_desc_off(unsigned int irq_base, unsigned int irq_offset,
535 struct msi_desc *entry);
531extern struct irq_data *irq_get_irq_data(unsigned int irq); 536extern struct irq_data *irq_get_irq_data(unsigned int irq);
532 537
533static inline struct irq_chip *irq_get_chip(unsigned int irq) 538static inline struct irq_chip *irq_get_chip(unsigned int irq)
@@ -590,6 +595,9 @@ int __irq_alloc_descs(int irq, unsigned int from, unsigned int cnt, int node,
590#define irq_alloc_desc_from(from, node) \ 595#define irq_alloc_desc_from(from, node) \
591 irq_alloc_descs(-1, from, 1, node) 596 irq_alloc_descs(-1, from, 1, node)
592 597
598#define irq_alloc_descs_from(from, cnt, node) \
599 irq_alloc_descs(-1, from, cnt, node)
600
593void irq_free_descs(unsigned int irq, unsigned int cnt); 601void irq_free_descs(unsigned int irq, unsigned int cnt);
594int irq_reserve_irqs(unsigned int from, unsigned int cnt); 602int irq_reserve_irqs(unsigned int from, unsigned int cnt);
595 603
diff --git a/include/linux/irq_work.h b/include/linux/irq_work.h
index 6a9e8f5399e2..f5dbce50466e 100644
--- a/include/linux/irq_work.h
+++ b/include/linux/irq_work.h
@@ -3,6 +3,20 @@
3 3
4#include <linux/llist.h> 4#include <linux/llist.h>
5 5
6/*
7 * An entry can be in one of four states:
8 *
9 * free NULL, 0 -> {claimed} : free to be used
10 * claimed NULL, 3 -> {pending} : claimed to be enqueued
11 * pending next, 3 -> {busy} : queued, pending callback
12 * busy NULL, 2 -> {free, claimed} : callback in progress, can be claimed
13 */
14
15#define IRQ_WORK_PENDING 1UL
16#define IRQ_WORK_BUSY 2UL
17#define IRQ_WORK_FLAGS 3UL
18#define IRQ_WORK_LAZY 4UL /* Doesn't want IPI, wait for tick */
19
6struct irq_work { 20struct irq_work {
7 unsigned long flags; 21 unsigned long flags;
8 struct llist_node llnode; 22 struct llist_node llnode;
@@ -16,8 +30,14 @@ void init_irq_work(struct irq_work *work, void (*func)(struct irq_work *))
16 work->func = func; 30 work->func = func;
17} 31}
18 32
19bool irq_work_queue(struct irq_work *work); 33void irq_work_queue(struct irq_work *work);
20void irq_work_run(void); 34void irq_work_run(void);
21void irq_work_sync(struct irq_work *work); 35void irq_work_sync(struct irq_work *work);
22 36
37#ifdef CONFIG_IRQ_WORK
38bool irq_work_needs_cpu(void);
39#else
40static bool irq_work_needs_cpu(void) { return false; }
41#endif
42
23#endif /* _LINUX_IRQ_WORK_H */ 43#endif /* _LINUX_IRQ_WORK_H */
diff --git a/include/linux/irqchip.h b/include/linux/irqchip.h
new file mode 100644
index 000000000000..e0006f1d35a0
--- /dev/null
+++ b/include/linux/irqchip.h
@@ -0,0 +1,16 @@
1/*
2 * Copyright (C) 2012 Thomas Petazzoni
3 *
4 * Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#ifndef _LINUX_IRQCHIP_H
12#define _LINUX_IRQCHIP_H
13
14void irqchip_init(void);
15
16#endif
diff --git a/include/linux/irqchip/arm-gic.h b/include/linux/irqchip/arm-gic.h
new file mode 100644
index 000000000000..3fd8e4290a1c
--- /dev/null
+++ b/include/linux/irqchip/arm-gic.h
@@ -0,0 +1,79 @@
1/*
2 * include/linux/irqchip/arm-gic.h
3 *
4 * Copyright (C) 2002 ARM Limited, All Rights Reserved.
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#ifndef __LINUX_IRQCHIP_ARM_GIC_H
11#define __LINUX_IRQCHIP_ARM_GIC_H
12
13#define GIC_CPU_CTRL 0x00
14#define GIC_CPU_PRIMASK 0x04
15#define GIC_CPU_BINPOINT 0x08
16#define GIC_CPU_INTACK 0x0c
17#define GIC_CPU_EOI 0x10
18#define GIC_CPU_RUNNINGPRI 0x14
19#define GIC_CPU_HIGHPRI 0x18
20
21#define GIC_DIST_CTRL 0x000
22#define GIC_DIST_CTR 0x004
23#define GIC_DIST_IGROUP 0x080
24#define GIC_DIST_ENABLE_SET 0x100
25#define GIC_DIST_ENABLE_CLEAR 0x180
26#define GIC_DIST_PENDING_SET 0x200
27#define GIC_DIST_PENDING_CLEAR 0x280
28#define GIC_DIST_ACTIVE_SET 0x300
29#define GIC_DIST_ACTIVE_CLEAR 0x380
30#define GIC_DIST_PRI 0x400
31#define GIC_DIST_TARGET 0x800
32#define GIC_DIST_CONFIG 0xc00
33#define GIC_DIST_SOFTINT 0xf00
34
35#define GICH_HCR 0x0
36#define GICH_VTR 0x4
37#define GICH_VMCR 0x8
38#define GICH_MISR 0x10
39#define GICH_EISR0 0x20
40#define GICH_EISR1 0x24
41#define GICH_ELRSR0 0x30
42#define GICH_ELRSR1 0x34
43#define GICH_APR 0xf0
44#define GICH_LR0 0x100
45
46#define GICH_HCR_EN (1 << 0)
47#define GICH_HCR_UIE (1 << 1)
48
49#define GICH_LR_VIRTUALID (0x3ff << 0)
50#define GICH_LR_PHYSID_CPUID_SHIFT (10)
51#define GICH_LR_PHYSID_CPUID (7 << GICH_LR_PHYSID_CPUID_SHIFT)
52#define GICH_LR_STATE (3 << 28)
53#define GICH_LR_PENDING_BIT (1 << 28)
54#define GICH_LR_ACTIVE_BIT (1 << 29)
55#define GICH_LR_EOI (1 << 19)
56
57#define GICH_MISR_EOI (1 << 0)
58#define GICH_MISR_U (1 << 1)
59
60#ifndef __ASSEMBLY__
61
62struct device_node;
63
64extern struct irq_chip gic_arch_extn;
65
66void gic_init_bases(unsigned int, int, void __iomem *, void __iomem *,
67 u32 offset, struct device_node *);
68void gic_secondary_init(unsigned int);
69void gic_cascade_irq(unsigned int gic_nr, unsigned int irq);
70
71static inline void gic_init(unsigned int nr, int start,
72 void __iomem *dist , void __iomem *cpu)
73{
74 gic_init_bases(nr, start, dist, cpu, 0, NULL);
75}
76
77#endif /* __ASSEMBLY */
78
79#endif
diff --git a/include/linux/irqchip/arm-vic.h b/include/linux/irqchip/arm-vic.h
new file mode 100644
index 000000000000..e3c82dc95756
--- /dev/null
+++ b/include/linux/irqchip/arm-vic.h
@@ -0,0 +1,36 @@
1/*
2 * arch/arm/include/asm/hardware/vic.h
3 *
4 * Copyright (c) ARM Limited 2003. All rights reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20#ifndef __ASM_ARM_HARDWARE_VIC_H
21#define __ASM_ARM_HARDWARE_VIC_H
22
23#include <linux/types.h>
24
25#define VIC_RAW_STATUS 0x08
26#define VIC_INT_ENABLE 0x10 /* 1 = enable, 0 = disable */
27#define VIC_INT_ENABLE_CLEAR 0x14
28
29struct device_node;
30struct pt_regs;
31
32void __vic_init(void __iomem *base, int irq_start, u32 vic_sources,
33 u32 resume_sources, struct device_node *node);
34void vic_init(void __iomem *base, unsigned int irq_start, u32 vic_sources, u32 resume_sources);
35
36#endif
diff --git a/include/linux/kernel_stat.h b/include/linux/kernel_stat.h
index 66b70780e910..ed5f6ed6eb77 100644
--- a/include/linux/kernel_stat.h
+++ b/include/linux/kernel_stat.h
@@ -127,7 +127,7 @@ extern void account_system_time(struct task_struct *, int, cputime_t, cputime_t)
127extern void account_steal_time(cputime_t); 127extern void account_steal_time(cputime_t);
128extern void account_idle_time(cputime_t); 128extern void account_idle_time(cputime_t);
129 129
130#ifdef CONFIG_VIRT_CPU_ACCOUNTING 130#ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE
131static inline void account_process_tick(struct task_struct *tsk, int user) 131static inline void account_process_tick(struct task_struct *tsk, int user)
132{ 132{
133 vtime_account_user(tsk); 133 vtime_account_user(tsk);
diff --git a/include/linux/kgdb.h b/include/linux/kgdb.h
index 4dff0c6ed58f..c6e091bf39a5 100644
--- a/include/linux/kgdb.h
+++ b/include/linux/kgdb.h
@@ -13,7 +13,6 @@
13#ifndef _KGDB_H_ 13#ifndef _KGDB_H_
14#define _KGDB_H_ 14#define _KGDB_H_
15 15
16#include <linux/serial_8250.h>
17#include <linux/linkage.h> 16#include <linux/linkage.h>
18#include <linux/init.h> 17#include <linux/init.h>
19#include <linux/atomic.h> 18#include <linux/atomic.h>
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h
index 23755ba42abc..4b6ef4d33cc2 100644
--- a/include/linux/kprobes.h
+++ b/include/linux/kprobes.h
@@ -49,16 +49,6 @@
49#define KPROBE_REENTER 0x00000004 49#define KPROBE_REENTER 0x00000004
50#define KPROBE_HIT_SSDONE 0x00000008 50#define KPROBE_HIT_SSDONE 0x00000008
51 51
52/*
53 * If function tracer is enabled and the arch supports full
54 * passing of pt_regs to function tracing, then kprobes can
55 * optimize on top of function tracing.
56 */
57#if defined(CONFIG_FUNCTION_TRACER) && defined(ARCH_SUPPORTS_FTRACE_SAVE_REGS) \
58 && defined(ARCH_SUPPORTS_KPROBES_ON_FTRACE)
59# define KPROBES_CAN_USE_FTRACE
60#endif
61
62/* Attach to insert probes on any functions which should be ignored*/ 52/* Attach to insert probes on any functions which should be ignored*/
63#define __kprobes __attribute__((__section__(".kprobes.text"))) 53#define __kprobes __attribute__((__section__(".kprobes.text")))
64 54
@@ -316,7 +306,7 @@ extern int proc_kprobes_optimization_handler(struct ctl_table *table,
316#endif 306#endif
317 307
318#endif /* CONFIG_OPTPROBES */ 308#endif /* CONFIG_OPTPROBES */
319#ifdef KPROBES_CAN_USE_FTRACE 309#ifdef CONFIG_KPROBES_ON_FTRACE
320extern void kprobe_ftrace_handler(unsigned long ip, unsigned long parent_ip, 310extern void kprobe_ftrace_handler(unsigned long ip, unsigned long parent_ip,
321 struct ftrace_ops *ops, struct pt_regs *regs); 311 struct ftrace_ops *ops, struct pt_regs *regs);
322extern int arch_prepare_kprobe_ftrace(struct kprobe *p); 312extern int arch_prepare_kprobe_ftrace(struct kprobe *p);
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index 2c497ab0d03d..b7996a768eb2 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -22,6 +22,7 @@
22#include <linux/rcupdate.h> 22#include <linux/rcupdate.h>
23#include <linux/ratelimit.h> 23#include <linux/ratelimit.h>
24#include <linux/err.h> 24#include <linux/err.h>
25#include <linux/irqflags.h>
25#include <asm/signal.h> 26#include <asm/signal.h>
26 27
27#include <linux/kvm.h> 28#include <linux/kvm.h>
@@ -740,15 +741,52 @@ static inline int kvm_deassign_device(struct kvm *kvm,
740} 741}
741#endif /* CONFIG_IOMMU_API */ 742#endif /* CONFIG_IOMMU_API */
742 743
743static inline void kvm_guest_enter(void) 744static inline void __guest_enter(void)
744{ 745{
745 BUG_ON(preemptible());
746 /* 746 /*
747 * This is running in ioctl context so we can avoid 747 * This is running in ioctl context so we can avoid
748 * the call to vtime_account() with its unnecessary idle check. 748 * the call to vtime_account() with its unnecessary idle check.
749 */ 749 */
750 vtime_account_system_irqsafe(current); 750 vtime_account_system(current);
751 current->flags |= PF_VCPU; 751 current->flags |= PF_VCPU;
752}
753
754static inline void __guest_exit(void)
755{
756 /*
757 * This is running in ioctl context so we can avoid
758 * the call to vtime_account() with its unnecessary idle check.
759 */
760 vtime_account_system(current);
761 current->flags &= ~PF_VCPU;
762}
763
764#ifdef CONFIG_CONTEXT_TRACKING
765extern void guest_enter(void);
766extern void guest_exit(void);
767
768#else /* !CONFIG_CONTEXT_TRACKING */
769static inline void guest_enter(void)
770{
771 __guest_enter();
772}
773
774static inline void guest_exit(void)
775{
776 __guest_exit();
777}
778#endif /* !CONFIG_CONTEXT_TRACKING */
779
780static inline void kvm_guest_enter(void)
781{
782 unsigned long flags;
783
784 BUG_ON(preemptible());
785
786 local_irq_save(flags);
787 guest_enter();
788 local_irq_restore(flags);
789
752 /* KVM does not hold any references to rcu protected data when it 790 /* KVM does not hold any references to rcu protected data when it
753 * switches CPU into a guest mode. In fact switching to a guest mode 791 * switches CPU into a guest mode. In fact switching to a guest mode
754 * is very similar to exiting to userspase from rcu point of view. In 792 * is very similar to exiting to userspase from rcu point of view. In
@@ -761,12 +799,11 @@ static inline void kvm_guest_enter(void)
761 799
762static inline void kvm_guest_exit(void) 800static inline void kvm_guest_exit(void)
763{ 801{
764 /* 802 unsigned long flags;
765 * This is running in ioctl context so we can avoid 803
766 * the call to vtime_account() with its unnecessary idle check. 804 local_irq_save(flags);
767 */ 805 guest_exit();
768 vtime_account_system_irqsafe(current); 806 local_irq_restore(flags);
769 current->flags &= ~PF_VCPU;
770} 807}
771 808
772/* 809/*
diff --git a/include/linux/libps2.h b/include/linux/libps2.h
index 79603a6c356f..4ad06e824f76 100644
--- a/include/linux/libps2.h
+++ b/include/linux/libps2.h
@@ -36,7 +36,7 @@ struct ps2dev {
36 wait_queue_head_t wait; 36 wait_queue_head_t wait;
37 37
38 unsigned long flags; 38 unsigned long flags;
39 unsigned char cmdbuf[6]; 39 unsigned char cmdbuf[8];
40 unsigned char cmdcnt; 40 unsigned char cmdcnt;
41 unsigned char nak; 41 unsigned char nak;
42}; 42};
diff --git a/include/linux/llist.h b/include/linux/llist.h
index a5199f6d0e82..d0ab98f73d38 100644
--- a/include/linux/llist.h
+++ b/include/linux/llist.h
@@ -125,6 +125,31 @@ static inline void init_llist_head(struct llist_head *list)
125 (pos) = llist_entry((pos)->member.next, typeof(*(pos)), member)) 125 (pos) = llist_entry((pos)->member.next, typeof(*(pos)), member))
126 126
127/** 127/**
128 * llist_for_each_entry_safe - iterate safely against remove over some entries
129 * of lock-less list of given type.
130 * @pos: the type * to use as a loop cursor.
131 * @n: another type * to use as a temporary storage.
132 * @node: the fist entry of deleted list entries.
133 * @member: the name of the llist_node with the struct.
134 *
135 * In general, some entries of the lock-less list can be traversed
136 * safely only after being removed from list, so start with an entry
137 * instead of list head. This variant allows removal of entries
138 * as we iterate.
139 *
140 * If being used on entries deleted from lock-less list directly, the
141 * traverse order is from the newest to the oldest added entry. If
142 * you want to traverse from the oldest to the newest, you must
143 * reverse the order by yourself before traversing.
144 */
145#define llist_for_each_entry_safe(pos, n, node, member) \
146 for ((pos) = llist_entry((node), typeof(*(pos)), member), \
147 (n) = (pos)->member.next; \
148 &(pos)->member != NULL; \
149 (pos) = llist_entry(n, typeof(*(pos)), member), \
150 (n) = (&(pos)->member != NULL) ? (pos)->member.next : NULL)
151
152/**
128 * llist_empty - tests whether a lock-less list is empty 153 * llist_empty - tests whether a lock-less list is empty
129 * @head: the list to test 154 * @head: the list to test
130 * 155 *
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
index 2bca44b0893c..bfe88c4aa251 100644
--- a/include/linux/lockdep.h
+++ b/include/linux/lockdep.h
@@ -359,7 +359,9 @@ extern void lockdep_trace_alloc(gfp_t mask);
359 359
360#define lockdep_depth(tsk) (debug_locks ? (tsk)->lockdep_depth : 0) 360#define lockdep_depth(tsk) (debug_locks ? (tsk)->lockdep_depth : 0)
361 361
362#define lockdep_assert_held(l) WARN_ON(debug_locks && !lockdep_is_held(l)) 362#define lockdep_assert_held(l) do { \
363 WARN_ON(debug_locks && !lockdep_is_held(l)); \
364 } while (0)
363 365
364#define lockdep_recursing(tsk) ((tsk)->lockdep_recursion) 366#define lockdep_recursing(tsk) ((tsk)->lockdep_recursion)
365 367
diff --git a/include/linux/mailbox.h b/include/linux/mailbox.h
new file mode 100644
index 000000000000..5161f63ec1c8
--- /dev/null
+++ b/include/linux/mailbox.h
@@ -0,0 +1,17 @@
1/*
2 * This program is free software; you can redistribute it and/or modify it
3 * under the terms and conditions of the GNU General Public License,
4 * version 2, as published by the Free Software Foundation.
5 *
6 * This program is distributed in the hope it will be useful, but WITHOUT
7 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
8 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
9 * more details.
10 *
11 * You should have received a copy of the GNU General Public License along with
12 * this program. If not, see <http://www.gnu.org/licenses/>.
13 */
14
15int pl320_ipc_transmit(u32 *data);
16int pl320_ipc_register_notifier(struct notifier_block *nb);
17int pl320_ipc_unregister_notifier(struct notifier_block *nb);
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 0108a56f814e..28bd5fa2ff2e 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -429,7 +429,7 @@ extern int memcg_limited_groups_array_size;
429 * the slab_mutex must be held when looping through those caches 429 * the slab_mutex must be held when looping through those caches
430 */ 430 */
431#define for_each_memcg_cache_index(_idx) \ 431#define for_each_memcg_cache_index(_idx) \
432 for ((_idx) = 0; i < memcg_limited_groups_array_size; (_idx)++) 432 for ((_idx) = 0; (_idx) < memcg_limited_groups_array_size; (_idx)++)
433 433
434static inline bool memcg_kmem_enabled(void) 434static inline bool memcg_kmem_enabled(void)
435{ 435{
diff --git a/include/linux/mfd/abx500.h b/include/linux/mfd/abx500.h
index 2138bd33021a..80e3b8683a84 100644
--- a/include/linux/mfd/abx500.h
+++ b/include/linux/mfd/abx500.h
@@ -131,7 +131,7 @@ struct abx500_maxim_parameters {
131 * @nominal_voltage: Nominal voltage of the battery in mV 131 * @nominal_voltage: Nominal voltage of the battery in mV
132 * @termination_vol: max voltage upto which battery can be charged 132 * @termination_vol: max voltage upto which battery can be charged
133 * @termination_curr battery charging termination current in mA 133 * @termination_curr battery charging termination current in mA
134 * @recharge_vol battery voltage limit that will trigger a new 134 * @recharge_cap battery capacity limit that will trigger a new
135 * full charging cycle in the case where maintenan- 135 * full charging cycle in the case where maintenan-
136 * -ce charging has been disabled 136 * -ce charging has been disabled
137 * @normal_cur_lvl: charger current in normal state in mA 137 * @normal_cur_lvl: charger current in normal state in mA
@@ -160,7 +160,7 @@ struct abx500_battery_type {
160 int nominal_voltage; 160 int nominal_voltage;
161 int termination_vol; 161 int termination_vol;
162 int termination_curr; 162 int termination_curr;
163 int recharge_vol; 163 int recharge_cap;
164 int normal_cur_lvl; 164 int normal_cur_lvl;
165 int normal_vol_lvl; 165 int normal_vol_lvl;
166 int maint_a_cur_lvl; 166 int maint_a_cur_lvl;
@@ -224,6 +224,7 @@ struct abx500_bm_charger_parameters {
224 * @bkup_bat_v voltage which we charge the backup battery with 224 * @bkup_bat_v voltage which we charge the backup battery with
225 * @bkup_bat_i current which we charge the backup battery with 225 * @bkup_bat_i current which we charge the backup battery with
226 * @no_maintenance indicates that maintenance charging is disabled 226 * @no_maintenance indicates that maintenance charging is disabled
227 * @capacity_scaling indicates whether capacity scaling is to be used
227 * @abx500_adc_therm placement of thermistor, batctrl or battemp adc 228 * @abx500_adc_therm placement of thermistor, batctrl or battemp adc
228 * @chg_unknown_bat flag to enable charging of unknown batteries 229 * @chg_unknown_bat flag to enable charging of unknown batteries
229 * @enable_overshoot flag to enable VBAT overshoot control 230 * @enable_overshoot flag to enable VBAT overshoot control
@@ -253,7 +254,11 @@ struct abx500_bm_data {
253 int usb_safety_tmr_h; 254 int usb_safety_tmr_h;
254 int bkup_bat_v; 255 int bkup_bat_v;
255 int bkup_bat_i; 256 int bkup_bat_i;
257 bool autopower_cfg;
258 bool ac_enabled;
259 bool usb_enabled;
256 bool no_maintenance; 260 bool no_maintenance;
261 bool capacity_scaling;
257 bool chg_unknown_bat; 262 bool chg_unknown_bat;
258 bool enable_overshoot; 263 bool enable_overshoot;
259 bool auto_trig; 264 bool auto_trig;
@@ -272,16 +277,14 @@ struct abx500_bm_data {
272 const struct abx500_fg_parameters *fg_params; 277 const struct abx500_fg_parameters *fg_params;
273}; 278};
274 279
275extern struct abx500_bm_data ab8500_bm_data;
276
277enum { 280enum {
278 NTC_EXTERNAL = 0, 281 NTC_EXTERNAL = 0,
279 NTC_INTERNAL, 282 NTC_INTERNAL,
280}; 283};
281 284
282int bmdevs_of_probe(struct device *dev, 285int ab8500_bm_of_probe(struct device *dev,
283 struct device_node *np, 286 struct device_node *np,
284 struct abx500_bm_data **battery); 287 struct abx500_bm_data *bm);
285 288
286int abx500_set_register_interruptible(struct device *dev, u8 bank, u8 reg, 289int abx500_set_register_interruptible(struct device *dev, u8 bank, u8 reg,
287 u8 value); 290 u8 value);
diff --git a/include/linux/mfd/abx500/ab8500-bm.h b/include/linux/mfd/abx500/ab8500-bm.h
index 44310c98ee6e..8d35bfe164c8 100644
--- a/include/linux/mfd/abx500/ab8500-bm.h
+++ b/include/linux/mfd/abx500/ab8500-bm.h
@@ -23,6 +23,7 @@
23 * Bank : 0x5 23 * Bank : 0x5
24 */ 24 */
25#define AB8500_USB_LINE_STAT_REG 0x80 25#define AB8500_USB_LINE_STAT_REG 0x80
26#define AB8500_USB_LINK1_STAT_REG 0x94
26 27
27/* 28/*
28 * Charger / status register offfsets 29 * Charger / status register offfsets
@@ -225,6 +226,8 @@
225/* BatCtrl Current Source Constants */ 226/* BatCtrl Current Source Constants */
226#define BAT_CTRL_7U_ENA 0x01 227#define BAT_CTRL_7U_ENA 0x01
227#define BAT_CTRL_20U_ENA 0x02 228#define BAT_CTRL_20U_ENA 0x02
229#define BAT_CTRL_18U_ENA 0x01
230#define BAT_CTRL_16U_ENA 0x02
228#define BAT_CTRL_CMP_ENA 0x04 231#define BAT_CTRL_CMP_ENA 0x04
229#define FORCE_BAT_CTRL_CMP_HIGH 0x08 232#define FORCE_BAT_CTRL_CMP_HIGH 0x08
230#define BAT_CTRL_PULL_UP_ENA 0x10 233#define BAT_CTRL_PULL_UP_ENA 0x10
@@ -355,6 +358,7 @@ struct ab8500_bm_charger_parameters {
355 * @bkup_bat_v voltage which we charge the backup battery with 358 * @bkup_bat_v voltage which we charge the backup battery with
356 * @bkup_bat_i current which we charge the backup battery with 359 * @bkup_bat_i current which we charge the backup battery with
357 * @no_maintenance indicates that maintenance charging is disabled 360 * @no_maintenance indicates that maintenance charging is disabled
361 * @capacity_scaling indicates whether capacity scaling is to be used
358 * @adc_therm placement of thermistor, batctrl or battemp adc 362 * @adc_therm placement of thermistor, batctrl or battemp adc
359 * @chg_unknown_bat flag to enable charging of unknown batteries 363 * @chg_unknown_bat flag to enable charging of unknown batteries
360 * @enable_overshoot flag to enable VBAT overshoot control 364 * @enable_overshoot flag to enable VBAT overshoot control
@@ -383,6 +387,7 @@ struct ab8500_bm_data {
383 int bkup_bat_v; 387 int bkup_bat_v;
384 int bkup_bat_i; 388 int bkup_bat_i;
385 bool no_maintenance; 389 bool no_maintenance;
390 bool capacity_scaling;
386 bool chg_unknown_bat; 391 bool chg_unknown_bat;
387 bool enable_overshoot; 392 bool enable_overshoot;
388 enum abx500_adc_therm adc_therm; 393 enum abx500_adc_therm adc_therm;
@@ -399,30 +404,13 @@ struct ab8500_bm_data {
399 const struct ab8500_fg_parameters *fg_params; 404 const struct ab8500_fg_parameters *fg_params;
400}; 405};
401 406
402struct ab8500_charger_platform_data {
403 char **supplied_to;
404 size_t num_supplicants;
405 bool autopower_cfg;
406};
407
408struct ab8500_btemp_platform_data {
409 char **supplied_to;
410 size_t num_supplicants;
411};
412
413struct ab8500_fg_platform_data {
414 char **supplied_to;
415 size_t num_supplicants;
416};
417
418struct ab8500_chargalg_platform_data {
419 char **supplied_to;
420 size_t num_supplicants;
421};
422struct ab8500_btemp; 407struct ab8500_btemp;
423struct ab8500_gpadc; 408struct ab8500_gpadc;
424struct ab8500_fg; 409struct ab8500_fg;
410
425#ifdef CONFIG_AB8500_BM 411#ifdef CONFIG_AB8500_BM
412extern struct abx500_bm_data ab8500_bm_data;
413
426void ab8500_fg_reinit(void); 414void ab8500_fg_reinit(void);
427void ab8500_charger_usb_state_changed(u8 bm_usb_state, u16 mA); 415void ab8500_charger_usb_state_changed(u8 bm_usb_state, u16 mA);
428struct ab8500_btemp *ab8500_btemp_get(void); 416struct ab8500_btemp *ab8500_btemp_get(void);
@@ -431,44 +419,10 @@ struct ab8500_fg *ab8500_fg_get(void);
431int ab8500_fg_inst_curr_blocking(struct ab8500_fg *dev); 419int ab8500_fg_inst_curr_blocking(struct ab8500_fg *dev);
432int ab8500_fg_inst_curr_start(struct ab8500_fg *di); 420int ab8500_fg_inst_curr_start(struct ab8500_fg *di);
433int ab8500_fg_inst_curr_finalize(struct ab8500_fg *di, int *res); 421int ab8500_fg_inst_curr_finalize(struct ab8500_fg *di, int *res);
422int ab8500_fg_inst_curr_started(struct ab8500_fg *di);
434int ab8500_fg_inst_curr_done(struct ab8500_fg *di); 423int ab8500_fg_inst_curr_done(struct ab8500_fg *di);
435 424
436#else 425#else
437int ab8500_fg_inst_curr_done(struct ab8500_fg *di) 426static struct abx500_bm_data ab8500_bm_data;
438{
439}
440static void ab8500_fg_reinit(void)
441{
442}
443static void ab8500_charger_usb_state_changed(u8 bm_usb_state, u16 mA)
444{
445}
446static struct ab8500_btemp *ab8500_btemp_get(void)
447{
448 return NULL;
449}
450static int ab8500_btemp_get_batctrl_temp(struct ab8500_btemp *btemp)
451{
452 return 0;
453}
454struct ab8500_fg *ab8500_fg_get(void)
455{
456 return NULL;
457}
458static int ab8500_fg_inst_curr_blocking(struct ab8500_fg *dev)
459{
460 return -ENODEV;
461}
462
463static inline int ab8500_fg_inst_curr_start(struct ab8500_fg *di)
464{
465 return -ENODEV;
466}
467
468static inline int ab8500_fg_inst_curr_finalize(struct ab8500_fg *di, int *res)
469{
470 return -ENODEV;
471}
472
473#endif 427#endif
474#endif /* _AB8500_BM_H */ 428#endif /* _AB8500_BM_H */
diff --git a/include/linux/mfd/abx500/ab8500-gpio.h b/include/linux/mfd/abx500/ab8500-gpio.h
index 2387c207ea86..172b2f201ae0 100644
--- a/include/linux/mfd/abx500/ab8500-gpio.h
+++ b/include/linux/mfd/abx500/ab8500-gpio.h
@@ -14,10 +14,20 @@
14 * registers. 14 * registers.
15 */ 15 */
16 16
17struct ab8500_gpio_platform_data { 17struct abx500_gpio_platform_data {
18 int gpio_base; 18 int gpio_base;
19 u32 irq_base; 19};
20 u8 config_reg[8]; 20
21enum abx500_gpio_pull_updown {
22 ABX500_GPIO_PULL_DOWN = 0x0,
23 ABX500_GPIO_PULL_NONE = 0x1,
24 ABX500_GPIO_PULL_UP = 0x3,
25};
26
27enum abx500_gpio_vinsel {
28 ABX500_GPIO_VINSEL_VBAT = 0x0,
29 ABX500_GPIO_VINSEL_VIN_1V8 = 0x1,
30 ABX500_GPIO_VINSEL_VDD_BIF = 0x2,
21}; 31};
22 32
23#endif /* _AB8500_GPIO_H */ 33#endif /* _AB8500_GPIO_H */
diff --git a/include/linux/mfd/abx500/ab8500.h b/include/linux/mfd/abx500/ab8500.h
index 1cb5698b4d76..fc0534483c72 100644
--- a/include/linux/mfd/abx500/ab8500.h
+++ b/include/linux/mfd/abx500/ab8500.h
@@ -24,7 +24,7 @@ enum ab8500_version {
24 AB8500_VERSION_AB8500 = 0x0, 24 AB8500_VERSION_AB8500 = 0x0,
25 AB8500_VERSION_AB8505 = 0x1, 25 AB8500_VERSION_AB8505 = 0x1,
26 AB8500_VERSION_AB9540 = 0x2, 26 AB8500_VERSION_AB9540 = 0x2,
27 AB8500_VERSION_AB8540 = 0x3, 27 AB8500_VERSION_AB8540 = 0x4,
28 AB8500_VERSION_UNDEFINED, 28 AB8500_VERSION_UNDEFINED,
29}; 29};
30 30
@@ -32,6 +32,7 @@ enum ab8500_version {
32#define AB8500_CUTEARLY 0x00 32#define AB8500_CUTEARLY 0x00
33#define AB8500_CUT1P0 0x10 33#define AB8500_CUT1P0 0x10
34#define AB8500_CUT1P1 0x11 34#define AB8500_CUT1P1 0x11
35#define AB8500_CUT1P2 0x12 /* Only valid for AB8540 */
35#define AB8500_CUT2P0 0x20 36#define AB8500_CUT2P0 0x20
36#define AB8500_CUT3P0 0x30 37#define AB8500_CUT3P0 0x30
37#define AB8500_CUT3P3 0x33 38#define AB8500_CUT3P3 0x33
@@ -39,6 +40,7 @@ enum ab8500_version {
39/* 40/*
40 * AB8500 bank addresses 41 * AB8500 bank addresses
41 */ 42 */
43#define AB8500_M_FSM_RANK 0x0
42#define AB8500_SYS_CTRL1_BLOCK 0x1 44#define AB8500_SYS_CTRL1_BLOCK 0x1
43#define AB8500_SYS_CTRL2_BLOCK 0x2 45#define AB8500_SYS_CTRL2_BLOCK 0x2
44#define AB8500_REGU_CTRL1 0x3 46#define AB8500_REGU_CTRL1 0x3
@@ -58,6 +60,7 @@ enum ab8500_version {
58#define AB8500_DEVELOPMENT 0x11 60#define AB8500_DEVELOPMENT 0x11
59#define AB8500_DEBUG 0x12 61#define AB8500_DEBUG 0x12
60#define AB8500_PROD_TEST 0x13 62#define AB8500_PROD_TEST 0x13
63#define AB8500_STE_TEST 0x14
61#define AB8500_OTP_EMUL 0x15 64#define AB8500_OTP_EMUL 0x15
62 65
63/* 66/*
@@ -65,11 +68,11 @@ enum ab8500_version {
65 * Values used to index into array ab8500_irq_regoffset[] defined in 68 * Values used to index into array ab8500_irq_regoffset[] defined in
66 * drivers/mdf/ab8500-core.c 69 * drivers/mdf/ab8500-core.c
67 */ 70 */
68/* Definitions for AB8500 and AB9540 */ 71/* Definitions for AB8500, AB9540 and AB8540 */
69/* ab8500_irq_regoffset[0] -> IT[Source|Latch|Mask]1 */ 72/* ab8500_irq_regoffset[0] -> IT[Source|Latch|Mask]1 */
70#define AB8500_INT_MAIN_EXT_CH_NOT_OK 0 /* not 8505/9540 */ 73#define AB8500_INT_MAIN_EXT_CH_NOT_OK 0 /* not 8505/9540 */
71#define AB8500_INT_UN_PLUG_TV_DET 1 /* not 8505/9540 */ 74#define AB8500_INT_UN_PLUG_TV_DET 1 /* not 8505/9540/8540 */
72#define AB8500_INT_PLUG_TV_DET 2 /* not 8505/9540 */ 75#define AB8500_INT_PLUG_TV_DET 2 /* not 8505/9540/8540 */
73#define AB8500_INT_TEMP_WARM 3 76#define AB8500_INT_TEMP_WARM 3
74#define AB8500_INT_PON_KEY2DB_F 4 77#define AB8500_INT_PON_KEY2DB_F 4
75#define AB8500_INT_PON_KEY2DB_R 5 78#define AB8500_INT_PON_KEY2DB_R 5
@@ -77,18 +80,19 @@ enum ab8500_version {
77#define AB8500_INT_PON_KEY1DB_R 7 80#define AB8500_INT_PON_KEY1DB_R 7
78/* ab8500_irq_regoffset[1] -> IT[Source|Latch|Mask]2 */ 81/* ab8500_irq_regoffset[1] -> IT[Source|Latch|Mask]2 */
79#define AB8500_INT_BATT_OVV 8 82#define AB8500_INT_BATT_OVV 8
80#define AB8500_INT_MAIN_CH_UNPLUG_DET 10 /* not 8505 */ 83#define AB8500_INT_MAIN_CH_UNPLUG_DET 10 /* not 8505/8540 */
81#define AB8500_INT_MAIN_CH_PLUG_DET 11 /* not 8505 */ 84#define AB8500_INT_MAIN_CH_PLUG_DET 11 /* not 8505/8540 */
82#define AB8500_INT_VBUS_DET_F 14 85#define AB8500_INT_VBUS_DET_F 14
83#define AB8500_INT_VBUS_DET_R 15 86#define AB8500_INT_VBUS_DET_R 15
84/* ab8500_irq_regoffset[2] -> IT[Source|Latch|Mask]3 */ 87/* ab8500_irq_regoffset[2] -> IT[Source|Latch|Mask]3 */
85#define AB8500_INT_VBUS_CH_DROP_END 16 88#define AB8500_INT_VBUS_CH_DROP_END 16
86#define AB8500_INT_RTC_60S 17 89#define AB8500_INT_RTC_60S 17
87#define AB8500_INT_RTC_ALARM 18 90#define AB8500_INT_RTC_ALARM 18
91#define AB8540_INT_BIF_INT 19
88#define AB8500_INT_BAT_CTRL_INDB 20 92#define AB8500_INT_BAT_CTRL_INDB 20
89#define AB8500_INT_CH_WD_EXP 21 93#define AB8500_INT_CH_WD_EXP 21
90#define AB8500_INT_VBUS_OVV 22 94#define AB8500_INT_VBUS_OVV 22
91#define AB8500_INT_MAIN_CH_DROP_END 23 /* not 8505/9540 */ 95#define AB8500_INT_MAIN_CH_DROP_END 23 /* not 8505/9540/8540 */
92/* ab8500_irq_regoffset[3] -> IT[Source|Latch|Mask]4 */ 96/* ab8500_irq_regoffset[3] -> IT[Source|Latch|Mask]4 */
93#define AB8500_INT_CCN_CONV_ACC 24 97#define AB8500_INT_CCN_CONV_ACC 24
94#define AB8500_INT_INT_AUD 25 98#define AB8500_INT_INT_AUD 25
@@ -99,7 +103,7 @@ enum ab8500_version {
99#define AB8500_INT_BUP_CHG_NOT_OK 30 103#define AB8500_INT_BUP_CHG_NOT_OK 30
100#define AB8500_INT_BUP_CHG_OK 31 104#define AB8500_INT_BUP_CHG_OK 31
101/* ab8500_irq_regoffset[4] -> IT[Source|Latch|Mask]5 */ 105/* ab8500_irq_regoffset[4] -> IT[Source|Latch|Mask]5 */
102#define AB8500_INT_GP_HW_ADC_CONV_END 32 /* not 8505 */ 106#define AB8500_INT_GP_HW_ADC_CONV_END 32 /* not 8505/8540 */
103#define AB8500_INT_ACC_DETECT_1DB_F 33 107#define AB8500_INT_ACC_DETECT_1DB_F 33
104#define AB8500_INT_ACC_DETECT_1DB_R 34 108#define AB8500_INT_ACC_DETECT_1DB_R 34
105#define AB8500_INT_ACC_DETECT_22DB_F 35 109#define AB8500_INT_ACC_DETECT_22DB_F 35
@@ -108,23 +112,23 @@ enum ab8500_version {
108#define AB8500_INT_ACC_DETECT_21DB_R 38 112#define AB8500_INT_ACC_DETECT_21DB_R 38
109#define AB8500_INT_GP_SW_ADC_CONV_END 39 113#define AB8500_INT_GP_SW_ADC_CONV_END 39
110/* ab8500_irq_regoffset[5] -> IT[Source|Latch|Mask]7 */ 114/* ab8500_irq_regoffset[5] -> IT[Source|Latch|Mask]7 */
111#define AB8500_INT_GPIO6R 40 /* not 8505/9540 */ 115#define AB8500_INT_GPIO6R 40 /* not 8505/9540/8540 */
112#define AB8500_INT_GPIO7R 41 /* not 8505/9540 */ 116#define AB8500_INT_GPIO7R 41 /* not 8505/9540/8540 */
113#define AB8500_INT_GPIO8R 42 /* not 8505/9540 */ 117#define AB8500_INT_GPIO8R 42 /* not 8505/9540/8540 */
114#define AB8500_INT_GPIO9R 43 /* not 8505/9540 */ 118#define AB8500_INT_GPIO9R 43 /* not 8505/9540/8540 */
115#define AB8500_INT_GPIO10R 44 119#define AB8500_INT_GPIO10R 44 /* not 8540 */
116#define AB8500_INT_GPIO11R 45 120#define AB8500_INT_GPIO11R 45 /* not 8540 */
117#define AB8500_INT_GPIO12R 46 /* not 8505 */ 121#define AB8500_INT_GPIO12R 46 /* not 8505/8540 */
118#define AB8500_INT_GPIO13R 47 122#define AB8500_INT_GPIO13R 47 /* not 8540 */
119/* ab8500_irq_regoffset[6] -> IT[Source|Latch|Mask]8 */ 123/* ab8500_irq_regoffset[6] -> IT[Source|Latch|Mask]8 */
120#define AB8500_INT_GPIO24R 48 /* not 8505 */ 124#define AB8500_INT_GPIO24R 48 /* not 8505/8540 */
121#define AB8500_INT_GPIO25R 49 /* not 8505 */ 125#define AB8500_INT_GPIO25R 49 /* not 8505/8540 */
122#define AB8500_INT_GPIO36R 50 /* not 8505/9540 */ 126#define AB8500_INT_GPIO36R 50 /* not 8505/9540/8540 */
123#define AB8500_INT_GPIO37R 51 /* not 8505/9540 */ 127#define AB8500_INT_GPIO37R 51 /* not 8505/9540/8540 */
124#define AB8500_INT_GPIO38R 52 /* not 8505/9540 */ 128#define AB8500_INT_GPIO38R 52 /* not 8505/9540/8540 */
125#define AB8500_INT_GPIO39R 53 /* not 8505/9540 */ 129#define AB8500_INT_GPIO39R 53 /* not 8505/9540/8540 */
126#define AB8500_INT_GPIO40R 54 130#define AB8500_INT_GPIO40R 54 /* not 8540 */
127#define AB8500_INT_GPIO41R 55 131#define AB8500_INT_GPIO41R 55 /* not 8540 */
128/* ab8500_irq_regoffset[7] -> IT[Source|Latch|Mask]9 */ 132/* ab8500_irq_regoffset[7] -> IT[Source|Latch|Mask]9 */
129#define AB8500_INT_GPIO6F 56 /* not 8505/9540 */ 133#define AB8500_INT_GPIO6F 56 /* not 8505/9540 */
130#define AB8500_INT_GPIO7F 57 /* not 8505/9540 */ 134#define AB8500_INT_GPIO7F 57 /* not 8505/9540 */
@@ -135,14 +139,14 @@ enum ab8500_version {
135#define AB8500_INT_GPIO12F 62 /* not 8505 */ 139#define AB8500_INT_GPIO12F 62 /* not 8505 */
136#define AB8500_INT_GPIO13F 63 140#define AB8500_INT_GPIO13F 63
137/* ab8500_irq_regoffset[8] -> IT[Source|Latch|Mask]10 */ 141/* ab8500_irq_regoffset[8] -> IT[Source|Latch|Mask]10 */
138#define AB8500_INT_GPIO24F 64 /* not 8505 */ 142#define AB8500_INT_GPIO24F 64 /* not 8505/8540 */
139#define AB8500_INT_GPIO25F 65 /* not 8505 */ 143#define AB8500_INT_GPIO25F 65 /* not 8505/8540 */
140#define AB8500_INT_GPIO36F 66 /* not 8505/9540 */ 144#define AB8500_INT_GPIO36F 66 /* not 8505/9540/8540 */
141#define AB8500_INT_GPIO37F 67 /* not 8505/9540 */ 145#define AB8500_INT_GPIO37F 67 /* not 8505/9540/8540 */
142#define AB8500_INT_GPIO38F 68 /* not 8505/9540 */ 146#define AB8500_INT_GPIO38F 68 /* not 8505/9540/8540 */
143#define AB8500_INT_GPIO39F 69 /* not 8505/9540 */ 147#define AB8500_INT_GPIO39F 69 /* not 8505/9540/8540 */
144#define AB8500_INT_GPIO40F 70 148#define AB8500_INT_GPIO40F 70 /* not 8540 */
145#define AB8500_INT_GPIO41F 71 149#define AB8500_INT_GPIO41F 71 /* not 8540 */
146/* ab8500_irq_regoffset[9] -> IT[Source|Latch|Mask]12 */ 150/* ab8500_irq_regoffset[9] -> IT[Source|Latch|Mask]12 */
147#define AB8500_INT_ADP_SOURCE_ERROR 72 151#define AB8500_INT_ADP_SOURCE_ERROR 72
148#define AB8500_INT_ADP_SINK_ERROR 73 152#define AB8500_INT_ADP_SINK_ERROR 73
@@ -160,42 +164,44 @@ enum ab8500_version {
160#define AB8500_INT_SRP_DETECT 88 164#define AB8500_INT_SRP_DETECT 88
161#define AB8500_INT_USB_CHARGER_NOT_OKR 89 165#define AB8500_INT_USB_CHARGER_NOT_OKR 89
162#define AB8500_INT_ID_WAKEUP_R 90 166#define AB8500_INT_ID_WAKEUP_R 90
167#define AB8500_INT_ID_DET_PLUGR 91 /* 8505/9540 cut2.0 */
163#define AB8500_INT_ID_DET_R1R 92 168#define AB8500_INT_ID_DET_R1R 92
164#define AB8500_INT_ID_DET_R2R 93 169#define AB8500_INT_ID_DET_R2R 93
165#define AB8500_INT_ID_DET_R3R 94 170#define AB8500_INT_ID_DET_R3R 94
166#define AB8500_INT_ID_DET_R4R 95 171#define AB8500_INT_ID_DET_R4R 95
167/* ab8500_irq_regoffset[12] -> IT[Source|Latch|Mask]21 */ 172/* ab8500_irq_regoffset[12] -> IT[Source|Latch|Mask]21 */
168#define AB8500_INT_ID_WAKEUP_F 96 173#define AB8500_INT_ID_WAKEUP_F 96 /* not 8505/9540 */
169#define AB8500_INT_ID_DET_R1F 98 174#define AB8500_INT_ID_DET_PLUGF 97 /* 8505/9540 cut2.0 */
170#define AB8500_INT_ID_DET_R2F 99 175#define AB8500_INT_ID_DET_R1F 98 /* not 8505/9540 */
171#define AB8500_INT_ID_DET_R3F 100 176#define AB8500_INT_ID_DET_R2F 99 /* not 8505/9540 */
172#define AB8500_INT_ID_DET_R4F 101 177#define AB8500_INT_ID_DET_R3F 100 /* not 8505/9540 */
173#define AB8500_INT_CHAUTORESTARTAFTSEC 102 178#define AB8500_INT_ID_DET_R4F 101 /* not 8505/9540 */
179#define AB8500_INT_CHAUTORESTARTAFTSEC 102 /* not 8505/9540 */
174#define AB8500_INT_CHSTOPBYSEC 103 180#define AB8500_INT_CHSTOPBYSEC 103
175/* ab8500_irq_regoffset[13] -> IT[Source|Latch|Mask]22 */ 181/* ab8500_irq_regoffset[13] -> IT[Source|Latch|Mask]22 */
176#define AB8500_INT_USB_CH_TH_PROT_F 104 182#define AB8500_INT_USB_CH_TH_PROT_F 104
177#define AB8500_INT_USB_CH_TH_PROT_R 105 183#define AB8500_INT_USB_CH_TH_PROT_R 105
178#define AB8500_INT_MAIN_CH_TH_PROT_F 106 /* not 8505/9540 */ 184#define AB8500_INT_MAIN_CH_TH_PROT_F 106 /* not 8505/9540 */
179#define AB8500_INT_MAIN_CH_TH_PROT_R 107 /* not 8505/9540 */ 185#define AB8500_INT_MAIN_CH_TH_PROT_R 107 /* not 8505/9540 */
180#define AB8500_INT_CHCURLIMNOHSCHIRP 109 186#define AB8500_INT_CHCURLIMNOHSCHIRP 109
181#define AB8500_INT_CHCURLIMHSCHIRP 110 187#define AB8500_INT_CHCURLIMHSCHIRP 110
182#define AB8500_INT_XTAL32K_KO 111 188#define AB8500_INT_XTAL32K_KO 111
183 189
184/* Definitions for AB9540 */ 190/* Definitions for AB9540 / AB8505 */
185/* ab8500_irq_regoffset[14] -> IT[Source|Latch|Mask]13 */ 191/* ab8500_irq_regoffset[14] -> IT[Source|Latch|Mask]13 */
186#define AB9540_INT_GPIO50R 113 192#define AB9540_INT_GPIO50R 113 /* not 8540 */
187#define AB9540_INT_GPIO51R 114 /* not 8505 */ 193#define AB9540_INT_GPIO51R 114 /* not 8505/8540 */
188#define AB9540_INT_GPIO52R 115 194#define AB9540_INT_GPIO52R 115 /* not 8540 */
189#define AB9540_INT_GPIO53R 116 195#define AB9540_INT_GPIO53R 116 /* not 8540 */
190#define AB9540_INT_GPIO54R 117 /* not 8505 */ 196#define AB9540_INT_GPIO54R 117 /* not 8505/8540 */
191#define AB9540_INT_IEXT_CH_RF_BFN_R 118 197#define AB9540_INT_IEXT_CH_RF_BFN_R 118
192#define AB9540_INT_IEXT_CH_RF_BFN_F 119
193/* ab8500_irq_regoffset[15] -> IT[Source|Latch|Mask]14 */ 198/* ab8500_irq_regoffset[15] -> IT[Source|Latch|Mask]14 */
194#define AB9540_INT_GPIO50F 121 199#define AB9540_INT_GPIO50F 121 /* not 8540 */
195#define AB9540_INT_GPIO51F 122 /* not 8505 */ 200#define AB9540_INT_GPIO51F 122 /* not 8505/8540 */
196#define AB9540_INT_GPIO52F 123 201#define AB9540_INT_GPIO52F 123 /* not 8540 */
197#define AB9540_INT_GPIO53F 124 202#define AB9540_INT_GPIO53F 124 /* not 8540 */
198#define AB9540_INT_GPIO54F 125 /* not 8505 */ 203#define AB9540_INT_GPIO54F 125 /* not 8505/8540 */
204#define AB9540_INT_IEXT_CH_RF_BFN_F 126
199/* ab8500_irq_regoffset[16] -> IT[Source|Latch|Mask]25 */ 205/* ab8500_irq_regoffset[16] -> IT[Source|Latch|Mask]25 */
200#define AB8505_INT_KEYSTUCK 128 206#define AB8505_INT_KEYSTUCK 128
201#define AB8505_INT_IKR 129 207#define AB8505_INT_IKR 129
@@ -204,6 +210,87 @@ enum ab8500_version {
204#define AB8505_INT_KEYDEGLITCH 132 210#define AB8505_INT_KEYDEGLITCH 132
205#define AB8505_INT_MODPWRSTATUSF 134 211#define AB8505_INT_MODPWRSTATUSF 134
206#define AB8505_INT_MODPWRSTATUSR 135 212#define AB8505_INT_MODPWRSTATUSR 135
213/* ab8500_irq_regoffset[17] -> IT[Source|Latch|Mask]6 */
214#define AB8500_INT_HOOK_DET_NEG_F 138
215#define AB8500_INT_HOOK_DET_NEG_R 139
216#define AB8500_INT_HOOK_DET_POS_F 140
217#define AB8500_INT_HOOK_DET_POS_R 141
218#define AB8500_INT_PLUG_DET_COMP_F 142
219#define AB8500_INT_PLUG_DET_COMP_R 143
220/* ab8500_irq_regoffset[18] -> IT[Source|Latch|Mask]23 */
221#define AB8505_INT_COLL 144
222#define AB8505_INT_RESERR 145
223#define AB8505_INT_FRAERR 146
224#define AB8505_INT_COMERR 147
225#define AB8505_INT_SPDSET 148
226#define AB8505_INT_DSENT 149
227#define AB8505_INT_DREC 150
228#define AB8505_INT_ACC_INT 151
229/* ab8500_irq_regoffset[19] -> IT[Source|Latch|Mask]24 */
230#define AB8505_INT_NOPINT 152
231/* ab8540_irq_regoffset[20] -> IT[Source|Latch|Mask]26 */
232#define AB8540_INT_IDPLUGDETCOMPF 160
233#define AB8540_INT_IDPLUGDETCOMPR 161
234#define AB8540_INT_FMDETCOMPLOF 162
235#define AB8540_INT_FMDETCOMPLOR 163
236#define AB8540_INT_FMDETCOMPHIF 164
237#define AB8540_INT_FMDETCOMPHIR 165
238#define AB8540_INT_ID5VDETCOMPF 166
239#define AB8540_INT_ID5VDETCOMPR 167
240/* ab8540_irq_regoffset[21] -> IT[Source|Latch|Mask]27 */
241#define AB8540_INT_GPIO43F 168
242#define AB8540_INT_GPIO43R 169
243#define AB8540_INT_GPIO44F 170
244#define AB8540_INT_GPIO44R 171
245#define AB8540_INT_KEYPOSDETCOMPF 172
246#define AB8540_INT_KEYPOSDETCOMPR 173
247#define AB8540_INT_KEYNEGDETCOMPF 174
248#define AB8540_INT_KEYNEGDETCOMPR 175
249/* ab8540_irq_regoffset[22] -> IT[Source|Latch|Mask]28 */
250#define AB8540_INT_GPIO1VBATF 176
251#define AB8540_INT_GPIO1VBATR 177
252#define AB8540_INT_GPIO2VBATF 178
253#define AB8540_INT_GPIO2VBATR 179
254#define AB8540_INT_GPIO3VBATF 180
255#define AB8540_INT_GPIO3VBATR 181
256#define AB8540_INT_GPIO4VBATF 182
257#define AB8540_INT_GPIO4VBATR 183
258/* ab8540_irq_regoffset[23] -> IT[Source|Latch|Mask]29 */
259#define AB8540_INT_SYSCLKREQ2F 184
260#define AB8540_INT_SYSCLKREQ2R 185
261#define AB8540_INT_SYSCLKREQ3F 186
262#define AB8540_INT_SYSCLKREQ3R 187
263#define AB8540_INT_SYSCLKREQ4F 188
264#define AB8540_INT_SYSCLKREQ4R 189
265#define AB8540_INT_SYSCLKREQ5F 190
266#define AB8540_INT_SYSCLKREQ5R 191
267/* ab8540_irq_regoffset[24] -> IT[Source|Latch|Mask]30 */
268#define AB8540_INT_PWMOUT1F 192
269#define AB8540_INT_PWMOUT1R 193
270#define AB8540_INT_PWMCTRL0F 194
271#define AB8540_INT_PWMCTRL0R 195
272#define AB8540_INT_PWMCTRL1F 196
273#define AB8540_INT_PWMCTRL1R 197
274#define AB8540_INT_SYSCLKREQ6F 198
275#define AB8540_INT_SYSCLKREQ6R 199
276/* ab8540_irq_regoffset[25] -> IT[Source|Latch|Mask]31 */
277#define AB8540_INT_PWMEXTVIBRA1F 200
278#define AB8540_INT_PWMEXTVIBRA1R 201
279#define AB8540_INT_PWMEXTVIBRA2F 202
280#define AB8540_INT_PWMEXTVIBRA2R 203
281#define AB8540_INT_PWMOUT2F 204
282#define AB8540_INT_PWMOUT2R 205
283#define AB8540_INT_PWMOUT3F 206
284#define AB8540_INT_PWMOUT3R 207
285/* ab8540_irq_regoffset[26] -> IT[Source|Latch|Mask]32 */
286#define AB8540_INT_ADDATA2F 208
287#define AB8540_INT_ADDATA2R 209
288#define AB8540_INT_DADATA2F 210
289#define AB8540_INT_DADATA2R 211
290#define AB8540_INT_FSYNC2F 212
291#define AB8540_INT_FSYNC2R 213
292#define AB8540_INT_BITCLK2F 214
293#define AB8540_INT_BITCLK2R 215
207 294
208/* 295/*
209 * AB8500_AB9540_NR_IRQS is used when configuring the IRQ numbers for the 296 * AB8500_AB9540_NR_IRQS is used when configuring the IRQ numbers for the
@@ -213,13 +300,24 @@ enum ab8500_version {
213 * which is larger. 300 * which is larger.
214 */ 301 */
215#define AB8500_NR_IRQS 112 302#define AB8500_NR_IRQS 112
216#define AB8505_NR_IRQS 136 303#define AB8505_NR_IRQS 153
217#define AB9540_NR_IRQS 136 304#define AB9540_NR_IRQS 153
305#define AB8540_NR_IRQS 216
218/* This is set to the roof of any AB8500 chip variant IRQ counts */ 306/* This is set to the roof of any AB8500 chip variant IRQ counts */
219#define AB8500_MAX_NR_IRQS AB9540_NR_IRQS 307#define AB8500_MAX_NR_IRQS AB8540_NR_IRQS
220 308
221#define AB8500_NUM_IRQ_REGS 14 309#define AB8500_NUM_IRQ_REGS 14
222#define AB9540_NUM_IRQ_REGS 17 310#define AB9540_NUM_IRQ_REGS 20
311#define AB8540_NUM_IRQ_REGS 27
312
313/* Turn On Status Event */
314#define AB8500_POR_ON_VBAT 0x01
315#define AB8500_POW_KEY_1_ON 0x02
316#define AB8500_POW_KEY_2_ON 0x04
317#define AB8500_RTC_ALARM 0x08
318#define AB8500_MAIN_CH_DET 0x10
319#define AB8500_VBUS_DET 0x20
320#define AB8500_USB_ID_DET 0x40
223 321
224/** 322/**
225 * struct ab8500 - ab8500 internal structure 323 * struct ab8500 - ab8500 internal structure
@@ -287,7 +385,7 @@ struct ab8500_platform_data {
287 struct ab8500_regulator_reg_init *regulator_reg_init; 385 struct ab8500_regulator_reg_init *regulator_reg_init;
288 int num_regulator; 386 int num_regulator;
289 struct regulator_init_data *regulator; 387 struct regulator_init_data *regulator;
290 struct ab8500_gpio_platform_data *gpio; 388 struct abx500_gpio_platform_data *gpio;
291 struct ab8500_codec_platform_data *codec; 389 struct ab8500_codec_platform_data *codec;
292}; 390};
293 391
@@ -335,10 +433,79 @@ static inline int is_ab8500_2p0_or_earlier(struct ab8500 *ab)
335 return (is_ab8500(ab) && (ab->chip_id <= AB8500_CUT2P0)); 433 return (is_ab8500(ab) && (ab->chip_id <= AB8500_CUT2P0));
336} 434}
337 435
436static inline int is_ab8500_3p3_or_earlier(struct ab8500 *ab)
437{
438 return (is_ab8500(ab) && (ab->chip_id <= AB8500_CUT3P3));
439}
440
338/* exclude also ab8505, ab9540... */ 441/* exclude also ab8505, ab9540... */
339static inline int is_ab8500_2p0(struct ab8500 *ab) 442static inline int is_ab8500_2p0(struct ab8500 *ab)
340{ 443{
341 return (is_ab8500(ab) && (ab->chip_id == AB8500_CUT2P0)); 444 return (is_ab8500(ab) && (ab->chip_id == AB8500_CUT2P0));
342} 445}
343 446
447static inline int is_ab8505_1p0_or_earlier(struct ab8500 *ab)
448{
449 return (is_ab8505(ab) && (ab->chip_id <= AB8500_CUT1P0));
450}
451
452static inline int is_ab8505_2p0(struct ab8500 *ab)
453{
454 return (is_ab8505(ab) && (ab->chip_id == AB8500_CUT2P0));
455}
456
457static inline int is_ab9540_1p0_or_earlier(struct ab8500 *ab)
458{
459 return (is_ab9540(ab) && (ab->chip_id <= AB8500_CUT1P0));
460}
461
462static inline int is_ab9540_2p0(struct ab8500 *ab)
463{
464 return (is_ab9540(ab) && (ab->chip_id == AB8500_CUT2P0));
465}
466
467/*
468 * Be careful, the marketing name for this chip is 2.1
469 * but the value read from the chip is 3.0 (0x30)
470 */
471static inline int is_ab9540_3p0(struct ab8500 *ab)
472{
473 return (is_ab9540(ab) && (ab->chip_id == AB8500_CUT3P0));
474}
475
476static inline int is_ab8540_1p0_or_earlier(struct ab8500 *ab)
477{
478 return is_ab8540(ab) && (ab->chip_id <= AB8500_CUT1P0);
479}
480
481static inline int is_ab8540_1p1_or_earlier(struct ab8500 *ab)
482{
483 return is_ab8540(ab) && (ab->chip_id <= AB8500_CUT1P1);
484}
485
486static inline int is_ab8540_1p2_or_earlier(struct ab8500 *ab)
487{
488 return is_ab8540(ab) && (ab->chip_id <= AB8500_CUT1P2);
489}
490
491static inline int is_ab8540_2p0_or_earlier(struct ab8500 *ab)
492{
493 return is_ab8540(ab) && (ab->chip_id <= AB8500_CUT2P0);
494}
495
496static inline int is_ab8540_2p0(struct ab8500 *ab)
497{
498 return is_ab8540(ab) && (ab->chip_id == AB8500_CUT2P0);
499}
500
501static inline int is_ab8505_2p0_earlier(struct ab8500 *ab)
502{
503 return (is_ab8505(ab) && (ab->chip_id < AB8500_CUT2P0));
504}
505
506static inline int is_ab9540_2p0_or_earlier(struct ab8500 *ab)
507{
508 return (is_ab9540(ab) && (ab->chip_id < AB8500_CUT2P0));
509}
510
344#endif /* MFD_AB8500_H */ 511#endif /* MFD_AB8500_H */
diff --git a/include/linux/mfd/abx500/ux500_chargalg.h b/include/linux/mfd/abx500/ux500_chargalg.h
index 9b07725750c9..d43ac0f35526 100644
--- a/include/linux/mfd/abx500/ux500_chargalg.h
+++ b/include/linux/mfd/abx500/ux500_chargalg.h
@@ -27,12 +27,17 @@ struct ux500_charger_ops {
27 * @ops ux500 charger operations 27 * @ops ux500 charger operations
28 * @max_out_volt maximum output charger voltage in mV 28 * @max_out_volt maximum output charger voltage in mV
29 * @max_out_curr maximum output charger current in mA 29 * @max_out_curr maximum output charger current in mA
30 * @enabled indicates if this charger is used or not
31 * @external external charger unit (pm2xxx)
30 */ 32 */
31struct ux500_charger { 33struct ux500_charger {
32 struct power_supply psy; 34 struct power_supply psy;
33 struct ux500_charger_ops ops; 35 struct ux500_charger_ops ops;
34 int max_out_volt; 36 int max_out_volt;
35 int max_out_curr; 37 int max_out_curr;
38 int wdt_refresh;
39 bool enabled;
40 bool external;
36}; 41};
37 42
38#endif 43#endif
diff --git a/include/linux/mfd/arizona/core.h b/include/linux/mfd/arizona/core.h
index a580363a7d29..a710255528d7 100644
--- a/include/linux/mfd/arizona/core.h
+++ b/include/linux/mfd/arizona/core.h
@@ -75,8 +75,10 @@ enum arizona_type {
75#define ARIZONA_IRQ_DCS_HP_DONE 47 75#define ARIZONA_IRQ_DCS_HP_DONE 47
76#define ARIZONA_IRQ_FLL2_CLOCK_OK 48 76#define ARIZONA_IRQ_FLL2_CLOCK_OK 48
77#define ARIZONA_IRQ_FLL1_CLOCK_OK 49 77#define ARIZONA_IRQ_FLL1_CLOCK_OK 49
78#define ARIZONA_IRQ_MICD_CLAMP_RISE 50
79#define ARIZONA_IRQ_MICD_CLAMP_FALL 51
78 80
79#define ARIZONA_NUM_IRQ 50 81#define ARIZONA_NUM_IRQ 52
80 82
81struct snd_soc_dapm_context; 83struct snd_soc_dapm_context;
82 84
diff --git a/include/linux/mfd/arizona/pdata.h b/include/linux/mfd/arizona/pdata.h
index 8b1d1daaae16..96d64f2b8d78 100644
--- a/include/linux/mfd/arizona/pdata.h
+++ b/include/linux/mfd/arizona/pdata.h
@@ -62,6 +62,8 @@
62 62
63#define ARIZONA_MAX_OUTPUT 6 63#define ARIZONA_MAX_OUTPUT 6
64 64
65#define ARIZONA_MAX_AIF 3
66
65#define ARIZONA_HAP_ACT_ERM 0 67#define ARIZONA_HAP_ACT_ERM 0
66#define ARIZONA_HAP_ACT_LRA 2 68#define ARIZONA_HAP_ACT_LRA 2
67 69
@@ -96,9 +98,37 @@ struct arizona_pdata {
96 /** Pin state for GPIO pins */ 98 /** Pin state for GPIO pins */
97 int gpio_defaults[ARIZONA_MAX_GPIO]; 99 int gpio_defaults[ARIZONA_MAX_GPIO];
98 100
101 /**
102 * Maximum number of channels clocks will be generated for,
103 * useful for systems where and I2S bus with multiple data
104 * lines is mastered.
105 */
106 int max_channels_clocked[ARIZONA_MAX_AIF];
107
108 /** GPIO5 is used for jack detection */
109 bool jd_gpio5;
110
111 /** Use the headphone detect circuit to identify the accessory */
112 bool hpdet_acc_id;
113
114 /** GPIO used for mic isolation with HPDET */
115 int hpdet_id_gpio;
116
99 /** GPIO for mic detection polarity */ 117 /** GPIO for mic detection polarity */
100 int micd_pol_gpio; 118 int micd_pol_gpio;
101 119
120 /** Mic detect ramp rate */
121 int micd_bias_start_time;
122
123 /** Mic detect sample rate */
124 int micd_rate;
125
126 /** Mic detect debounce level */
127 int micd_dbtime;
128
129 /** Force MICBIAS on for mic detect */
130 bool micd_force_micbias;
131
102 /** Headset polarity configurations */ 132 /** Headset polarity configurations */
103 struct arizona_micd_config *micd_configs; 133 struct arizona_micd_config *micd_configs;
104 int num_micd_configs; 134 int num_micd_configs;
diff --git a/include/linux/mfd/arizona/registers.h b/include/linux/mfd/arizona/registers.h
index 1f6fe31a4d5c..188d89abd963 100644
--- a/include/linux/mfd/arizona/registers.h
+++ b/include/linux/mfd/arizona/registers.h
@@ -119,6 +119,8 @@
119#define ARIZONA_ACCESSORY_DETECT_MODE_1 0x293 119#define ARIZONA_ACCESSORY_DETECT_MODE_1 0x293
120#define ARIZONA_HEADPHONE_DETECT_1 0x29B 120#define ARIZONA_HEADPHONE_DETECT_1 0x29B
121#define ARIZONA_HEADPHONE_DETECT_2 0x29C 121#define ARIZONA_HEADPHONE_DETECT_2 0x29C
122#define ARIZONA_HP_DACVAL 0x29F
123#define ARIZONA_MICD_CLAMP_CONTROL 0x2A2
122#define ARIZONA_MIC_DETECT_1 0x2A3 124#define ARIZONA_MIC_DETECT_1 0x2A3
123#define ARIZONA_MIC_DETECT_2 0x2A4 125#define ARIZONA_MIC_DETECT_2 0x2A4
124#define ARIZONA_MIC_DETECT_3 0x2A5 126#define ARIZONA_MIC_DETECT_3 0x2A5
@@ -1194,6 +1196,14 @@
1194/* 1196/*
1195 * R64 (0x40) - Wake control 1197 * R64 (0x40) - Wake control
1196 */ 1198 */
1199#define ARIZONA_WKUP_MICD_CLAMP_FALL 0x0080 /* WKUP_MICD_CLAMP_FALL */
1200#define ARIZONA_WKUP_MICD_CLAMP_FALL_MASK 0x0080 /* WKUP_MICD_CLAMP_FALL */
1201#define ARIZONA_WKUP_MICD_CLAMP_FALL_SHIFT 7 /* WKUP_MICD_CLAMP_FALL */
1202#define ARIZONA_WKUP_MICD_CLAMP_FALL_WIDTH 1 /* WKUP_MICD_CLAMP_FALL */
1203#define ARIZONA_WKUP_MICD_CLAMP_RISE 0x0040 /* WKUP_MICD_CLAMP_RISE */
1204#define ARIZONA_WKUP_MICD_CLAMP_RISE_MASK 0x0040 /* WKUP_MICD_CLAMP_RISE */
1205#define ARIZONA_WKUP_MICD_CLAMP_RISE_SHIFT 6 /* WKUP_MICD_CLAMP_RISE */
1206#define ARIZONA_WKUP_MICD_CLAMP_RISE_WIDTH 1 /* WKUP_MICD_CLAMP_RISE */
1197#define ARIZONA_WKUP_GP5_FALL 0x0020 /* WKUP_GP5_FALL */ 1207#define ARIZONA_WKUP_GP5_FALL 0x0020 /* WKUP_GP5_FALL */
1198#define ARIZONA_WKUP_GP5_FALL_MASK 0x0020 /* WKUP_GP5_FALL */ 1208#define ARIZONA_WKUP_GP5_FALL_MASK 0x0020 /* WKUP_GP5_FALL */
1199#define ARIZONA_WKUP_GP5_FALL_SHIFT 5 /* WKUP_GP5_FALL */ 1209#define ARIZONA_WKUP_GP5_FALL_SHIFT 5 /* WKUP_GP5_FALL */
@@ -2035,6 +2045,9 @@
2035/* 2045/*
2036 * R667 (0x29B) - Headphone Detect 1 2046 * R667 (0x29B) - Headphone Detect 1
2037 */ 2047 */
2048#define ARIZONA_HP_IMPEDANCE_RANGE_MASK 0x0600 /* HP_IMPEDANCE_RANGE - [10:9] */
2049#define ARIZONA_HP_IMPEDANCE_RANGE_SHIFT 9 /* HP_IMPEDANCE_RANGE - [10:9] */
2050#define ARIZONA_HP_IMPEDANCE_RANGE_WIDTH 2 /* HP_IMPEDANCE_RANGE - [10:9] */
2038#define ARIZONA_HP_STEP_SIZE 0x0100 /* HP_STEP_SIZE */ 2051#define ARIZONA_HP_STEP_SIZE 0x0100 /* HP_STEP_SIZE */
2039#define ARIZONA_HP_STEP_SIZE_MASK 0x0100 /* HP_STEP_SIZE */ 2052#define ARIZONA_HP_STEP_SIZE_MASK 0x0100 /* HP_STEP_SIZE */
2040#define ARIZONA_HP_STEP_SIZE_SHIFT 8 /* HP_STEP_SIZE */ 2053#define ARIZONA_HP_STEP_SIZE_SHIFT 8 /* HP_STEP_SIZE */
@@ -2069,6 +2082,21 @@
2069#define ARIZONA_HP_LVL_SHIFT 0 /* HP_LVL - [6:0] */ 2082#define ARIZONA_HP_LVL_SHIFT 0 /* HP_LVL - [6:0] */
2070#define ARIZONA_HP_LVL_WIDTH 7 /* HP_LVL - [6:0] */ 2083#define ARIZONA_HP_LVL_WIDTH 7 /* HP_LVL - [6:0] */
2071 2084
2085#define ARIZONA_HP_DONE_B 0x8000 /* HP_DONE */
2086#define ARIZONA_HP_DONE_B_MASK 0x8000 /* HP_DONE */
2087#define ARIZONA_HP_DONE_B_SHIFT 15 /* HP_DONE */
2088#define ARIZONA_HP_DONE_B_WIDTH 1 /* HP_DONE */
2089#define ARIZONA_HP_LVL_B_MASK 0x7FFF /* HP_LVL - [14:0] */
2090#define ARIZONA_HP_LVL_B_SHIFT 0 /* HP_LVL - [14:0] */
2091#define ARIZONA_HP_LVL_B_WIDTH 15 /* HP_LVL - [14:0] */
2092
2093/*
2094 * R674 (0x2A2) - MICD clamp control
2095 */
2096#define ARIZONA_MICD_CLAMP_MODE_MASK 0x000F /* MICD_CLAMP_MODE - [3:0] */
2097#define ARIZONA_MICD_CLAMP_MODE_SHIFT 0 /* MICD_CLAMP_MODE - [3:0] */
2098#define ARIZONA_MICD_CLAMP_MODE_WIDTH 4 /* MICD_CLAMP_MODE - [3:0] */
2099
2072/* 2100/*
2073 * R675 (0x2A3) - Mic Detect 1 2101 * R675 (0x2A3) - Mic Detect 1
2074 */ 2102 */
@@ -5239,6 +5267,14 @@
5239/* 5267/*
5240 * R3408 (0xD50) - AOD wkup and trig 5268 * R3408 (0xD50) - AOD wkup and trig
5241 */ 5269 */
5270#define ARIZONA_MICD_CLAMP_FALL_TRIG_STS 0x0080 /* MICD_CLAMP_FALL_TRIG_STS */
5271#define ARIZONA_MICD_CLAMP_FALL_TRIG_STS_MASK 0x0080 /* MICD_CLAMP_FALL_TRIG_STS */
5272#define ARIZONA_MICD_CLAMP_FALL_TRIG_STS_SHIFT 7 /* MICD_CLAMP_FALL_TRIG_STS */
5273#define ARIZONA_MICD_CLAMP_FALL_TRIG_STS_WIDTH 1 /* MICD_CLAMP_FALL_TRIG_STS */
5274#define ARIZONA_MICD_CLAMP_RISE_TRIG_STS 0x0040 /* MICD_CLAMP_RISE_TRIG_STS */
5275#define ARIZONA_MICD_CLAMP_RISE_TRIG_STS_MASK 0x0040 /* MICD_CLAMP_RISE_TRIG_STS */
5276#define ARIZONA_MICD_CLAMP_RISE_TRIG_STS_SHIFT 6 /* MICD_CLAMP_RISE_TRIG_STS */
5277#define ARIZONA_MICD_CLAMP_RISE_TRIG_STS_WIDTH 1 /* MICD_CLAMP_RISE_TRIG_STS */
5242#define ARIZONA_GP5_FALL_TRIG_STS 0x0020 /* GP5_FALL_TRIG_STS */ 5278#define ARIZONA_GP5_FALL_TRIG_STS 0x0020 /* GP5_FALL_TRIG_STS */
5243#define ARIZONA_GP5_FALL_TRIG_STS_MASK 0x0020 /* GP5_FALL_TRIG_STS */ 5279#define ARIZONA_GP5_FALL_TRIG_STS_MASK 0x0020 /* GP5_FALL_TRIG_STS */
5244#define ARIZONA_GP5_FALL_TRIG_STS_SHIFT 5 /* GP5_FALL_TRIG_STS */ 5280#define ARIZONA_GP5_FALL_TRIG_STS_SHIFT 5 /* GP5_FALL_TRIG_STS */
@@ -5267,6 +5303,12 @@
5267/* 5303/*
5268 * R3409 (0xD51) - AOD IRQ1 5304 * R3409 (0xD51) - AOD IRQ1
5269 */ 5305 */
5306#define ARIZONA_MICD_CLAMP_FALL_EINT1 0x0080 /* MICD_CLAMP_FALL_EINT1 */
5307#define ARIZONA_MICD_CLAMP_FALL_EINT1_MASK 0x0080 /* MICD_CLAMP_FALL_EINT1 */
5308#define ARIZONA_MICD_CLAMP_FALL_EINT1_SHIFT 7 /* MICD_CLAMP_FALL_EINT1 */
5309#define ARIZONA_MICD_CLAMP_RISE_EINT1 0x0040 /* MICD_CLAMP_RISE_EINT1 */
5310#define ARIZONA_MICD_CLAMP_RISE_EINT1_MASK 0x0040 /* MICD_CLAMP_RISE_EINT1 */
5311#define ARIZONA_MICD_CLAMP_RISE_EINT1_SHIFT 6 /* MICD_CLAMP_RISE_EINT1 */
5270#define ARIZONA_GP5_FALL_EINT1 0x0020 /* GP5_FALL_EINT1 */ 5312#define ARIZONA_GP5_FALL_EINT1 0x0020 /* GP5_FALL_EINT1 */
5271#define ARIZONA_GP5_FALL_EINT1_MASK 0x0020 /* GP5_FALL_EINT1 */ 5313#define ARIZONA_GP5_FALL_EINT1_MASK 0x0020 /* GP5_FALL_EINT1 */
5272#define ARIZONA_GP5_FALL_EINT1_SHIFT 5 /* GP5_FALL_EINT1 */ 5314#define ARIZONA_GP5_FALL_EINT1_SHIFT 5 /* GP5_FALL_EINT1 */
@@ -5295,6 +5337,12 @@
5295/* 5337/*
5296 * R3410 (0xD52) - AOD IRQ2 5338 * R3410 (0xD52) - AOD IRQ2
5297 */ 5339 */
5340#define ARIZONA_MICD_CLAMP_FALL_EINT2 0x0080 /* MICD_CLAMP_FALL_EINT2 */
5341#define ARIZONA_MICD_CLAMP_FALL_EINT2_MASK 0x0080 /* MICD_CLAMP_FALL_EINT2 */
5342#define ARIZONA_MICD_CLAMP_FALL_EINT2_SHIFT 7 /* MICD_CLAMP_FALL_EINT2 */
5343#define ARIZONA_MICD_CLAMP_RISE_EINT2 0x0040 /* MICD_CLAMP_RISE_EINT2 */
5344#define ARIZONA_MICD_CLAMP_RISE_EINT2_MASK 0x0040 /* MICD_CLAMP_RISE_EINT2 */
5345#define ARIZONA_MICD_CLAMP_RISE_EINT2_SHIFT 6 /* MICD_CLAMP_RISE_EINT2 */
5298#define ARIZONA_GP5_FALL_EINT2 0x0020 /* GP5_FALL_EINT2 */ 5346#define ARIZONA_GP5_FALL_EINT2 0x0020 /* GP5_FALL_EINT2 */
5299#define ARIZONA_GP5_FALL_EINT2_MASK 0x0020 /* GP5_FALL_EINT2 */ 5347#define ARIZONA_GP5_FALL_EINT2_MASK 0x0020 /* GP5_FALL_EINT2 */
5300#define ARIZONA_GP5_FALL_EINT2_SHIFT 5 /* GP5_FALL_EINT2 */ 5348#define ARIZONA_GP5_FALL_EINT2_SHIFT 5 /* GP5_FALL_EINT2 */
@@ -5379,6 +5427,10 @@
5379/* 5427/*
5380 * R3413 (0xD55) - AOD IRQ Raw Status 5428 * R3413 (0xD55) - AOD IRQ Raw Status
5381 */ 5429 */
5430#define ARIZONA_MICD_CLAMP_STS 0x0008 /* MICD_CLAMP_STS */
5431#define ARIZONA_MICD_CLAMP_STS_MASK 0x0008 /* MICD_CLAMP_STS */
5432#define ARIZONA_MICD_CLAMP_STS_SHIFT 3 /* MICD_CLAMP_STS */
5433#define ARIZONA_MICD_CLAMP_STS_WIDTH 1 /* MICD_CLAMP_STS */
5382#define ARIZONA_GP5_STS 0x0004 /* GP5_STS */ 5434#define ARIZONA_GP5_STS 0x0004 /* GP5_STS */
5383#define ARIZONA_GP5_STS_MASK 0x0004 /* GP5_STS */ 5435#define ARIZONA_GP5_STS_MASK 0x0004 /* GP5_STS */
5384#define ARIZONA_GP5_STS_SHIFT 2 /* GP5_STS */ 5436#define ARIZONA_GP5_STS_SHIFT 2 /* GP5_STS */
@@ -5395,6 +5447,10 @@
5395/* 5447/*
5396 * R3414 (0xD56) - Jack detect debounce 5448 * R3414 (0xD56) - Jack detect debounce
5397 */ 5449 */
5450#define ARIZONA_MICD_CLAMP_DB 0x0008 /* MICD_CLAMP_DB */
5451#define ARIZONA_MICD_CLAMP_DB_MASK 0x0008 /* MICD_CLAMP_DB */
5452#define ARIZONA_MICD_CLAMP_DB_SHIFT 3 /* MICD_CLAMP_DB */
5453#define ARIZONA_MICD_CLAMP_DB_WIDTH 1 /* MICD_CLAMP_DB */
5398#define ARIZONA_JD2_DB 0x0002 /* JD2_DB */ 5454#define ARIZONA_JD2_DB 0x0002 /* JD2_DB */
5399#define ARIZONA_JD2_DB_MASK 0x0002 /* JD2_DB */ 5455#define ARIZONA_JD2_DB_MASK 0x0002 /* JD2_DB */
5400#define ARIZONA_JD2_DB_SHIFT 1 /* JD2_DB */ 5456#define ARIZONA_JD2_DB_SHIFT 1 /* JD2_DB */
diff --git a/include/linux/mfd/da9052/da9052.h b/include/linux/mfd/da9052/da9052.h
index 86dd93de6ff2..786d02eb79d2 100644
--- a/include/linux/mfd/da9052/da9052.h
+++ b/include/linux/mfd/da9052/da9052.h
@@ -99,6 +99,9 @@ struct da9052 {
99 u8 chip_id; 99 u8 chip_id;
100 100
101 int chip_irq; 101 int chip_irq;
102
103 /* SOC I/O transfer related fixes for DA9052/53 */
104 int (*fix_io) (struct da9052 *da9052, unsigned char reg);
102}; 105};
103 106
104/* ADC API */ 107/* ADC API */
@@ -113,32 +116,87 @@ static inline int da9052_reg_read(struct da9052 *da9052, unsigned char reg)
113 ret = regmap_read(da9052->regmap, reg, &val); 116 ret = regmap_read(da9052->regmap, reg, &val);
114 if (ret < 0) 117 if (ret < 0)
115 return ret; 118 return ret;
119
120 if (da9052->fix_io) {
121 ret = da9052->fix_io(da9052, reg);
122 if (ret < 0)
123 return ret;
124 }
125
116 return val; 126 return val;
117} 127}
118 128
119static inline int da9052_reg_write(struct da9052 *da9052, unsigned char reg, 129static inline int da9052_reg_write(struct da9052 *da9052, unsigned char reg,
120 unsigned char val) 130 unsigned char val)
121{ 131{
122 return regmap_write(da9052->regmap, reg, val); 132 int ret;
133
134 ret = regmap_write(da9052->regmap, reg, val);
135 if (ret < 0)
136 return ret;
137
138 if (da9052->fix_io) {
139 ret = da9052->fix_io(da9052, reg);
140 if (ret < 0)
141 return ret;
142 }
143
144 return ret;
123} 145}
124 146
125static inline int da9052_group_read(struct da9052 *da9052, unsigned char reg, 147static inline int da9052_group_read(struct da9052 *da9052, unsigned char reg,
126 unsigned reg_cnt, unsigned char *val) 148 unsigned reg_cnt, unsigned char *val)
127{ 149{
128 return regmap_bulk_read(da9052->regmap, reg, val, reg_cnt); 150 int ret;
151
152 ret = regmap_bulk_read(da9052->regmap, reg, val, reg_cnt);
153 if (ret < 0)
154 return ret;
155
156 if (da9052->fix_io) {
157 ret = da9052->fix_io(da9052, reg);
158 if (ret < 0)
159 return ret;
160 }
161
162 return ret;
129} 163}
130 164
131static inline int da9052_group_write(struct da9052 *da9052, unsigned char reg, 165static inline int da9052_group_write(struct da9052 *da9052, unsigned char reg,
132 unsigned reg_cnt, unsigned char *val) 166 unsigned reg_cnt, unsigned char *val)
133{ 167{
134 return regmap_raw_write(da9052->regmap, reg, val, reg_cnt); 168 int ret;
169
170 ret = regmap_raw_write(da9052->regmap, reg, val, reg_cnt);
171 if (ret < 0)
172 return ret;
173
174 if (da9052->fix_io) {
175 ret = da9052->fix_io(da9052, reg);
176 if (ret < 0)
177 return ret;
178 }
179
180 return ret;
135} 181}
136 182
137static inline int da9052_reg_update(struct da9052 *da9052, unsigned char reg, 183static inline int da9052_reg_update(struct da9052 *da9052, unsigned char reg,
138 unsigned char bit_mask, 184 unsigned char bit_mask,
139 unsigned char reg_val) 185 unsigned char reg_val)
140{ 186{
141 return regmap_update_bits(da9052->regmap, reg, bit_mask, reg_val); 187 int ret;
188
189 ret = regmap_update_bits(da9052->regmap, reg, bit_mask, reg_val);
190 if (ret < 0)
191 return ret;
192
193 if (da9052->fix_io) {
194 ret = da9052->fix_io(da9052, reg);
195 if (ret < 0)
196 return ret;
197 }
198
199 return ret;
142} 200}
143 201
144int da9052_device_init(struct da9052 *da9052, u8 chip_id); 202int da9052_device_init(struct da9052 *da9052, u8 chip_id);
diff --git a/include/linux/mfd/da9052/reg.h b/include/linux/mfd/da9052/reg.h
index b97f7309d7f6..c4dd3a8add21 100644
--- a/include/linux/mfd/da9052/reg.h
+++ b/include/linux/mfd/da9052/reg.h
@@ -34,6 +34,9 @@
34#define DA9052_STATUS_C_REG 3 34#define DA9052_STATUS_C_REG 3
35#define DA9052_STATUS_D_REG 4 35#define DA9052_STATUS_D_REG 4
36 36
37/* PARK REGISTER */
38#define DA9052_PARK_REGISTER DA9052_STATUS_D_REG
39
37/* EVENT REGISTERS */ 40/* EVENT REGISTERS */
38#define DA9052_EVENT_A_REG 5 41#define DA9052_EVENT_A_REG 5
39#define DA9052_EVENT_B_REG 6 42#define DA9052_EVENT_B_REG 6
diff --git a/include/linux/mfd/db8500-prcmu.h b/include/linux/mfd/db8500-prcmu.h
index 6ee4247df11e..77a46ae2fc17 100644
--- a/include/linux/mfd/db8500-prcmu.h
+++ b/include/linux/mfd/db8500-prcmu.h
@@ -16,12 +16,6 @@
16/* 16/*
17 * Registers 17 * Registers
18 */ 18 */
19#define DB8500_PRCM_GPIOCR 0x138
20#define DB8500_PRCM_GPIOCR_DBG_UARTMOD_CMD0 BIT(0)
21#define DB8500_PRCM_GPIOCR_DBG_STM_APE_CMD BIT(9)
22#define DB8500_PRCM_GPIOCR_DBG_STM_MOD_CMD1 BIT(11)
23#define DB8500_PRCM_GPIOCR_SPI2_SELECT BIT(23)
24
25#define DB8500_PRCM_LINE_VALUE 0x170 19#define DB8500_PRCM_LINE_VALUE 0x170
26#define DB8500_PRCM_LINE_VALUE_HSI_CAWAKE0 BIT(3) 20#define DB8500_PRCM_LINE_VALUE_HSI_CAWAKE0 BIT(3)
27 21
@@ -493,20 +487,6 @@ struct prcmu_auto_pm_config {
493 u8 sva_policy; 487 u8 sva_policy;
494}; 488};
495 489
496#define PRCMU_FW_PROJECT_U8500 2
497#define PRCMU_FW_PROJECT_U9500 4
498#define PRCMU_FW_PROJECT_U8500_C2 7
499#define PRCMU_FW_PROJECT_U9500_C2 11
500#define PRCMU_FW_PROJECT_U8520 13
501#define PRCMU_FW_PROJECT_U8420 14
502
503struct prcmu_fw_version {
504 u8 project;
505 u8 api_version;
506 u8 func_version;
507 u8 errata;
508};
509
510#ifdef CONFIG_MFD_DB8500_PRCMU 490#ifdef CONFIG_MFD_DB8500_PRCMU
511 491
512void db8500_prcmu_early_init(void); 492void db8500_prcmu_early_init(void);
diff --git a/include/linux/mfd/dbx500-prcmu.h b/include/linux/mfd/dbx500-prcmu.h
index c202d6c4d879..f8bac7cfc25f 100644
--- a/include/linux/mfd/dbx500-prcmu.h
+++ b/include/linux/mfd/dbx500-prcmu.h
@@ -12,6 +12,10 @@
12#include <linux/notifier.h> 12#include <linux/notifier.h>
13#include <linux/err.h> 13#include <linux/err.h>
14 14
15/* Offset for the firmware version within the TCPM */
16#define DB8500_PRCMU_FW_VERSION_OFFSET 0xA4
17#define DBX540_PRCMU_FW_VERSION_OFFSET 0xA8
18
15/* PRCMU Wakeup defines */ 19/* PRCMU Wakeup defines */
16enum prcmu_wakeup_index { 20enum prcmu_wakeup_index {
17 PRCMU_WAKEUP_INDEX_RTC, 21 PRCMU_WAKEUP_INDEX_RTC,
@@ -214,12 +218,52 @@ enum ddr_pwrst {
214 DDR_PWR_STATE_OFFHIGHLAT = 0x03 218 DDR_PWR_STATE_OFFHIGHLAT = 0x03
215}; 219};
216 220
221#define DB8500_PRCMU_LEGACY_OFFSET 0xDD4
222
223struct prcmu_pdata
224{
225 bool enable_set_ddr_opp;
226 bool enable_ape_opp_100_voltage;
227 struct ab8500_platform_data *ab_platdata;
228 u32 version_offset;
229 u32 legacy_offset;
230 u32 adt_offset;
231};
232
233#define PRCMU_FW_PROJECT_U8500 2
234#define PRCMU_FW_PROJECT_U8400 3
235#define PRCMU_FW_PROJECT_U9500 4 /* Customer specific */
236#define PRCMU_FW_PROJECT_U8500_MBB 5
237#define PRCMU_FW_PROJECT_U8500_C1 6
238#define PRCMU_FW_PROJECT_U8500_C2 7
239#define PRCMU_FW_PROJECT_U8500_C3 8
240#define PRCMU_FW_PROJECT_U8500_C4 9
241#define PRCMU_FW_PROJECT_U9500_MBL 10
242#define PRCMU_FW_PROJECT_U8500_MBL 11 /* Customer specific */
243#define PRCMU_FW_PROJECT_U8500_MBL2 12 /* Customer specific */
244#define PRCMU_FW_PROJECT_U8520 13
245#define PRCMU_FW_PROJECT_U8420 14
246#define PRCMU_FW_PROJECT_A9420 20
247/* [32..63] 9540 and derivatives */
248#define PRCMU_FW_PROJECT_U9540 32
249/* [64..95] 8540 and derivatives */
250#define PRCMU_FW_PROJECT_L8540 64
251/* [96..126] 8580 and derivatives */
252#define PRCMU_FW_PROJECT_L8580 96
253
254#define PRCMU_FW_PROJECT_NAME_LEN 20
255struct prcmu_fw_version {
256 u32 project; /* Notice, project shifted with 8 on ux540 */
257 u8 api_version;
258 u8 func_version;
259 u8 errata;
260 char project_name[PRCMU_FW_PROJECT_NAME_LEN];
261};
262
217#include <linux/mfd/db8500-prcmu.h> 263#include <linux/mfd/db8500-prcmu.h>
218 264
219#if defined(CONFIG_UX500_SOC_DB8500) 265#if defined(CONFIG_UX500_SOC_DB8500)
220 266
221#include <mach/id.h>
222
223static inline void __init prcmu_early_init(void) 267static inline void __init prcmu_early_init(void)
224{ 268{
225 return db8500_prcmu_early_init(); 269 return db8500_prcmu_early_init();
@@ -626,85 +670,6 @@ static inline void prcmu_clear(unsigned int reg, u32 bits)
626 prcmu_write_masked(reg, bits, 0); 670 prcmu_write_masked(reg, bits, 0);
627} 671}
628 672
629#if defined(CONFIG_UX500_SOC_DB8500)
630
631/**
632 * prcmu_enable_spi2 - Enables pin muxing for SPI2 on OtherAlternateC1.
633 */
634static inline void prcmu_enable_spi2(void)
635{
636 if (cpu_is_u8500())
637 prcmu_set(DB8500_PRCM_GPIOCR, DB8500_PRCM_GPIOCR_SPI2_SELECT);
638}
639
640/**
641 * prcmu_disable_spi2 - Disables pin muxing for SPI2 on OtherAlternateC1.
642 */
643static inline void prcmu_disable_spi2(void)
644{
645 if (cpu_is_u8500())
646 prcmu_clear(DB8500_PRCM_GPIOCR, DB8500_PRCM_GPIOCR_SPI2_SELECT);
647}
648
649/**
650 * prcmu_enable_stm_mod_uart - Enables pin muxing for STMMOD
651 * and UARTMOD on OtherAlternateC3.
652 */
653static inline void prcmu_enable_stm_mod_uart(void)
654{
655 if (cpu_is_u8500()) {
656 prcmu_set(DB8500_PRCM_GPIOCR,
657 (DB8500_PRCM_GPIOCR_DBG_STM_MOD_CMD1 |
658 DB8500_PRCM_GPIOCR_DBG_UARTMOD_CMD0));
659 }
660}
661
662/**
663 * prcmu_disable_stm_mod_uart - Disables pin muxing for STMMOD
664 * and UARTMOD on OtherAlternateC3.
665 */
666static inline void prcmu_disable_stm_mod_uart(void)
667{
668 if (cpu_is_u8500()) {
669 prcmu_clear(DB8500_PRCM_GPIOCR,
670 (DB8500_PRCM_GPIOCR_DBG_STM_MOD_CMD1 |
671 DB8500_PRCM_GPIOCR_DBG_UARTMOD_CMD0));
672 }
673}
674
675/**
676 * prcmu_enable_stm_ape - Enables pin muxing for STM APE on OtherAlternateC1.
677 */
678static inline void prcmu_enable_stm_ape(void)
679{
680 if (cpu_is_u8500()) {
681 prcmu_set(DB8500_PRCM_GPIOCR,
682 DB8500_PRCM_GPIOCR_DBG_STM_APE_CMD);
683 }
684}
685
686/**
687 * prcmu_disable_stm_ape - Disables pin muxing for STM APE on OtherAlternateC1.
688 */
689static inline void prcmu_disable_stm_ape(void)
690{
691 if (cpu_is_u8500()) {
692 prcmu_clear(DB8500_PRCM_GPIOCR,
693 DB8500_PRCM_GPIOCR_DBG_STM_APE_CMD);
694 }
695}
696
697#else
698
699static inline void prcmu_enable_spi2(void) {}
700static inline void prcmu_disable_spi2(void) {}
701static inline void prcmu_enable_stm_mod_uart(void) {}
702static inline void prcmu_disable_stm_mod_uart(void) {}
703static inline void prcmu_enable_stm_ape(void) {}
704static inline void prcmu_disable_stm_ape(void) {}
705
706#endif
707
708/* PRCMU QoS APE OPP class */ 673/* PRCMU QoS APE OPP class */
709#define PRCMU_QOS_APE_OPP 1 674#define PRCMU_QOS_APE_OPP 1
710#define PRCMU_QOS_DDR_OPP 2 675#define PRCMU_QOS_DDR_OPP 2
diff --git a/include/linux/mfd/max77693-private.h b/include/linux/mfd/max77693-private.h
index 1eeae5c07915..5b18ecde69b5 100644
--- a/include/linux/mfd/max77693-private.h
+++ b/include/linux/mfd/max77693-private.h
@@ -106,6 +106,92 @@ enum max77693_muic_reg {
106 MAX77693_MUIC_REG_END, 106 MAX77693_MUIC_REG_END,
107}; 107};
108 108
109/* MAX77693 MUIC - STATUS1~3 Register */
110#define STATUS1_ADC_SHIFT (0)
111#define STATUS1_ADCLOW_SHIFT (5)
112#define STATUS1_ADCERR_SHIFT (6)
113#define STATUS1_ADC1K_SHIFT (7)
114#define STATUS1_ADC_MASK (0x1f << STATUS1_ADC_SHIFT)
115#define STATUS1_ADCLOW_MASK (0x1 << STATUS1_ADCLOW_SHIFT)
116#define STATUS1_ADCERR_MASK (0x1 << STATUS1_ADCERR_SHIFT)
117#define STATUS1_ADC1K_MASK (0x1 << STATUS1_ADC1K_SHIFT)
118
119#define STATUS2_CHGTYP_SHIFT (0)
120#define STATUS2_CHGDETRUN_SHIFT (3)
121#define STATUS2_DCDTMR_SHIFT (4)
122#define STATUS2_DXOVP_SHIFT (5)
123#define STATUS2_VBVOLT_SHIFT (6)
124#define STATUS2_VIDRM_SHIFT (7)
125#define STATUS2_CHGTYP_MASK (0x7 << STATUS2_CHGTYP_SHIFT)
126#define STATUS2_CHGDETRUN_MASK (0x1 << STATUS2_CHGDETRUN_SHIFT)
127#define STATUS2_DCDTMR_MASK (0x1 << STATUS2_DCDTMR_SHIFT)
128#define STATUS2_DXOVP_MASK (0x1 << STATUS2_DXOVP_SHIFT)
129#define STATUS2_VBVOLT_MASK (0x1 << STATUS2_VBVOLT_SHIFT)
130#define STATUS2_VIDRM_MASK (0x1 << STATUS2_VIDRM_SHIFT)
131
132#define STATUS3_OVP_SHIFT (2)
133#define STATUS3_OVP_MASK (0x1 << STATUS3_OVP_SHIFT)
134
135/* MAX77693 CDETCTRL1~2 register */
136#define CDETCTRL1_CHGDETEN_SHIFT (0)
137#define CDETCTRL1_CHGTYPMAN_SHIFT (1)
138#define CDETCTRL1_DCDEN_SHIFT (2)
139#define CDETCTRL1_DCD2SCT_SHIFT (3)
140#define CDETCTRL1_CDDELAY_SHIFT (4)
141#define CDETCTRL1_DCDCPL_SHIFT (5)
142#define CDETCTRL1_CDPDET_SHIFT (7)
143#define CDETCTRL1_CHGDETEN_MASK (0x1 << CDETCTRL1_CHGDETEN_SHIFT)
144#define CDETCTRL1_CHGTYPMAN_MASK (0x1 << CDETCTRL1_CHGTYPMAN_SHIFT)
145#define CDETCTRL1_DCDEN_MASK (0x1 << CDETCTRL1_DCDEN_SHIFT)
146#define CDETCTRL1_DCD2SCT_MASK (0x1 << CDETCTRL1_DCD2SCT_SHIFT)
147#define CDETCTRL1_CDDELAY_MASK (0x1 << CDETCTRL1_CDDELAY_SHIFT)
148#define CDETCTRL1_DCDCPL_MASK (0x1 << CDETCTRL1_DCDCPL_SHIFT)
149#define CDETCTRL1_CDPDET_MASK (0x1 << CDETCTRL1_CDPDET_SHIFT)
150
151#define CDETCTRL2_VIDRMEN_SHIFT (1)
152#define CDETCTRL2_DXOVPEN_SHIFT (3)
153#define CDETCTRL2_VIDRMEN_MASK (0x1 << CDETCTRL2_VIDRMEN_SHIFT)
154#define CDETCTRL2_DXOVPEN_MASK (0x1 << CDETCTRL2_DXOVPEN_SHIFT)
155
156/* MAX77693 MUIC - CONTROL1~3 register */
157#define COMN1SW_SHIFT (0)
158#define COMP2SW_SHIFT (3)
159#define COMN1SW_MASK (0x7 << COMN1SW_SHIFT)
160#define COMP2SW_MASK (0x7 << COMP2SW_SHIFT)
161#define COMP_SW_MASK (COMP2SW_MASK | COMN1SW_MASK)
162#define CONTROL1_SW_USB ((1 << COMP2SW_SHIFT) \
163 | (1 << COMN1SW_SHIFT))
164#define CONTROL1_SW_AUDIO ((2 << COMP2SW_SHIFT) \
165 | (2 << COMN1SW_SHIFT))
166#define CONTROL1_SW_UART ((3 << COMP2SW_SHIFT) \
167 | (3 << COMN1SW_SHIFT))
168#define CONTROL1_SW_OPEN ((0 << COMP2SW_SHIFT) \
169 | (0 << COMN1SW_SHIFT))
170
171#define CONTROL2_LOWPWR_SHIFT (0)
172#define CONTROL2_ADCEN_SHIFT (1)
173#define CONTROL2_CPEN_SHIFT (2)
174#define CONTROL2_SFOUTASRT_SHIFT (3)
175#define CONTROL2_SFOUTORD_SHIFT (4)
176#define CONTROL2_ACCDET_SHIFT (5)
177#define CONTROL2_USBCPINT_SHIFT (6)
178#define CONTROL2_RCPS_SHIFT (7)
179#define CONTROL2_LOWPWR_MASK (0x1 << CONTROL2_LOWPWR_SHIFT)
180#define CONTROL2_ADCEN_MASK (0x1 << CONTROL2_ADCEN_SHIFT)
181#define CONTROL2_CPEN_MASK (0x1 << CONTROL2_CPEN_SHIFT)
182#define CONTROL2_SFOUTASRT_MASK (0x1 << CONTROL2_SFOUTASRT_SHIFT)
183#define CONTROL2_SFOUTORD_MASK (0x1 << CONTROL2_SFOUTORD_SHIFT)
184#define CONTROL2_ACCDET_MASK (0x1 << CONTROL2_ACCDET_SHIFT)
185#define CONTROL2_USBCPINT_MASK (0x1 << CONTROL2_USBCPINT_SHIFT)
186#define CONTROL2_RCPS_MASK (0x1 << CONTROL2_RCPS_SHIFT)
187
188#define CONTROL3_JIGSET_SHIFT (0)
189#define CONTROL3_BTLDSET_SHIFT (2)
190#define CONTROL3_ADCDBSET_SHIFT (4)
191#define CONTROL3_JIGSET_MASK (0x3 << CONTROL3_JIGSET_SHIFT)
192#define CONTROL3_BTLDSET_MASK (0x3 << CONTROL3_BTLDSET_SHIFT)
193#define CONTROL3_ADCDBSET_MASK (0x3 << CONTROL3_ADCDBSET_SHIFT)
194
109/* Slave addr = 0x90: Haptic */ 195/* Slave addr = 0x90: Haptic */
110enum max77693_haptic_reg { 196enum max77693_haptic_reg {
111 MAX77693_HAPTIC_REG_STATUS = 0x00, 197 MAX77693_HAPTIC_REG_STATUS = 0x00,
diff --git a/include/linux/mfd/max77693.h b/include/linux/mfd/max77693.h
index fe03b2d35d4f..3109a6c5c948 100644
--- a/include/linux/mfd/max77693.h
+++ b/include/linux/mfd/max77693.h
@@ -38,6 +38,15 @@ struct max77693_reg_data {
38struct max77693_muic_platform_data { 38struct max77693_muic_platform_data {
39 struct max77693_reg_data *init_data; 39 struct max77693_reg_data *init_data;
40 int num_init_data; 40 int num_init_data;
41
42 int detcable_delay_ms;
43
44 /*
45 * Default usb/uart path whether UART/USB or AUX_UART/AUX_USB
46 * h/w path of COMP2/COMN1 on CONTROL1 register.
47 */
48 int path_usb;
49 int path_uart;
41}; 50};
42 51
43struct max77693_platform_data { 52struct max77693_platform_data {
diff --git a/include/linux/mfd/max8997-private.h b/include/linux/mfd/max8997-private.h
index 6ae21bf47d64..fb465dfbb59e 100644
--- a/include/linux/mfd/max8997-private.h
+++ b/include/linux/mfd/max8997-private.h
@@ -194,6 +194,70 @@ enum max8997_muic_reg {
194 MAX8997_MUIC_REG_END = 0xf, 194 MAX8997_MUIC_REG_END = 0xf,
195}; 195};
196 196
197/* MAX8997-MUIC STATUS1 register */
198#define STATUS1_ADC_SHIFT 0
199#define STATUS1_ADCLOW_SHIFT 5
200#define STATUS1_ADCERR_SHIFT 6
201#define STATUS1_ADC_MASK (0x1f << STATUS1_ADC_SHIFT)
202#define STATUS1_ADCLOW_MASK (0x1 << STATUS1_ADCLOW_SHIFT)
203#define STATUS1_ADCERR_MASK (0x1 << STATUS1_ADCERR_SHIFT)
204
205/* MAX8997-MUIC STATUS2 register */
206#define STATUS2_CHGTYP_SHIFT 0
207#define STATUS2_CHGDETRUN_SHIFT 3
208#define STATUS2_DCDTMR_SHIFT 4
209#define STATUS2_DBCHG_SHIFT 5
210#define STATUS2_VBVOLT_SHIFT 6
211#define STATUS2_CHGTYP_MASK (0x7 << STATUS2_CHGTYP_SHIFT)
212#define STATUS2_CHGDETRUN_MASK (0x1 << STATUS2_CHGDETRUN_SHIFT)
213#define STATUS2_DCDTMR_MASK (0x1 << STATUS2_DCDTMR_SHIFT)
214#define STATUS2_DBCHG_MASK (0x1 << STATUS2_DBCHG_SHIFT)
215#define STATUS2_VBVOLT_MASK (0x1 << STATUS2_VBVOLT_SHIFT)
216
217/* MAX8997-MUIC STATUS3 register */
218#define STATUS3_OVP_SHIFT 2
219#define STATUS3_OVP_MASK (0x1 << STATUS3_OVP_SHIFT)
220
221/* MAX8997-MUIC CONTROL1 register */
222#define COMN1SW_SHIFT 0
223#define COMP2SW_SHIFT 3
224#define COMN1SW_MASK (0x7 << COMN1SW_SHIFT)
225#define COMP2SW_MASK (0x7 << COMP2SW_SHIFT)
226#define COMP_SW_MASK (COMP2SW_MASK | COMN1SW_MASK)
227
228#define CONTROL1_SW_USB ((1 << COMP2SW_SHIFT) \
229 | (1 << COMN1SW_SHIFT))
230#define CONTROL1_SW_AUDIO ((2 << COMP2SW_SHIFT) \
231 | (2 << COMN1SW_SHIFT))
232#define CONTROL1_SW_UART ((3 << COMP2SW_SHIFT) \
233 | (3 << COMN1SW_SHIFT))
234#define CONTROL1_SW_OPEN ((0 << COMP2SW_SHIFT) \
235 | (0 << COMN1SW_SHIFT))
236
237#define CONTROL2_LOWPWR_SHIFT (0)
238#define CONTROL2_ADCEN_SHIFT (1)
239#define CONTROL2_CPEN_SHIFT (2)
240#define CONTROL2_SFOUTASRT_SHIFT (3)
241#define CONTROL2_SFOUTORD_SHIFT (4)
242#define CONTROL2_ACCDET_SHIFT (5)
243#define CONTROL2_USBCPINT_SHIFT (6)
244#define CONTROL2_RCPS_SHIFT (7)
245#define CONTROL2_LOWPWR_MASK (0x1 << CONTROL2_LOWPWR_SHIFT)
246#define CONTROL2_ADCEN_MASK (0x1 << CONTROL2_ADCEN_SHIFT)
247#define CONTROL2_CPEN_MASK (0x1 << CONTROL2_CPEN_SHIFT)
248#define CONTROL2_SFOUTASRT_MASK (0x1 << CONTROL2_SFOUTASRT_SHIFT)
249#define CONTROL2_SFOUTORD_MASK (0x1 << CONTROL2_SFOUTORD_SHIFT)
250#define CONTROL2_ACCDET_MASK (0x1 << CONTROL2_ACCDET_SHIFT)
251#define CONTROL2_USBCPINT_MASK (0x1 << CONTROL2_USBCPINT_SHIFT)
252#define CONTROL2_RCPS_MASK (0x1 << CONTROL2_RCPS_SHIFT)
253
254#define CONTROL3_JIGSET_SHIFT (0)
255#define CONTROL3_BTLDSET_SHIFT (2)
256#define CONTROL3_ADCDBSET_SHIFT (4)
257#define CONTROL3_JIGSET_MASK (0x3 << CONTROL3_JIGSET_SHIFT)
258#define CONTROL3_BTLDSET_MASK (0x3 << CONTROL3_BTLDSET_SHIFT)
259#define CONTROL3_ADCDBSET_MASK (0x3 << CONTROL3_ADCDBSET_SHIFT)
260
197enum max8997_haptic_reg { 261enum max8997_haptic_reg {
198 MAX8997_HAPTIC_REG_GENERAL = 0x00, 262 MAX8997_HAPTIC_REG_GENERAL = 0x00,
199 MAX8997_HAPTIC_REG_CONF1 = 0x01, 263 MAX8997_HAPTIC_REG_CONF1 = 0x01,
diff --git a/include/linux/mfd/max8997.h b/include/linux/mfd/max8997.h
index 1d4a4fe6ac33..cf815577bd68 100644
--- a/include/linux/mfd/max8997.h
+++ b/include/linux/mfd/max8997.h
@@ -78,21 +78,6 @@ struct max8997_regulator_data {
78 struct device_node *reg_node; 78 struct device_node *reg_node;
79}; 79};
80 80
81enum max8997_muic_usb_type {
82 MAX8997_USB_HOST,
83 MAX8997_USB_DEVICE,
84};
85
86enum max8997_muic_charger_type {
87 MAX8997_CHARGER_TYPE_NONE = 0,
88 MAX8997_CHARGER_TYPE_USB,
89 MAX8997_CHARGER_TYPE_DOWNSTREAM_PORT,
90 MAX8997_CHARGER_TYPE_DEDICATED_CHG,
91 MAX8997_CHARGER_TYPE_500MA,
92 MAX8997_CHARGER_TYPE_1A,
93 MAX8997_CHARGER_TYPE_DEAD_BATTERY = 7,
94};
95
96struct max8997_muic_reg_data { 81struct max8997_muic_reg_data {
97 u8 addr; 82 u8 addr;
98 u8 data; 83 u8 data;
@@ -107,6 +92,16 @@ struct max8997_muic_reg_data {
107struct max8997_muic_platform_data { 92struct max8997_muic_platform_data {
108 struct max8997_muic_reg_data *init_data; 93 struct max8997_muic_reg_data *init_data;
109 int num_init_data; 94 int num_init_data;
95
96 /* Check cable state after certain delay */
97 int detcable_delay_ms;
98
99 /*
100 * Default usb/uart path whether UART/USB or AUX_UART/AUX_USB
101 * h/w path of COMP2/COMN1 on CONTROL1 register.
102 */
103 int path_usb;
104 int path_uart;
110}; 105};
111 106
112enum max8997_haptic_motor_type { 107enum max8997_haptic_motor_type {
diff --git a/include/linux/mfd/rtsx_common.h b/include/linux/mfd/rtsx_common.h
index a8d393e3066b..2b13970596f5 100644
--- a/include/linux/mfd/rtsx_common.h
+++ b/include/linux/mfd/rtsx_common.h
@@ -38,6 +38,9 @@
38#define RTSX_SD_CARD 0 38#define RTSX_SD_CARD 0
39#define RTSX_MS_CARD 1 39#define RTSX_MS_CARD 1
40 40
41#define CLK_TO_DIV_N 0
42#define DIV_N_TO_CLK 1
43
41struct platform_device; 44struct platform_device;
42 45
43struct rtsx_slot { 46struct rtsx_slot {
diff --git a/include/linux/mfd/rtsx_pci.h b/include/linux/mfd/rtsx_pci.h
index 060b721fcbfb..4b117a3f54d4 100644
--- a/include/linux/mfd/rtsx_pci.h
+++ b/include/linux/mfd/rtsx_pci.h
@@ -158,10 +158,9 @@
158#define SG_TRANS_DATA (0x02 << 4) 158#define SG_TRANS_DATA (0x02 << 4)
159#define SG_LINK_DESC (0x03 << 4) 159#define SG_LINK_DESC (0x03 << 4)
160 160
161/* SD bank voltage */ 161/* Output voltage */
162#define SD_IO_3V3 0 162#define OUTPUT_3V3 0
163#define SD_IO_1V8 1 163#define OUTPUT_1V8 1
164
165 164
166/* Card Clock Enable Register */ 165/* Card Clock Enable Register */
167#define SD_CLK_EN 0x04 166#define SD_CLK_EN 0x04
@@ -201,6 +200,20 @@
201#define CHANGE_CLK 0x01 200#define CHANGE_CLK 0x01
202 201
203/* LDO_CTL */ 202/* LDO_CTL */
203#define BPP_ASIC_1V7 0x00
204#define BPP_ASIC_1V8 0x01
205#define BPP_ASIC_1V9 0x02
206#define BPP_ASIC_2V0 0x03
207#define BPP_ASIC_2V7 0x04
208#define BPP_ASIC_2V8 0x05
209#define BPP_ASIC_3V2 0x06
210#define BPP_ASIC_3V3 0x07
211#define BPP_REG_TUNED18 0x07
212#define BPP_TUNED18_SHIFT_8402 5
213#define BPP_TUNED18_SHIFT_8411 4
214#define BPP_PAD_MASK 0x04
215#define BPP_PAD_3V3 0x04
216#define BPP_PAD_1V8 0x00
204#define BPP_LDO_POWB 0x03 217#define BPP_LDO_POWB 0x03
205#define BPP_LDO_ON 0x00 218#define BPP_LDO_ON 0x00
206#define BPP_LDO_SUSPEND 0x02 219#define BPP_LDO_SUSPEND 0x02
@@ -688,7 +701,10 @@ struct pcr_ops {
688 int (*disable_auto_blink)(struct rtsx_pcr *pcr); 701 int (*disable_auto_blink)(struct rtsx_pcr *pcr);
689 int (*card_power_on)(struct rtsx_pcr *pcr, int card); 702 int (*card_power_on)(struct rtsx_pcr *pcr, int card);
690 int (*card_power_off)(struct rtsx_pcr *pcr, int card); 703 int (*card_power_off)(struct rtsx_pcr *pcr, int card);
704 int (*switch_output_voltage)(struct rtsx_pcr *pcr,
705 u8 voltage);
691 unsigned int (*cd_deglitch)(struct rtsx_pcr *pcr); 706 unsigned int (*cd_deglitch)(struct rtsx_pcr *pcr);
707 int (*conv_clk_and_div_n)(int clk, int dir);
692}; 708};
693 709
694enum PDEV_STAT {PDEV_STAT_IDLE, PDEV_STAT_RUN}; 710enum PDEV_STAT {PDEV_STAT_IDLE, PDEV_STAT_RUN};
@@ -783,6 +799,7 @@ int rtsx_pci_switch_clock(struct rtsx_pcr *pcr, unsigned int card_clock,
783 u8 ssc_depth, bool initial_mode, bool double_clk, bool vpclk); 799 u8 ssc_depth, bool initial_mode, bool double_clk, bool vpclk);
784int rtsx_pci_card_power_on(struct rtsx_pcr *pcr, int card); 800int rtsx_pci_card_power_on(struct rtsx_pcr *pcr, int card);
785int rtsx_pci_card_power_off(struct rtsx_pcr *pcr, int card); 801int rtsx_pci_card_power_off(struct rtsx_pcr *pcr, int card);
802int rtsx_pci_switch_output_voltage(struct rtsx_pcr *pcr, u8 voltage);
786unsigned int rtsx_pci_card_exist(struct rtsx_pcr *pcr); 803unsigned int rtsx_pci_card_exist(struct rtsx_pcr *pcr);
787void rtsx_pci_complete_unfinished_transfer(struct rtsx_pcr *pcr); 804void rtsx_pci_complete_unfinished_transfer(struct rtsx_pcr *pcr);
788 805
diff --git a/include/linux/mfd/samsung/core.h b/include/linux/mfd/samsung/core.h
index b50c38f8bc48..f0f4de3b4ccc 100644
--- a/include/linux/mfd/samsung/core.h
+++ b/include/linux/mfd/samsung/core.h
@@ -26,6 +26,7 @@ enum sec_device_type {
26/** 26/**
27 * struct sec_pmic_dev - s5m87xx master device for sub-drivers 27 * struct sec_pmic_dev - s5m87xx master device for sub-drivers
28 * @dev: master device of the chip (can be used to access platform data) 28 * @dev: master device of the chip (can be used to access platform data)
29 * @pdata: pointer to private data used to pass platform data to child
29 * @i2c: i2c client private data for regulator 30 * @i2c: i2c client private data for regulator
30 * @rtc: i2c client private data for rtc 31 * @rtc: i2c client private data for rtc
31 * @iolock: mutex for serializing io access 32 * @iolock: mutex for serializing io access
@@ -39,6 +40,7 @@ enum sec_device_type {
39 */ 40 */
40struct sec_pmic_dev { 41struct sec_pmic_dev {
41 struct device *dev; 42 struct device *dev;
43 struct sec_platform_data *pdata;
42 struct regmap *regmap; 44 struct regmap *regmap;
43 struct i2c_client *i2c; 45 struct i2c_client *i2c;
44 struct i2c_client *rtc; 46 struct i2c_client *rtc;
@@ -82,11 +84,11 @@ struct sec_platform_data {
82 84
83 int buck_gpios[3]; 85 int buck_gpios[3];
84 int buck_ds[3]; 86 int buck_ds[3];
85 int buck2_voltage[8]; 87 unsigned int buck2_voltage[8];
86 bool buck2_gpiodvs; 88 bool buck2_gpiodvs;
87 int buck3_voltage[8]; 89 unsigned int buck3_voltage[8];
88 bool buck3_gpiodvs; 90 bool buck3_gpiodvs;
89 int buck4_voltage[8]; 91 unsigned int buck4_voltage[8];
90 bool buck4_gpiodvs; 92 bool buck4_gpiodvs;
91 93
92 int buck_set1; 94 int buck_set1;
@@ -127,6 +129,7 @@ struct sec_platform_data {
127struct sec_regulator_data { 129struct sec_regulator_data {
128 int id; 130 int id;
129 struct regulator_init_data *initdata; 131 struct regulator_init_data *initdata;
132 struct device_node *reg_node;
130}; 133};
131 134
132/* 135/*
@@ -136,7 +139,7 @@ struct sec_regulator_data {
136 */ 139 */
137struct sec_opmode_data { 140struct sec_opmode_data {
138 int id; 141 int id;
139 int mode; 142 unsigned int mode;
140}; 143};
141 144
142/* 145/*
diff --git a/include/linux/micrel_phy.h b/include/linux/micrel_phy.h
index adfe8c058f29..9dbb41a4e250 100644
--- a/include/linux/micrel_phy.h
+++ b/include/linux/micrel_phy.h
@@ -21,8 +21,15 @@
21#define PHY_ID_KSZ8021 0x00221555 21#define PHY_ID_KSZ8021 0x00221555
22#define PHY_ID_KSZ8041 0x00221510 22#define PHY_ID_KSZ8041 0x00221510
23#define PHY_ID_KSZ8051 0x00221550 23#define PHY_ID_KSZ8051 0x00221550
24/* both for ks8001 Rev. A/B, and for ks8721 Rev 3. */ 24/* same id: ks8001 Rev. A/B, and ks8721 Rev 3. */
25#define PHY_ID_KSZ8001 0x0022161A 25#define PHY_ID_KSZ8001 0x0022161A
26/* same id: KS8081, KS8091 */
27#define PHY_ID_KSZ8081 0x00221560
28#define PHY_ID_KSZ8061 0x00221570
29#define PHY_ID_KSZ9031 0x00221620
30
31#define PHY_ID_KSZ886X 0x00221430
32#define PHY_ID_KSZ8863 0x00221435
26 33
27/* struct phy_device dev_flags definitions */ 34/* struct phy_device dev_flags definitions */
28#define MICREL_PHY_50MHZ_CLK 0x00000001 35#define MICREL_PHY_50MHZ_CLK 0x00000001
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index 20ea939c22a6..6d48fce06b4a 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -150,7 +150,8 @@ enum {
150 MLX4_DEV_CAP_FLAG2_RSS = 1LL << 0, 150 MLX4_DEV_CAP_FLAG2_RSS = 1LL << 0,
151 MLX4_DEV_CAP_FLAG2_RSS_TOP = 1LL << 1, 151 MLX4_DEV_CAP_FLAG2_RSS_TOP = 1LL << 1,
152 MLX4_DEV_CAP_FLAG2_RSS_XOR = 1LL << 2, 152 MLX4_DEV_CAP_FLAG2_RSS_XOR = 1LL << 2,
153 MLX4_DEV_CAP_FLAG2_FS_EN = 1LL << 3 153 MLX4_DEV_CAP_FLAG2_FS_EN = 1LL << 3,
154 MLX4_DEV_CAP_FLAGS2_REASSIGN_MAC_EN = 1LL << 4
154}; 155};
155 156
156enum { 157enum {
@@ -955,9 +956,8 @@ int mlx4_SET_MCAST_FLTR(struct mlx4_dev *dev, u8 port, u64 mac, u64 clear, u8 mo
955 956
956int mlx4_register_mac(struct mlx4_dev *dev, u8 port, u64 mac); 957int mlx4_register_mac(struct mlx4_dev *dev, u8 port, u64 mac);
957void mlx4_unregister_mac(struct mlx4_dev *dev, u8 port, u64 mac); 958void mlx4_unregister_mac(struct mlx4_dev *dev, u8 port, u64 mac);
958int mlx4_replace_mac(struct mlx4_dev *dev, u8 port, int qpn, u64 new_mac); 959int mlx4_get_base_qpn(struct mlx4_dev *dev, u8 port);
959int mlx4_get_eth_qp(struct mlx4_dev *dev, u8 port, u64 mac, int *qpn); 960int __mlx4_replace_mac(struct mlx4_dev *dev, u8 port, int qpn, u64 new_mac);
960void mlx4_put_eth_qp(struct mlx4_dev *dev, u8 port, u64 mac, int qpn);
961void mlx4_set_stats_bitmap(struct mlx4_dev *dev, u64 *stats_bitmap); 961void mlx4_set_stats_bitmap(struct mlx4_dev *dev, u64 *stats_bitmap);
962int mlx4_SET_PORT_general(struct mlx4_dev *dev, u8 port, int mtu, 962int mlx4_SET_PORT_general(struct mlx4_dev *dev, u8 port, int mtu,
963 u8 pptx, u8 pfctx, u8 pprx, u8 pfcrx); 963 u8 pptx, u8 pfctx, u8 pprx, u8 pfcrx);
diff --git a/include/linux/mmu_notifier.h b/include/linux/mmu_notifier.h
index bc823c4c028b..deca87452528 100644
--- a/include/linux/mmu_notifier.h
+++ b/include/linux/mmu_notifier.h
@@ -151,7 +151,7 @@ struct mmu_notifier_ops {
151 * Therefore notifier chains can only be traversed when either 151 * Therefore notifier chains can only be traversed when either
152 * 152 *
153 * 1. mmap_sem is held. 153 * 1. mmap_sem is held.
154 * 2. One of the reverse map locks is held (i_mmap_mutex or anon_vma->mutex). 154 * 2. One of the reverse map locks is held (i_mmap_mutex or anon_vma->rwsem).
155 * 3. No other concurrent thread can access the list (release) 155 * 3. No other concurrent thread can access the list (release)
156 */ 156 */
157struct mmu_notifier { 157struct mmu_notifier {
diff --git a/include/linux/mroute.h b/include/linux/mroute.h
index ea00d9162ee5..79aaa9fc1a15 100644
--- a/include/linux/mroute.h
+++ b/include/linux/mroute.h
@@ -9,7 +9,7 @@
9#ifdef CONFIG_IP_MROUTE 9#ifdef CONFIG_IP_MROUTE
10static inline int ip_mroute_opt(int opt) 10static inline int ip_mroute_opt(int opt)
11{ 11{
12 return (opt >= MRT_BASE) && (opt <= MRT_BASE + 10); 12 return (opt >= MRT_BASE) && (opt <= MRT_MAX);
13} 13}
14#else 14#else
15static inline int ip_mroute_opt(int opt) 15static inline int ip_mroute_opt(int opt)
diff --git a/include/linux/mroute6.h b/include/linux/mroute6.h
index a223561ba12e..66982e764051 100644
--- a/include/linux/mroute6.h
+++ b/include/linux/mroute6.h
@@ -10,7 +10,7 @@
10#ifdef CONFIG_IPV6_MROUTE 10#ifdef CONFIG_IPV6_MROUTE
11static inline int ip6_mroute_opt(int opt) 11static inline int ip6_mroute_opt(int opt)
12{ 12{
13 return (opt >= MRT6_BASE) && (opt <= MRT6_BASE + 10); 13 return (opt >= MRT6_BASE) && (opt <= MRT6_MAX);
14} 14}
15#else 15#else
16static inline int ip6_mroute_opt(int opt) 16static inline int ip6_mroute_opt(int opt)
diff --git a/include/linux/netdev_features.h b/include/linux/netdev_features.h
index 5ac32123035a..3dd39340430e 100644
--- a/include/linux/netdev_features.h
+++ b/include/linux/netdev_features.h
@@ -41,7 +41,7 @@ enum {
41 NETIF_F_TSO_ECN_BIT, /* ... TCP ECN support */ 41 NETIF_F_TSO_ECN_BIT, /* ... TCP ECN support */
42 NETIF_F_TSO6_BIT, /* ... TCPv6 segmentation */ 42 NETIF_F_TSO6_BIT, /* ... TCPv6 segmentation */
43 NETIF_F_FSO_BIT, /* ... FCoE segmentation */ 43 NETIF_F_FSO_BIT, /* ... FCoE segmentation */
44 NETIF_F_GSO_RESERVED1, /* ... free (fill GSO_MASK to 8 bits) */ 44 NETIF_F_GSO_GRE_BIT, /* ... GRE with TSO */
45 /**/NETIF_F_GSO_LAST, /* [can't be last bit, see GSO_MASK] */ 45 /**/NETIF_F_GSO_LAST, /* [can't be last bit, see GSO_MASK] */
46 NETIF_F_GSO_RESERVED2 /* ... free (fill GSO_MASK to 8 bits) */ 46 NETIF_F_GSO_RESERVED2 /* ... free (fill GSO_MASK to 8 bits) */
47 = NETIF_F_GSO_LAST, 47 = NETIF_F_GSO_LAST,
@@ -102,6 +102,7 @@ enum {
102#define NETIF_F_VLAN_CHALLENGED __NETIF_F(VLAN_CHALLENGED) 102#define NETIF_F_VLAN_CHALLENGED __NETIF_F(VLAN_CHALLENGED)
103#define NETIF_F_RXFCS __NETIF_F(RXFCS) 103#define NETIF_F_RXFCS __NETIF_F(RXFCS)
104#define NETIF_F_RXALL __NETIF_F(RXALL) 104#define NETIF_F_RXALL __NETIF_F(RXALL)
105#define NETIF_F_GRE_GSO __NETIF_F(GSO_GRE)
105 106
106/* Features valid for ethtool to change */ 107/* Features valid for ethtool to change */
107/* = all defined minus driver/device-class-related */ 108/* = all defined minus driver/device-class-related */
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 9ef07d0868b6..b3d00fa4b314 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -67,6 +67,8 @@ extern void netdev_set_default_ethtool_ops(struct net_device *dev,
67#define NET_ADDR_PERM 0 /* address is permanent (default) */ 67#define NET_ADDR_PERM 0 /* address is permanent (default) */
68#define NET_ADDR_RANDOM 1 /* address is generated randomly */ 68#define NET_ADDR_RANDOM 1 /* address is generated randomly */
69#define NET_ADDR_STOLEN 2 /* address is stolen from other device */ 69#define NET_ADDR_STOLEN 2 /* address is stolen from other device */
70#define NET_ADDR_SET 3 /* address is set using
71 * dev_set_mac_address() */
70 72
71/* Backlog congestion levels */ 73/* Backlog congestion levels */
72#define NET_RX_SUCCESS 0 /* keep 'em coming, baby */ 74#define NET_RX_SUCCESS 0 /* keep 'em coming, baby */
@@ -859,8 +861,7 @@ struct netdev_fcoe_hbainfo {
859 * flow_id is a flow ID to be passed to rps_may_expire_flow() later. 861 * flow_id is a flow ID to be passed to rps_may_expire_flow() later.
860 * Return the filter ID on success, or a negative error code. 862 * Return the filter ID on success, or a negative error code.
861 * 863 *
862 * Slave management functions (for bridge, bonding, etc). User should 864 * Slave management functions (for bridge, bonding, etc).
863 * call netdev_set_master() to set dev->master properly.
864 * int (*ndo_add_slave)(struct net_device *dev, struct net_device *slave_dev); 865 * int (*ndo_add_slave)(struct net_device *dev, struct net_device *slave_dev);
865 * Called to make another netdev an underling. 866 * Called to make another netdev an underling.
866 * 867 *
@@ -883,7 +884,8 @@ struct netdev_fcoe_hbainfo {
883 * struct net_device *dev, 884 * struct net_device *dev,
884 * const unsigned char *addr, u16 flags) 885 * const unsigned char *addr, u16 flags)
885 * Adds an FDB entry to dev for addr. 886 * Adds an FDB entry to dev for addr.
886 * int (*ndo_fdb_del)(struct ndmsg *ndm, struct net_device *dev, 887 * int (*ndo_fdb_del)(struct ndmsg *ndm, struct nlattr *tb[],
888 * struct net_device *dev,
887 * const unsigned char *addr) 889 * const unsigned char *addr)
888 * Deletes the FDB entry from dev coresponding to addr. 890 * Deletes the FDB entry from dev coresponding to addr.
889 * int (*ndo_fdb_dump)(struct sk_buff *skb, struct netlink_callback *cb, 891 * int (*ndo_fdb_dump)(struct sk_buff *skb, struct netlink_callback *cb,
@@ -894,6 +896,14 @@ struct netdev_fcoe_hbainfo {
894 * int (*ndo_bridge_setlink)(struct net_device *dev, struct nlmsghdr *nlh) 896 * int (*ndo_bridge_setlink)(struct net_device *dev, struct nlmsghdr *nlh)
895 * int (*ndo_bridge_getlink)(struct sk_buff *skb, u32 pid, u32 seq, 897 * int (*ndo_bridge_getlink)(struct sk_buff *skb, u32 pid, u32 seq,
896 * struct net_device *dev) 898 * struct net_device *dev)
899 *
900 * int (*ndo_change_carrier)(struct net_device *dev, bool new_carrier);
901 * Called to change device carrier. Soft-devices (like dummy, team, etc)
902 * which do not represent real hardware may define this to allow their
903 * userspace components to manage their virtual carrier state. Devices
904 * that determine carrier state from physical hardware properties (eg
905 * network cables) or protocol-dependent mechanisms (eg
906 * USB_CDC_NOTIFY_NETWORK_CONNECTION) should NOT implement this function.
897 */ 907 */
898struct net_device_ops { 908struct net_device_ops {
899 int (*ndo_init)(struct net_device *dev); 909 int (*ndo_init)(struct net_device *dev);
@@ -999,6 +1009,7 @@ struct net_device_ops {
999 const unsigned char *addr, 1009 const unsigned char *addr,
1000 u16 flags); 1010 u16 flags);
1001 int (*ndo_fdb_del)(struct ndmsg *ndm, 1011 int (*ndo_fdb_del)(struct ndmsg *ndm,
1012 struct nlattr *tb[],
1002 struct net_device *dev, 1013 struct net_device *dev,
1003 const unsigned char *addr); 1014 const unsigned char *addr);
1004 int (*ndo_fdb_dump)(struct sk_buff *skb, 1015 int (*ndo_fdb_dump)(struct sk_buff *skb,
@@ -1010,7 +1021,12 @@ struct net_device_ops {
1010 struct nlmsghdr *nlh); 1021 struct nlmsghdr *nlh);
1011 int (*ndo_bridge_getlink)(struct sk_buff *skb, 1022 int (*ndo_bridge_getlink)(struct sk_buff *skb,
1012 u32 pid, u32 seq, 1023 u32 pid, u32 seq,
1013 struct net_device *dev); 1024 struct net_device *dev,
1025 u32 filter_mask);
1026 int (*ndo_bridge_dellink)(struct net_device *dev,
1027 struct nlmsghdr *nlh);
1028 int (*ndo_change_carrier)(struct net_device *dev,
1029 bool new_carrier);
1014}; 1030};
1015 1031
1016/* 1032/*
@@ -1161,9 +1177,7 @@ struct net_device {
1161 * avoid dirtying this cache line. 1177 * avoid dirtying this cache line.
1162 */ 1178 */
1163 1179
1164 struct net_device *master; /* Pointer to master device of a group, 1180 struct list_head upper_dev_list; /* List of upper devices */
1165 * which this device is member of.
1166 */
1167 1181
1168 /* Interface address info used in eth_type_trans() */ 1182 /* Interface address info used in eth_type_trans() */
1169 unsigned char *dev_addr; /* hw address, (before bcast 1183 unsigned char *dev_addr; /* hw address, (before bcast
@@ -1263,7 +1277,7 @@ struct net_device {
1263 void (*destructor)(struct net_device *dev); 1277 void (*destructor)(struct net_device *dev);
1264 1278
1265#ifdef CONFIG_NETPOLL 1279#ifdef CONFIG_NETPOLL
1266 struct netpoll_info *npinfo; 1280 struct netpoll_info __rcu *npinfo;
1267#endif 1281#endif
1268 1282
1269#ifdef CONFIG_NET_NS 1283#ifdef CONFIG_NET_NS
@@ -1277,9 +1291,12 @@ struct net_device {
1277 struct pcpu_lstats __percpu *lstats; /* loopback stats */ 1291 struct pcpu_lstats __percpu *lstats; /* loopback stats */
1278 struct pcpu_tstats __percpu *tstats; /* tunnel stats */ 1292 struct pcpu_tstats __percpu *tstats; /* tunnel stats */
1279 struct pcpu_dstats __percpu *dstats; /* dummy stats */ 1293 struct pcpu_dstats __percpu *dstats; /* dummy stats */
1294 struct pcpu_vstats __percpu *vstats; /* veth stats */
1280 }; 1295 };
1281 /* GARP */ 1296 /* GARP */
1282 struct garp_port __rcu *garp_port; 1297 struct garp_port __rcu *garp_port;
1298 /* MRP */
1299 struct mrp_port __rcu *mrp_port;
1283 1300
1284 /* class/net/name entry */ 1301 /* class/net/name entry */
1285 struct device dev; 1302 struct device dev;
@@ -1396,6 +1413,7 @@ static inline void netdev_for_each_tx_queue(struct net_device *dev,
1396 1413
1397extern struct netdev_queue *netdev_pick_tx(struct net_device *dev, 1414extern struct netdev_queue *netdev_pick_tx(struct net_device *dev,
1398 struct sk_buff *skb); 1415 struct sk_buff *skb);
1416extern u16 __netdev_pick_tx(struct net_device *dev, struct sk_buff *skb);
1399 1417
1400/* 1418/*
1401 * Net namespace inlines 1419 * Net namespace inlines
@@ -2095,6 +2113,18 @@ static inline void netif_wake_subqueue(struct net_device *dev, u16 queue_index)
2095 __netif_schedule(txq->qdisc); 2113 __netif_schedule(txq->qdisc);
2096} 2114}
2097 2115
2116#ifdef CONFIG_XPS
2117extern int netif_set_xps_queue(struct net_device *dev, struct cpumask *mask,
2118 u16 index);
2119#else
2120static inline int netif_set_xps_queue(struct net_device *dev,
2121 struct cpumask *mask,
2122 u16 index)
2123{
2124 return 0;
2125}
2126#endif
2127
2098/* 2128/*
2099 * Returns a Tx hash for the given packet when dev->real_num_tx_queues is used 2129 * Returns a Tx hash for the given packet when dev->real_num_tx_queues is used
2100 * as a distribution range limit for the returned value. 2130 * as a distribution range limit for the returned value.
@@ -2197,6 +2227,8 @@ extern int dev_set_mtu(struct net_device *, int);
2197extern void dev_set_group(struct net_device *, int); 2227extern void dev_set_group(struct net_device *, int);
2198extern int dev_set_mac_address(struct net_device *, 2228extern int dev_set_mac_address(struct net_device *,
2199 struct sockaddr *); 2229 struct sockaddr *);
2230extern int dev_change_carrier(struct net_device *,
2231 bool new_carrier);
2200extern int dev_hard_start_xmit(struct sk_buff *skb, 2232extern int dev_hard_start_xmit(struct sk_buff *skb,
2201 struct net_device *dev, 2233 struct net_device *dev,
2202 struct netdev_queue *txq); 2234 struct netdev_queue *txq);
@@ -2614,7 +2646,6 @@ extern void netdev_notify_peers(struct net_device *dev);
2614extern void netdev_features_change(struct net_device *dev); 2646extern void netdev_features_change(struct net_device *dev);
2615/* Load a device via the kmod */ 2647/* Load a device via the kmod */
2616extern void dev_load(struct net *net, const char *name); 2648extern void dev_load(struct net *net, const char *name);
2617extern void dev_mcast_init(void);
2618extern struct rtnl_link_stats64 *dev_get_stats(struct net_device *dev, 2649extern struct rtnl_link_stats64 *dev_get_stats(struct net_device *dev,
2619 struct rtnl_link_stats64 *storage); 2650 struct rtnl_link_stats64 *storage);
2620extern void netdev_stats_to_stats64(struct rtnl_link_stats64 *stats64, 2651extern void netdev_stats_to_stats64(struct rtnl_link_stats64 *stats64,
@@ -2624,12 +2655,30 @@ extern int netdev_max_backlog;
2624extern int netdev_tstamp_prequeue; 2655extern int netdev_tstamp_prequeue;
2625extern int weight_p; 2656extern int weight_p;
2626extern int bpf_jit_enable; 2657extern int bpf_jit_enable;
2627extern int netdev_set_master(struct net_device *dev, struct net_device *master); 2658
2628extern int netdev_set_bond_master(struct net_device *dev, 2659extern bool netdev_has_upper_dev(struct net_device *dev,
2629 struct net_device *master); 2660 struct net_device *upper_dev);
2661extern bool netdev_has_any_upper_dev(struct net_device *dev);
2662extern struct net_device *netdev_master_upper_dev_get(struct net_device *dev);
2663extern struct net_device *netdev_master_upper_dev_get_rcu(struct net_device *dev);
2664extern int netdev_upper_dev_link(struct net_device *dev,
2665 struct net_device *upper_dev);
2666extern int netdev_master_upper_dev_link(struct net_device *dev,
2667 struct net_device *upper_dev);
2668extern void netdev_upper_dev_unlink(struct net_device *dev,
2669 struct net_device *upper_dev);
2630extern int skb_checksum_help(struct sk_buff *skb); 2670extern int skb_checksum_help(struct sk_buff *skb);
2631extern struct sk_buff *skb_gso_segment(struct sk_buff *skb, 2671extern struct sk_buff *__skb_gso_segment(struct sk_buff *skb,
2632 netdev_features_t features); 2672 netdev_features_t features, bool tx_path);
2673extern struct sk_buff *skb_mac_gso_segment(struct sk_buff *skb,
2674 netdev_features_t features);
2675
2676static inline
2677struct sk_buff *skb_gso_segment(struct sk_buff *skb, netdev_features_t features)
2678{
2679 return __skb_gso_segment(skb, features, true);
2680}
2681
2633#ifdef CONFIG_BUG 2682#ifdef CONFIG_BUG
2634extern void netdev_rx_csum_fault(struct net_device *dev); 2683extern void netdev_rx_csum_fault(struct net_device *dev);
2635#else 2684#else
@@ -2642,9 +2691,9 @@ extern void net_enable_timestamp(void);
2642extern void net_disable_timestamp(void); 2691extern void net_disable_timestamp(void);
2643 2692
2644#ifdef CONFIG_PROC_FS 2693#ifdef CONFIG_PROC_FS
2645extern void *dev_seq_start(struct seq_file *seq, loff_t *pos); 2694extern int __init dev_proc_init(void);
2646extern void *dev_seq_next(struct seq_file *seq, void *v, loff_t *pos); 2695#else
2647extern void dev_seq_stop(struct seq_file *seq, void *v); 2696#define dev_proc_init() 0
2648#endif 2697#endif
2649 2698
2650extern int netdev_class_create_file(struct class_attribute *class_attr); 2699extern int netdev_class_create_file(struct class_attribute *class_attr);
@@ -2846,4 +2895,34 @@ do { \
2846}) 2895})
2847#endif 2896#endif
2848 2897
2898/*
2899 * The list of packet types we will receive (as opposed to discard)
2900 * and the routines to invoke.
2901 *
2902 * Why 16. Because with 16 the only overlap we get on a hash of the
2903 * low nibble of the protocol value is RARP/SNAP/X.25.
2904 *
2905 * NOTE: That is no longer true with the addition of VLAN tags. Not
2906 * sure which should go first, but I bet it won't make much
2907 * difference if we are running VLANs. The good news is that
2908 * this protocol won't be in the list unless compiled in, so
2909 * the average user (w/out VLANs) will not be adversely affected.
2910 * --BLG
2911 *
2912 * 0800 IP
2913 * 8100 802.1Q VLAN
2914 * 0001 802.3
2915 * 0002 AX.25
2916 * 0004 802.2
2917 * 8035 RARP
2918 * 0005 SNAP
2919 * 0805 X.25
2920 * 0806 ARP
2921 * 8137 IPX
2922 * 0009 Localtalk
2923 * 86DD IPv6
2924 */
2925#define PTYPE_HASH_SIZE (16)
2926#define PTYPE_HASH_MASK (PTYPE_HASH_SIZE - 1)
2927
2849#endif /* _LINUX_NETDEVICE_H */ 2928#endif /* _LINUX_NETDEVICE_H */
diff --git a/include/linux/netfilter/nf_conntrack_sip.h b/include/linux/netfilter/nf_conntrack_sip.h
index 387bdd02945d..ba7f571a2b1c 100644
--- a/include/linux/netfilter/nf_conntrack_sip.h
+++ b/include/linux/netfilter/nf_conntrack_sip.h
@@ -4,12 +4,15 @@
4 4
5#include <net/netfilter/nf_conntrack_expect.h> 5#include <net/netfilter/nf_conntrack_expect.h>
6 6
7#include <linux/types.h>
8
7#define SIP_PORT 5060 9#define SIP_PORT 5060
8#define SIP_TIMEOUT 3600 10#define SIP_TIMEOUT 3600
9 11
10struct nf_ct_sip_master { 12struct nf_ct_sip_master {
11 unsigned int register_cseq; 13 unsigned int register_cseq;
12 unsigned int invite_cseq; 14 unsigned int invite_cseq;
15 __be16 forced_dport;
13}; 16};
14 17
15enum sip_expectation_classes { 18enum sip_expectation_classes {
diff --git a/include/linux/netfilter/nfnetlink.h b/include/linux/netfilter/nfnetlink.h
index 4966ddec039b..ecbb8e495912 100644
--- a/include/linux/netfilter/nfnetlink.h
+++ b/include/linux/netfilter/nfnetlink.h
@@ -34,8 +34,8 @@ extern int nfnetlink_send(struct sk_buff *skb, struct net *net, u32 pid, unsigne
34extern int nfnetlink_set_err(struct net *net, u32 pid, u32 group, int error); 34extern int nfnetlink_set_err(struct net *net, u32 pid, u32 group, int error);
35extern int nfnetlink_unicast(struct sk_buff *skb, struct net *net, u_int32_t pid, int flags); 35extern int nfnetlink_unicast(struct sk_buff *skb, struct net *net, u_int32_t pid, int flags);
36 36
37extern void nfnl_lock(void); 37extern void nfnl_lock(__u8 subsys_id);
38extern void nfnl_unlock(void); 38extern void nfnl_unlock(__u8 subsys_id);
39 39
40#define MODULE_ALIAS_NFNL_SUBSYS(subsys) \ 40#define MODULE_ALIAS_NFNL_SUBSYS(subsys) \
41 MODULE_ALIAS("nfnetlink-subsys-" __stringify(subsys)) 41 MODULE_ALIAS("nfnetlink-subsys-" __stringify(subsys))
diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h
index 66d5379c305e..9d7d8c64f7c8 100644
--- a/include/linux/netpoll.h
+++ b/include/linux/netpoll.h
@@ -12,28 +12,38 @@
12#include <linux/rcupdate.h> 12#include <linux/rcupdate.h>
13#include <linux/list.h> 13#include <linux/list.h>
14 14
15union inet_addr {
16 __u32 all[4];
17 __be32 ip;
18 __be32 ip6[4];
19 struct in_addr in;
20 struct in6_addr in6;
21};
22
15struct netpoll { 23struct netpoll {
16 struct net_device *dev; 24 struct net_device *dev;
17 char dev_name[IFNAMSIZ]; 25 char dev_name[IFNAMSIZ];
18 const char *name; 26 const char *name;
19 void (*rx_hook)(struct netpoll *, int, char *, int); 27 void (*rx_hook)(struct netpoll *, int, char *, int);
20 28
21 __be32 local_ip, remote_ip; 29 union inet_addr local_ip, remote_ip;
30 bool ipv6;
22 u16 local_port, remote_port; 31 u16 local_port, remote_port;
23 u8 remote_mac[ETH_ALEN]; 32 u8 remote_mac[ETH_ALEN];
24 33
25 struct list_head rx; /* rx_np list element */ 34 struct list_head rx; /* rx_np list element */
26 struct rcu_head rcu; 35 struct work_struct cleanup_work;
27}; 36};
28 37
29struct netpoll_info { 38struct netpoll_info {
30 atomic_t refcnt; 39 atomic_t refcnt;
31 40
32 int rx_flags; 41 unsigned long rx_flags;
33 spinlock_t rx_lock; 42 spinlock_t rx_lock;
43 struct mutex dev_lock;
34 struct list_head rx_np; /* netpolls that registered an rx_hook */ 44 struct list_head rx_np; /* netpolls that registered an rx_hook */
35 45
36 struct sk_buff_head arp_tx; /* list of arp requests to reply to */ 46 struct sk_buff_head neigh_tx; /* list of neigh requests to reply to */
37 struct sk_buff_head txq; 47 struct sk_buff_head txq;
38 48
39 struct delayed_work tx_work; 49 struct delayed_work tx_work;
@@ -42,6 +52,14 @@ struct netpoll_info {
42 struct rcu_head rcu; 52 struct rcu_head rcu;
43}; 53};
44 54
55#ifdef CONFIG_NETPOLL
56extern int netpoll_rx_disable(struct net_device *dev);
57extern void netpoll_rx_enable(struct net_device *dev);
58#else
59static inline int netpoll_rx_disable(struct net_device *dev) { return 0; }
60static inline void netpoll_rx_enable(struct net_device *dev) { return; }
61#endif
62
45void netpoll_send_udp(struct netpoll *np, const char *msg, int len); 63void netpoll_send_udp(struct netpoll *np, const char *msg, int len);
46void netpoll_print_options(struct netpoll *np); 64void netpoll_print_options(struct netpoll *np);
47int netpoll_parse_options(struct netpoll *np, char *opt); 65int netpoll_parse_options(struct netpoll *np, char *opt);
@@ -50,7 +68,7 @@ int netpoll_setup(struct netpoll *np);
50int netpoll_trap(void); 68int netpoll_trap(void);
51void netpoll_set_trap(int trap); 69void netpoll_set_trap(int trap);
52void __netpoll_cleanup(struct netpoll *np); 70void __netpoll_cleanup(struct netpoll *np);
53void __netpoll_free_rcu(struct netpoll *np); 71void __netpoll_free_async(struct netpoll *np);
54void netpoll_cleanup(struct netpoll *np); 72void netpoll_cleanup(struct netpoll *np);
55int __netpoll_rx(struct sk_buff *skb, struct netpoll_info *npinfo); 73int __netpoll_rx(struct sk_buff *skb, struct netpoll_info *npinfo);
56void netpoll_send_skb_on_dev(struct netpoll *np, struct sk_buff *skb, 74void netpoll_send_skb_on_dev(struct netpoll *np, struct sk_buff *skb,
diff --git a/include/linux/ntb.h b/include/linux/ntb.h
new file mode 100644
index 000000000000..f6a15205853b
--- /dev/null
+++ b/include/linux/ntb.h
@@ -0,0 +1,83 @@
1/*
2 * This file is provided under a dual BSD/GPLv2 license. When using or
3 * redistributing this file, you may do so under either license.
4 *
5 * GPL LICENSE SUMMARY
6 *
7 * Copyright(c) 2012 Intel Corporation. All rights reserved.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of version 2 of the GNU General Public License as
11 * published by the Free Software Foundation.
12 *
13 * BSD LICENSE
14 *
15 * Copyright(c) 2012 Intel Corporation. All rights reserved.
16 *
17 * Redistribution and use in source and binary forms, with or without
18 * modification, are permitted provided that the following conditions
19 * are met:
20 *
21 * * Redistributions of source code must retain the above copyright
22 * notice, this list of conditions and the following disclaimer.
23 * * Redistributions in binary form must reproduce the above copy
24 * notice, this list of conditions and the following disclaimer in
25 * the documentation and/or other materials provided with the
26 * distribution.
27 * * Neither the name of Intel Corporation nor the names of its
28 * contributors may be used to endorse or promote products derived
29 * from this software without specific prior written permission.
30 *
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
36 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
37 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
38 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
39 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
40 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
41 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
42 *
43 * Intel PCIe NTB Linux driver
44 *
45 * Contact Information:
46 * Jon Mason <jon.mason@intel.com>
47 */
48
49struct ntb_transport_qp;
50
51struct ntb_client {
52 struct device_driver driver;
53 int (*probe) (struct pci_dev *pdev);
54 void (*remove) (struct pci_dev *pdev);
55};
56
57int ntb_register_client(struct ntb_client *drvr);
58void ntb_unregister_client(struct ntb_client *drvr);
59int ntb_register_client_dev(char *device_name);
60void ntb_unregister_client_dev(char *device_name);
61
62struct ntb_queue_handlers {
63 void (*rx_handler) (struct ntb_transport_qp *qp, void *qp_data,
64 void *data, int len);
65 void (*tx_handler) (struct ntb_transport_qp *qp, void *qp_data,
66 void *data, int len);
67 void (*event_handler) (void *data, int status);
68};
69
70unsigned char ntb_transport_qp_num(struct ntb_transport_qp *qp);
71unsigned int ntb_transport_max_size(struct ntb_transport_qp *qp);
72struct ntb_transport_qp *
73ntb_transport_create_queue(void *data, struct pci_dev *pdev,
74 const struct ntb_queue_handlers *handlers);
75void ntb_transport_free_queue(struct ntb_transport_qp *qp);
76int ntb_transport_rx_enqueue(struct ntb_transport_qp *qp, void *cb, void *data,
77 unsigned int len);
78int ntb_transport_tx_enqueue(struct ntb_transport_qp *qp, void *cb, void *data,
79 unsigned int len);
80void *ntb_transport_rx_remove(struct ntb_transport_qp *qp, unsigned int *len);
81void ntb_transport_link_up(struct ntb_transport_qp *qp);
82void ntb_transport_link_down(struct ntb_transport_qp *qp);
83bool ntb_transport_link_query(struct ntb_transport_qp *qp);
diff --git a/include/linux/of.h b/include/linux/of.h
index 5ebcc5c8e423..a0f129284948 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -92,7 +92,7 @@ static inline void of_node_put(struct device_node *node) { }
92extern struct device_node *of_allnodes; 92extern struct device_node *of_allnodes;
93extern struct device_node *of_chosen; 93extern struct device_node *of_chosen;
94extern struct device_node *of_aliases; 94extern struct device_node *of_aliases;
95extern rwlock_t devtree_lock; 95extern raw_spinlock_t devtree_lock;
96 96
97static inline bool of_have_populated_dt(void) 97static inline bool of_have_populated_dt(void)
98{ 98{
@@ -160,7 +160,7 @@ static inline unsigned long of_read_ulong(const __be32 *cell, int size)
160 160
161#define OF_BAD_ADDR ((u64)-1) 161#define OF_BAD_ADDR ((u64)-1)
162 162
163static inline const char* of_node_full_name(struct device_node *np) 163static inline const char *of_node_full_name(const struct device_node *np)
164{ 164{
165 return np ? np->full_name : "<no-node>"; 165 return np ? np->full_name : "<no-node>";
166} 166}
@@ -277,6 +277,8 @@ extern struct device_node *of_parse_phandle(const struct device_node *np,
277extern int of_parse_phandle_with_args(const struct device_node *np, 277extern int of_parse_phandle_with_args(const struct device_node *np,
278 const char *list_name, const char *cells_name, int index, 278 const char *list_name, const char *cells_name, int index,
279 struct of_phandle_args *out_args); 279 struct of_phandle_args *out_args);
280extern int of_count_phandle_with_args(const struct device_node *np,
281 const char *list_name, const char *cells_name);
280 282
281extern void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align)); 283extern void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align));
282extern int of_alias_get_id(struct device_node *np, const char *stem); 284extern int of_alias_get_id(struct device_node *np, const char *stem);
@@ -467,6 +469,13 @@ static inline int of_parse_phandle_with_args(struct device_node *np,
467 return -ENOSYS; 469 return -ENOSYS;
468} 470}
469 471
472static inline int of_count_phandle_with_args(struct device_node *np,
473 const char *list_name,
474 const char *cells_name)
475{
476 return -ENOSYS;
477}
478
470static inline int of_alias_get_id(struct device_node *np, const char *stem) 479static inline int of_alias_get_id(struct device_node *np, const char *stem)
471{ 480{
472 return -ENOSYS; 481 return -ENOSYS;
diff --git a/include/linux/of_gpio.h b/include/linux/of_gpio.h
index c454f5796747..a83dc6f5008e 100644
--- a/include/linux/of_gpio.h
+++ b/include/linux/of_gpio.h
@@ -50,9 +50,6 @@ static inline struct of_mm_gpio_chip *to_of_mm_gpio_chip(struct gpio_chip *gc)
50extern int of_get_named_gpio_flags(struct device_node *np, 50extern int of_get_named_gpio_flags(struct device_node *np,
51 const char *list_name, int index, enum of_gpio_flags *flags); 51 const char *list_name, int index, enum of_gpio_flags *flags);
52 52
53extern unsigned int of_gpio_named_count(struct device_node *np,
54 const char* propname);
55
56extern int of_mm_gpiochip_add(struct device_node *np, 53extern int of_mm_gpiochip_add(struct device_node *np,
57 struct of_mm_gpio_chip *mm_gc); 54 struct of_mm_gpio_chip *mm_gc);
58 55
@@ -71,12 +68,6 @@ static inline int of_get_named_gpio_flags(struct device_node *np,
71 return -ENOSYS; 68 return -ENOSYS;
72} 69}
73 70
74static inline unsigned int of_gpio_named_count(struct device_node *np,
75 const char* propname)
76{
77 return 0;
78}
79
80static inline int of_gpio_simple_xlate(struct gpio_chip *gc, 71static inline int of_gpio_simple_xlate(struct gpio_chip *gc,
81 const struct of_phandle_args *gpiospec, 72 const struct of_phandle_args *gpiospec,
82 u32 *flags) 73 u32 *flags)
@@ -90,22 +81,37 @@ static inline void of_gpiochip_remove(struct gpio_chip *gc) { }
90#endif /* CONFIG_OF_GPIO */ 81#endif /* CONFIG_OF_GPIO */
91 82
92/** 83/**
93 * of_gpio_count - Count GPIOs for a device 84 * of_gpio_named_count() - Count GPIOs for a device
94 * @np: device node to count GPIOs for 85 * @np: device node to count GPIOs for
86 * @propname: property name containing gpio specifier(s)
95 * 87 *
96 * The function returns the count of GPIOs specified for a node. 88 * The function returns the count of GPIOs specified for a node.
89 * Note that the empty GPIO specifiers count too. Returns either
90 * Number of gpios defined in property,
91 * -EINVAL for an incorrectly formed gpios property, or
92 * -ENOENT for a missing gpios property
97 * 93 *
98 * Note that the empty GPIO specifiers counts too. For example, 94 * Example:
99 *
100 * gpios = <0 95 * gpios = <0
101 * &pio1 1 2 96 * &gpio1 1 2
102 * 0 97 * 0
103 * &pio2 3 4>; 98 * &gpio2 3 4>;
99 *
100 * The above example defines four GPIOs, two of which are not specified.
101 * This function will return '4'
102 */
103static inline int of_gpio_named_count(struct device_node *np, const char* propname)
104{
105 return of_count_phandle_with_args(np, propname, "#gpio-cells");
106}
107
108/**
109 * of_gpio_count() - Count GPIOs for a device
110 * @np: device node to count GPIOs for
104 * 111 *
105 * defines four GPIOs (so this function will return 4), two of which 112 * Same as of_gpio_named_count, but hard coded to use the 'gpios' property
106 * are not specified.
107 */ 113 */
108static inline unsigned int of_gpio_count(struct device_node *np) 114static inline int of_gpio_count(struct device_node *np)
109{ 115{
110 return of_gpio_named_count(np, "gpios"); 116 return of_gpio_named_count(np, "gpios");
111} 117}
diff --git a/include/linux/of_serial.h b/include/linux/of_serial.h
deleted file mode 100644
index 4a73ed80b4c0..000000000000
--- a/include/linux/of_serial.h
+++ /dev/null
@@ -1,17 +0,0 @@
1#ifndef __LINUX_OF_SERIAL_H
2#define __LINUX_OF_SERIAL_H
3
4/*
5 * FIXME remove this file when tegra finishes conversion to open firmware,
6 * expectation is that all quirks will then be self-contained in
7 * drivers/tty/serial/of_serial.c.
8 */
9#ifdef CONFIG_ARCH_TEGRA
10extern void tegra_serial_handle_break(struct uart_port *port);
11#else
12static inline void tegra_serial_handle_break(struct uart_port *port)
13{
14}
15#endif
16
17#endif /* __LINUX_OF_SERIAL */
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 70473da47b3f..6d53675c2b54 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -303,21 +303,13 @@ static inline void __SetPageUptodate(struct page *page)
303 303
304static inline void SetPageUptodate(struct page *page) 304static inline void SetPageUptodate(struct page *page)
305{ 305{
306#ifdef CONFIG_S390
307 if (!test_and_set_bit(PG_uptodate, &page->flags))
308 page_set_storage_key(page_to_phys(page), PAGE_DEFAULT_KEY, 0);
309#else
310 /* 306 /*
311 * Memory barrier must be issued before setting the PG_uptodate bit, 307 * Memory barrier must be issued before setting the PG_uptodate bit,
312 * so that all previous stores issued in order to bring the page 308 * so that all previous stores issued in order to bring the page
313 * uptodate are actually visible before PageUptodate becomes true. 309 * uptodate are actually visible before PageUptodate becomes true.
314 *
315 * s390 doesn't need an explicit smp_wmb here because the test and
316 * set bit already provides full barriers.
317 */ 310 */
318 smp_wmb(); 311 smp_wmb();
319 set_bit(PG_uptodate, &(page)->flags); 312 set_bit(PG_uptodate, &(page)->flags);
320#endif
321} 313}
322 314
323CLEARPAGEFLAG(Uptodate, uptodate) 315CLEARPAGEFLAG(Uptodate, uptodate)
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index 6da609d14c15..0e38e13eb249 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -414,6 +414,7 @@ static inline void wait_on_page_writeback(struct page *page)
414} 414}
415 415
416extern void end_page_writeback(struct page *page); 416extern void end_page_writeback(struct page *page);
417void wait_for_stable_page(struct page *page);
417 418
418/* 419/*
419 * Add an arbitrary waiter to a page's wait queue 420 * Add an arbitrary waiter to a page's wait queue
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 15472d691ee6..6fa4dd2a3b9e 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1101,6 +1101,12 @@ static inline int pci_enable_msi_block(struct pci_dev *dev, unsigned int nvec)
1101 return -1; 1101 return -1;
1102} 1102}
1103 1103
1104static inline int
1105pci_enable_msi_block_auto(struct pci_dev *dev, unsigned int *maxvec)
1106{
1107 return -1;
1108}
1109
1104static inline void pci_msi_shutdown(struct pci_dev *dev) 1110static inline void pci_msi_shutdown(struct pci_dev *dev)
1105{ } 1111{ }
1106static inline void pci_disable_msi(struct pci_dev *dev) 1112static inline void pci_disable_msi(struct pci_dev *dev)
@@ -1132,6 +1138,7 @@ static inline int pci_msi_enabled(void)
1132} 1138}
1133#else 1139#else
1134extern int pci_enable_msi_block(struct pci_dev *dev, unsigned int nvec); 1140extern int pci_enable_msi_block(struct pci_dev *dev, unsigned int nvec);
1141extern int pci_enable_msi_block_auto(struct pci_dev *dev, unsigned int *maxvec);
1135extern void pci_msi_shutdown(struct pci_dev *dev); 1142extern void pci_msi_shutdown(struct pci_dev *dev);
1136extern void pci_disable_msi(struct pci_dev *dev); 1143extern void pci_disable_msi(struct pci_dev *dev);
1137extern int pci_msix_table_size(struct pci_dev *dev); 1144extern int pci_msix_table_size(struct pci_dev *dev);
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 0eb65796bcb9..31717bd287fd 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -1807,6 +1807,8 @@
1807#define PCI_VENDOR_ID_ESDGMBH 0x12fe 1807#define PCI_VENDOR_ID_ESDGMBH 0x12fe
1808#define PCI_DEVICE_ID_ESDGMBH_CPCIASIO4 0x0111 1808#define PCI_DEVICE_ID_ESDGMBH_CPCIASIO4 0x0111
1809 1809
1810#define PCI_VENDOR_ID_CB 0x1307 /* Measurement Computing */
1811
1810#define PCI_VENDOR_ID_SIIG 0x131f 1812#define PCI_VENDOR_ID_SIIG 0x131f
1811#define PCI_SUBVENDOR_ID_SIIG 0x131f 1813#define PCI_SUBVENDOR_ID_SIIG 0x131f
1812#define PCI_DEVICE_ID_SIIG_1S_10x_550 0x1000 1814#define PCI_DEVICE_ID_SIIG_1S_10x_550 0x1000
@@ -1868,8 +1870,23 @@
1868#define PCI_VENDOR_ID_QUATECH 0x135C 1870#define PCI_VENDOR_ID_QUATECH 0x135C
1869#define PCI_DEVICE_ID_QUATECH_QSC100 0x0010 1871#define PCI_DEVICE_ID_QUATECH_QSC100 0x0010
1870#define PCI_DEVICE_ID_QUATECH_DSC100 0x0020 1872#define PCI_DEVICE_ID_QUATECH_DSC100 0x0020
1873#define PCI_DEVICE_ID_QUATECH_DSC200 0x0030
1874#define PCI_DEVICE_ID_QUATECH_QSC200 0x0040
1871#define PCI_DEVICE_ID_QUATECH_ESC100D 0x0050 1875#define PCI_DEVICE_ID_QUATECH_ESC100D 0x0050
1872#define PCI_DEVICE_ID_QUATECH_ESC100M 0x0060 1876#define PCI_DEVICE_ID_QUATECH_ESC100M 0x0060
1877#define PCI_DEVICE_ID_QUATECH_QSCP100 0x0120
1878#define PCI_DEVICE_ID_QUATECH_DSCP100 0x0130
1879#define PCI_DEVICE_ID_QUATECH_QSCP200 0x0140
1880#define PCI_DEVICE_ID_QUATECH_DSCP200 0x0150
1881#define PCI_DEVICE_ID_QUATECH_QSCLP100 0x0170
1882#define PCI_DEVICE_ID_QUATECH_DSCLP100 0x0180
1883#define PCI_DEVICE_ID_QUATECH_DSC100E 0x0181
1884#define PCI_DEVICE_ID_QUATECH_SSCLP100 0x0190
1885#define PCI_DEVICE_ID_QUATECH_QSCLP200 0x01A0
1886#define PCI_DEVICE_ID_QUATECH_DSCLP200 0x01B0
1887#define PCI_DEVICE_ID_QUATECH_DSC200E 0x01B1
1888#define PCI_DEVICE_ID_QUATECH_SSCLP200 0x01C0
1889#define PCI_DEVICE_ID_QUATECH_ESCLP100 0x01E0
1873#define PCI_DEVICE_ID_QUATECH_SPPXP_100 0x0278 1890#define PCI_DEVICE_ID_QUATECH_SPPXP_100 0x0278
1874 1891
1875#define PCI_VENDOR_ID_SEALEVEL 0x135e 1892#define PCI_VENDOR_ID_SEALEVEL 0x135e
@@ -2013,6 +2030,10 @@
2013#define PCI_DEVICE_ID_CMEDIA_CM8738 0x0111 2030#define PCI_DEVICE_ID_CMEDIA_CM8738 0x0111
2014#define PCI_DEVICE_ID_CMEDIA_CM8738B 0x0112 2031#define PCI_DEVICE_ID_CMEDIA_CM8738B 0x0112
2015 2032
2033#define PCI_VENDOR_ID_ADVANTECH 0x13fe
2034
2035#define PCI_VENDOR_ID_MEILHAUS 0x1402
2036
2016#define PCI_VENDOR_ID_LAVA 0x1407 2037#define PCI_VENDOR_ID_LAVA 0x1407
2017#define PCI_DEVICE_ID_LAVA_DSERIAL 0x0100 /* 2x 16550 */ 2038#define PCI_DEVICE_ID_LAVA_DSERIAL 0x0100 /* 2x 16550 */
2018#define PCI_DEVICE_ID_LAVA_QUATRO_A 0x0101 /* 2x 16550, half of 4 port */ 2039#define PCI_DEVICE_ID_LAVA_QUATRO_A 0x0101 /* 2x 16550, half of 4 port */
@@ -2058,6 +2079,8 @@
2058 2079
2059#define PCI_VENDOR_ID_CHELSIO 0x1425 2080#define PCI_VENDOR_ID_CHELSIO 0x1425
2060 2081
2082#define PCI_VENDOR_ID_ADLINK 0x144a
2083
2061#define PCI_VENDOR_ID_SAMSUNG 0x144d 2084#define PCI_VENDOR_ID_SAMSUNG 0x144d
2062 2085
2063#define PCI_VENDOR_ID_GIGABYTE 0x1458 2086#define PCI_VENDOR_ID_GIGABYTE 0x1458
@@ -2091,6 +2114,8 @@
2091#define PCI_DEVICE_ID_AFAVLAB_P030 0x2182 2114#define PCI_DEVICE_ID_AFAVLAB_P030 0x2182
2092#define PCI_SUBDEVICE_ID_AFAVLAB_P061 0x2150 2115#define PCI_SUBDEVICE_ID_AFAVLAB_P061 0x2150
2093 2116
2117#define PCI_VENDOR_ID_AMPLICON 0x14dc
2118
2094#define PCI_VENDOR_ID_BCM_GVC 0x14a4 2119#define PCI_VENDOR_ID_BCM_GVC 0x14a4
2095#define PCI_VENDOR_ID_BROADCOM 0x14e4 2120#define PCI_VENDOR_ID_BROADCOM 0x14e4
2096#define PCI_DEVICE_ID_TIGON3_5752 0x1600 2121#define PCI_DEVICE_ID_TIGON3_5752 0x1600
@@ -2127,6 +2152,7 @@
2127#define PCI_DEVICE_ID_TIGON3_5754M 0x1672 2152#define PCI_DEVICE_ID_TIGON3_5754M 0x1672
2128#define PCI_DEVICE_ID_TIGON3_5755M 0x1673 2153#define PCI_DEVICE_ID_TIGON3_5755M 0x1673
2129#define PCI_DEVICE_ID_TIGON3_5756 0x1674 2154#define PCI_DEVICE_ID_TIGON3_5756 0x1674
2155#define PCI_DEVICE_ID_TIGON3_5750 0x1676
2130#define PCI_DEVICE_ID_TIGON3_5751 0x1677 2156#define PCI_DEVICE_ID_TIGON3_5751 0x1677
2131#define PCI_DEVICE_ID_TIGON3_5715 0x1678 2157#define PCI_DEVICE_ID_TIGON3_5715 0x1678
2132#define PCI_DEVICE_ID_TIGON3_5715S 0x1679 2158#define PCI_DEVICE_ID_TIGON3_5715S 0x1679
diff --git a/include/linux/percpu_counter.h b/include/linux/percpu_counter.h
index b9df9ed1adc0..d5dd4657c8d6 100644
--- a/include/linux/percpu_counter.h
+++ b/include/linux/percpu_counter.h
@@ -83,7 +83,7 @@ static inline int percpu_counter_initialized(struct percpu_counter *fbc)
83 return (fbc->counters != NULL); 83 return (fbc->counters != NULL);
84} 84}
85 85
86#else 86#else /* !CONFIG_SMP */
87 87
88struct percpu_counter { 88struct percpu_counter {
89 s64 count; 89 s64 count;
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 6bfb2faa0b19..e47ee462c2f2 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -135,16 +135,21 @@ struct hw_perf_event {
135 struct { /* software */ 135 struct { /* software */
136 struct hrtimer hrtimer; 136 struct hrtimer hrtimer;
137 }; 137 };
138 struct { /* tracepoint */
139 struct task_struct *tp_target;
140 /* for tp_event->class */
141 struct list_head tp_list;
142 };
138#ifdef CONFIG_HAVE_HW_BREAKPOINT 143#ifdef CONFIG_HAVE_HW_BREAKPOINT
139 struct { /* breakpoint */ 144 struct { /* breakpoint */
140 struct arch_hw_breakpoint info;
141 struct list_head bp_list;
142 /* 145 /*
143 * Crufty hack to avoid the chicken and egg 146 * Crufty hack to avoid the chicken and egg
144 * problem hw_breakpoint has with context 147 * problem hw_breakpoint has with context
145 * creation and event initalization. 148 * creation and event initalization.
146 */ 149 */
147 struct task_struct *bp_target; 150 struct task_struct *bp_target;
151 struct arch_hw_breakpoint info;
152 struct list_head bp_list;
148 }; 153 };
149#endif 154#endif
150 }; 155 };
@@ -817,6 +822,17 @@ do { \
817} while (0) 822} while (0)
818 823
819 824
825struct perf_pmu_events_attr {
826 struct device_attribute attr;
827 u64 id;
828};
829
830#define PMU_EVENT_ATTR(_name, _var, _id, _show) \
831static struct perf_pmu_events_attr _var = { \
832 .attr = __ATTR(_name, 0444, _show, NULL), \
833 .id = _id, \
834};
835
820#define PMU_FORMAT_ATTR(_name, _format) \ 836#define PMU_FORMAT_ATTR(_name, _format) \
821static ssize_t \ 837static ssize_t \
822_name##_show(struct device *dev, \ 838_name##_show(struct device *dev, \
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 93b3cf77f564..33999adbf8c8 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -506,13 +506,13 @@ struct phy_device *get_phy_device(struct mii_bus *bus, int addr, bool is_c45);
506int phy_device_register(struct phy_device *phy); 506int phy_device_register(struct phy_device *phy);
507int phy_init_hw(struct phy_device *phydev); 507int phy_init_hw(struct phy_device *phydev);
508struct phy_device * phy_attach(struct net_device *dev, 508struct phy_device * phy_attach(struct net_device *dev,
509 const char *bus_id, u32 flags, phy_interface_t interface); 509 const char *bus_id, phy_interface_t interface);
510struct phy_device *phy_find_first(struct mii_bus *bus); 510struct phy_device *phy_find_first(struct mii_bus *bus);
511int phy_connect_direct(struct net_device *dev, struct phy_device *phydev, 511int phy_connect_direct(struct net_device *dev, struct phy_device *phydev,
512 void (*handler)(struct net_device *), u32 flags, 512 void (*handler)(struct net_device *),
513 phy_interface_t interface); 513 phy_interface_t interface);
514struct phy_device * phy_connect(struct net_device *dev, const char *bus_id, 514struct phy_device * phy_connect(struct net_device *dev, const char *bus_id,
515 void (*handler)(struct net_device *), u32 flags, 515 void (*handler)(struct net_device *),
516 phy_interface_t interface); 516 phy_interface_t interface);
517void phy_disconnect(struct phy_device *phydev); 517void phy_disconnect(struct phy_device *phydev);
518void phy_detach(struct phy_device *phydev); 518void phy_detach(struct phy_device *phydev);
diff --git a/include/linux/pinctrl/devinfo.h b/include/linux/pinctrl/devinfo.h
new file mode 100644
index 000000000000..6e5f8a985ea7
--- /dev/null
+++ b/include/linux/pinctrl/devinfo.h
@@ -0,0 +1,45 @@
1/*
2 * Per-device information from the pin control system.
3 * This is the stuff that get included into the device
4 * core.
5 *
6 * Copyright (C) 2012 ST-Ericsson SA
7 * Written on behalf of Linaro for ST-Ericsson
8 * This interface is used in the core to keep track of pins.
9 *
10 * Author: Linus Walleij <linus.walleij@linaro.org>
11 *
12 * License terms: GNU General Public License (GPL) version 2
13 */
14
15#ifndef PINCTRL_DEVINFO_H
16#define PINCTRL_DEVINFO_H
17
18#ifdef CONFIG_PINCTRL
19
20/* The device core acts as a consumer toward pinctrl */
21#include <linux/pinctrl/consumer.h>
22
23/**
24 * struct dev_pin_info - pin state container for devices
25 * @p: pinctrl handle for the containing device
26 * @default_state: the default state for the handle, if found
27 */
28struct dev_pin_info {
29 struct pinctrl *p;
30 struct pinctrl_state *default_state;
31};
32
33extern int pinctrl_bind_pins(struct device *dev);
34
35#else
36
37/* Stubs if we're not using pinctrl */
38
39static inline int pinctrl_bind_pins(struct device *dev)
40{
41 return 0;
42}
43
44#endif /* CONFIG_PINCTRL */
45#endif /* PINCTRL_DEVINFO_H */
diff --git a/include/linux/pinctrl/pinconf-generic.h b/include/linux/pinctrl/pinconf-generic.h
index 47a1bdd88878..72474e18f1e0 100644
--- a/include/linux/pinctrl/pinconf-generic.h
+++ b/include/linux/pinctrl/pinconf-generic.h
@@ -46,7 +46,11 @@
46 * @PIN_CONFIG_DRIVE_OPEN_SOURCE: the pin will be driven with open source 46 * @PIN_CONFIG_DRIVE_OPEN_SOURCE: the pin will be driven with open source
47 * (open emitter). Sending this config will enabale open drain mode, the 47 * (open emitter). Sending this config will enabale open drain mode, the
48 * argument is ignored. 48 * argument is ignored.
49 * @PIN_CONFIG_INPUT_SCHMITT_DISABLE: disable schmitt-trigger mode on the pin. 49 * @PIN_CONFIG_DRIVE_STRENGTH: the pin will output the current passed as
50 * argument. The argument is in mA.
51 * @PIN_CONFIG_INPUT_SCHMITT_ENABLE: control schmitt-trigger mode on the pin.
52 * If the argument != 0, schmitt-trigger mode is enabled. If it's 0,
53 * schmitt-trigger mode is disabled.
50 * @PIN_CONFIG_INPUT_SCHMITT: this will configure an input pin to run in 54 * @PIN_CONFIG_INPUT_SCHMITT: this will configure an input pin to run in
51 * schmitt-trigger mode. If the schmitt-trigger has adjustable hysteresis, 55 * schmitt-trigger mode. If the schmitt-trigger has adjustable hysteresis,
52 * the threshold value is given on a custom format as argument when 56 * the threshold value is given on a custom format as argument when
@@ -58,10 +62,15 @@
58 * @PIN_CONFIG_POWER_SOURCE: if the pin can select between different power 62 * @PIN_CONFIG_POWER_SOURCE: if the pin can select between different power
59 * supplies, the argument to this parameter (on a custom format) tells 63 * supplies, the argument to this parameter (on a custom format) tells
60 * the driver which alternative power source to use. 64 * the driver which alternative power source to use.
65 * @PIN_CONFIG_SLEW_RATE: if the pin can select slew rate, the argument to
66 * this parameter (on a custom format) tells the driver which alternative
67 * slew rate to use.
61 * @PIN_CONFIG_LOW_POWER_MODE: this will configure the pin for low power 68 * @PIN_CONFIG_LOW_POWER_MODE: this will configure the pin for low power
62 * operation, if several modes of operation are supported these can be 69 * operation, if several modes of operation are supported these can be
63 * passed in the argument on a custom form, else just use argument 1 70 * passed in the argument on a custom form, else just use argument 1
64 * to indicate low power mode, argument 0 turns low power mode off. 71 * to indicate low power mode, argument 0 turns low power mode off.
72 * @PIN_CONFIG_OUTPUT: this will configure the pin in output, use argument
73 * 1 to indicate high level, argument 0 to indicate low level.
65 * @PIN_CONFIG_END: this is the last enumerator for pin configurations, if 74 * @PIN_CONFIG_END: this is the last enumerator for pin configurations, if
66 * you need to pass in custom configurations to the pin controller, use 75 * you need to pass in custom configurations to the pin controller, use
67 * PIN_CONFIG_END+1 as the base offset. 76 * PIN_CONFIG_END+1 as the base offset.
@@ -74,11 +83,14 @@ enum pin_config_param {
74 PIN_CONFIG_DRIVE_PUSH_PULL, 83 PIN_CONFIG_DRIVE_PUSH_PULL,
75 PIN_CONFIG_DRIVE_OPEN_DRAIN, 84 PIN_CONFIG_DRIVE_OPEN_DRAIN,
76 PIN_CONFIG_DRIVE_OPEN_SOURCE, 85 PIN_CONFIG_DRIVE_OPEN_SOURCE,
77 PIN_CONFIG_INPUT_SCHMITT_DISABLE, 86 PIN_CONFIG_DRIVE_STRENGTH,
87 PIN_CONFIG_INPUT_SCHMITT_ENABLE,
78 PIN_CONFIG_INPUT_SCHMITT, 88 PIN_CONFIG_INPUT_SCHMITT,
79 PIN_CONFIG_INPUT_DEBOUNCE, 89 PIN_CONFIG_INPUT_DEBOUNCE,
80 PIN_CONFIG_POWER_SOURCE, 90 PIN_CONFIG_POWER_SOURCE,
91 PIN_CONFIG_SLEW_RATE,
81 PIN_CONFIG_LOW_POWER_MODE, 92 PIN_CONFIG_LOW_POWER_MODE,
93 PIN_CONFIG_OUTPUT,
82 PIN_CONFIG_END = 0x7FFF, 94 PIN_CONFIG_END = 0x7FFF,
83}; 95};
84 96
diff --git a/include/linux/pinctrl/pinctrl.h b/include/linux/pinctrl/pinctrl.h
index 04d6700d99af..778804df293f 100644
--- a/include/linux/pinctrl/pinctrl.h
+++ b/include/linux/pinctrl/pinctrl.h
@@ -154,6 +154,7 @@ struct pinctrl_dev *of_pinctrl_get(struct device_node *np)
154#endif /* CONFIG_OF */ 154#endif /* CONFIG_OF */
155 155
156extern const char *pinctrl_dev_get_name(struct pinctrl_dev *pctldev); 156extern const char *pinctrl_dev_get_name(struct pinctrl_dev *pctldev);
157extern const char *pinctrl_dev_get_devname(struct pinctrl_dev *pctldev);
157extern void *pinctrl_dev_get_drvdata(struct pinctrl_dev *pctldev); 158extern void *pinctrl_dev_get_drvdata(struct pinctrl_dev *pctldev);
158#else 159#else
159 160
diff --git a/include/linux/platform_data/cpsw.h b/include/linux/platform_data/cpsw.h
index 24368a2e8b87..798fb80b024b 100644
--- a/include/linux/platform_data/cpsw.h
+++ b/include/linux/platform_data/cpsw.h
@@ -21,6 +21,8 @@ struct cpsw_slave_data {
21 char phy_id[MII_BUS_ID_SIZE]; 21 char phy_id[MII_BUS_ID_SIZE];
22 int phy_if; 22 int phy_if;
23 u8 mac_addr[ETH_ALEN]; 23 u8 mac_addr[ETH_ALEN];
24 u16 dual_emac_res_vlan; /* Reserved VLAN for DualEMAC */
25
24}; 26};
25 27
26struct cpsw_platform_data { 28struct cpsw_platform_data {
@@ -35,6 +37,8 @@ struct cpsw_platform_data {
35 u32 bd_ram_size; /*buffer descriptor ram size */ 37 u32 bd_ram_size; /*buffer descriptor ram size */
36 u32 rx_descs; /* Number of Rx Descriptios */ 38 u32 rx_descs; /* Number of Rx Descriptios */
37 u32 mac_control; /* Mac control register */ 39 u32 mac_control; /* Mac control register */
40 u16 default_vlan; /* Def VLAN for ALE lookup in VLAN aware mode*/
41 bool dual_emac; /* Enable Dual EMAC mode */
38}; 42};
39 43
40#endif /* __CPSW_H__ */ 44#endif /* __CPSW_H__ */
diff --git a/include/linux/platform_data/dma-coh901318.h b/include/linux/platform_data/dma-coh901318.h
new file mode 100644
index 000000000000..c4cb9590d115
--- /dev/null
+++ b/include/linux/platform_data/dma-coh901318.h
@@ -0,0 +1,72 @@
1/*
2 * Platform data for the COH901318 DMA controller
3 * Copyright (C) 2007-2013 ST-Ericsson
4 * License terms: GNU General Public License (GPL) version 2
5 */
6
7#ifndef PLAT_COH901318_H
8#define PLAT_COH901318_H
9
10#ifdef CONFIG_COH901318
11
12/* We only support the U300 DMA channels */
13#define U300_DMA_MSL_TX_0 0
14#define U300_DMA_MSL_TX_1 1
15#define U300_DMA_MSL_TX_2 2
16#define U300_DMA_MSL_TX_3 3
17#define U300_DMA_MSL_TX_4 4
18#define U300_DMA_MSL_TX_5 5
19#define U300_DMA_MSL_TX_6 6
20#define U300_DMA_MSL_RX_0 7
21#define U300_DMA_MSL_RX_1 8
22#define U300_DMA_MSL_RX_2 9
23#define U300_DMA_MSL_RX_3 10
24#define U300_DMA_MSL_RX_4 11
25#define U300_DMA_MSL_RX_5 12
26#define U300_DMA_MSL_RX_6 13
27#define U300_DMA_MMCSD_RX_TX 14
28#define U300_DMA_MSPRO_TX 15
29#define U300_DMA_MSPRO_RX 16
30#define U300_DMA_UART0_TX 17
31#define U300_DMA_UART0_RX 18
32#define U300_DMA_APEX_TX 19
33#define U300_DMA_APEX_RX 20
34#define U300_DMA_PCM_I2S0_TX 21
35#define U300_DMA_PCM_I2S0_RX 22
36#define U300_DMA_PCM_I2S1_TX 23
37#define U300_DMA_PCM_I2S1_RX 24
38#define U300_DMA_XGAM_CDI 25
39#define U300_DMA_XGAM_PDI 26
40#define U300_DMA_SPI_TX 27
41#define U300_DMA_SPI_RX 28
42#define U300_DMA_GENERAL_PURPOSE_0 29
43#define U300_DMA_GENERAL_PURPOSE_1 30
44#define U300_DMA_GENERAL_PURPOSE_2 31
45#define U300_DMA_GENERAL_PURPOSE_3 32
46#define U300_DMA_GENERAL_PURPOSE_4 33
47#define U300_DMA_GENERAL_PURPOSE_5 34
48#define U300_DMA_GENERAL_PURPOSE_6 35
49#define U300_DMA_GENERAL_PURPOSE_7 36
50#define U300_DMA_GENERAL_PURPOSE_8 37
51#define U300_DMA_UART1_TX 38
52#define U300_DMA_UART1_RX 39
53
54#define U300_DMA_DEVICE_CHANNELS 32
55#define U300_DMA_CHANNELS 40
56
57/**
58 * coh901318_filter_id() - DMA channel filter function
59 * @chan: dma channel handle
60 * @chan_id: id of dma channel to be filter out
61 *
62 * In dma_request_channel() it specifies what channel id to be requested
63 */
64bool coh901318_filter_id(struct dma_chan *chan, void *chan_id);
65#else
66static inline bool coh901318_filter_id(struct dma_chan *chan, void *chan_id)
67{
68 return false;
69}
70#endif
71
72#endif /* PLAT_COH901318_H */
diff --git a/include/linux/platform_data/i2c-s3c2410.h b/include/linux/platform_data/i2c-s3c2410.h
index 51d52e767a19..2a50048c1c44 100644
--- a/include/linux/platform_data/i2c-s3c2410.h
+++ b/include/linux/platform_data/i2c-s3c2410.h
@@ -15,6 +15,8 @@
15 15
16#define S3C_IICFLG_FILTER (1<<0) /* enable s3c2440 filter */ 16#define S3C_IICFLG_FILTER (1<<0) /* enable s3c2440 filter */
17 17
18struct platform_device;
19
18/** 20/**
19 * struct s3c2410_platform_i2c - Platform data for s3c I2C. 21 * struct s3c2410_platform_i2c - Platform data for s3c I2C.
20 * @bus_num: The bus number to use (if possible). 22 * @bus_num: The bus number to use (if possible).
diff --git a/include/linux/platform_data/invensense_mpu6050.h b/include/linux/platform_data/invensense_mpu6050.h
new file mode 100644
index 000000000000..ad3aa7b95f35
--- /dev/null
+++ b/include/linux/platform_data/invensense_mpu6050.h
@@ -0,0 +1,31 @@
1/*
2* Copyright (C) 2012 Invensense, Inc.
3*
4* This software is licensed under the terms of the GNU General Public
5* License version 2, as published by the Free Software Foundation, and
6* may be copied, distributed, and modified under those terms.
7*
8* This program is distributed in the hope that it will be useful,
9* but WITHOUT ANY WARRANTY; without even the implied warranty of
10* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11* GNU General Public License for more details.
12*/
13
14#ifndef __INV_MPU6050_PLATFORM_H_
15#define __INV_MPU6050_PLATFORM_H_
16
17/**
18 * struct inv_mpu6050_platform_data - Platform data for the mpu driver
19 * @orientation: Orientation matrix of the chip
20 *
21 * Contains platform specific information on how to configure the MPU6050 to
22 * work on this platform. The orientation matricies are 3x3 rotation matricies
23 * that are applied to the data to rotate from the mounting orientation to the
24 * platform orientation. The values must be one of 0, 1, or -1 and each row and
25 * column should have exactly 1 non-zero value.
26 */
27struct inv_mpu6050_platform_data {
28 __s8 orientation[9];
29};
30
31#endif
diff --git a/include/linux/platform_data/lp855x.h b/include/linux/platform_data/lp855x.h
index e81f62d24ee2..20ee8b221dbd 100644
--- a/include/linux/platform_data/lp855x.h
+++ b/include/linux/platform_data/lp855x.h
@@ -49,12 +49,24 @@
49#define LP8556_FAST_CONFIG BIT(7) /* use it if EPROMs should be maintained 49#define LP8556_FAST_CONFIG BIT(7) /* use it if EPROMs should be maintained
50 when exiting the low power mode */ 50 when exiting the low power mode */
51 51
52/* CONFIG register - LP8557 */
53#define LP8557_PWM_STANDBY BIT(7)
54#define LP8557_PWM_FILTER BIT(6)
55#define LP8557_RELOAD_EPROM BIT(3) /* use it if EPROMs should be reset
56 when the backlight turns on */
57#define LP8557_OFF_OPENLEDS BIT(2)
58#define LP8557_PWM_CONFIG LP8557_PWM_ONLY
59#define LP8557_I2C_CONFIG LP8557_I2C_ONLY
60#define LP8557_COMB1_CONFIG LP8557_COMBINED1
61#define LP8557_COMB2_CONFIG LP8557_COMBINED2
62
52enum lp855x_chip_id { 63enum lp855x_chip_id {
53 LP8550, 64 LP8550,
54 LP8551, 65 LP8551,
55 LP8552, 66 LP8552,
56 LP8553, 67 LP8553,
57 LP8556, 68 LP8556,
69 LP8557,
58}; 70};
59 71
60enum lp855x_brightness_ctrl_mode { 72enum lp855x_brightness_ctrl_mode {
@@ -89,6 +101,13 @@ enum lp8556_brightness_source {
89 LP8556_COMBINED2, /* pwm + i2c after the shaper block */ 101 LP8556_COMBINED2, /* pwm + i2c after the shaper block */
90}; 102};
91 103
104enum lp8557_brightness_source {
105 LP8557_PWM_ONLY,
106 LP8557_I2C_ONLY,
107 LP8557_COMBINED1, /* pwm + i2c after the shaper block */
108 LP8557_COMBINED2, /* pwm + i2c before the shaper block */
109};
110
92struct lp855x_rom_data { 111struct lp855x_rom_data {
93 u8 addr; 112 u8 addr;
94 u8 val; 113 u8 val;
diff --git a/include/linux/platform_data/lp8755.h b/include/linux/platform_data/lp8755.h
new file mode 100644
index 000000000000..a7fd0776c9bf
--- /dev/null
+++ b/include/linux/platform_data/lp8755.h
@@ -0,0 +1,71 @@
1/*
2 * LP8755 High Performance Power Management Unit Driver:System Interface Driver
3 *
4 * Copyright (C) 2012 Texas Instruments
5 *
6 * Author: Daniel(Geon Si) Jeong <daniel.jeong@ti.com>
7 * G.Shark Jeong <gshark.jeong@gmail.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 *
13 */
14
15#ifndef _LP8755_H
16#define _LP8755_H
17
18#include <linux/regulator/consumer.h>
19
20#define LP8755_NAME "lp8755-regulator"
21/*
22 *PWR FAULT : power fault detected
23 *OCP : over current protect activated
24 *OVP : over voltage protect activated
25 *TEMP_WARN : thermal warning
26 *TEMP_SHDN : thermal shutdonw detected
27 *I_LOAD : current measured
28 */
29#define LP8755_EVENT_PWR_FAULT REGULATOR_EVENT_FAIL
30#define LP8755_EVENT_OCP REGULATOR_EVENT_OVER_CURRENT
31#define LP8755_EVENT_OVP 0x10000
32#define LP8755_EVENT_TEMP_WARN 0x2000
33#define LP8755_EVENT_TEMP_SHDN REGULATOR_EVENT_OVER_TEMP
34#define LP8755_EVENT_I_LOAD 0x40000
35
36enum lp8755_bucks {
37 LP8755_BUCK0 = 0,
38 LP8755_BUCK1,
39 LP8755_BUCK2,
40 LP8755_BUCK3,
41 LP8755_BUCK4,
42 LP8755_BUCK5,
43 LP8755_BUCK_MAX,
44};
45
46/**
47 * multiphase configuration options
48 */
49enum lp8755_mphase_config {
50 MPHASE_CONF0,
51 MPHASE_CONF1,
52 MPHASE_CONF2,
53 MPHASE_CONF3,
54 MPHASE_CONF4,
55 MPHASE_CONF5,
56 MPHASE_CONF6,
57 MPHASE_CONF7,
58 MPHASE_CONF8,
59 MPHASE_CONF_MAX
60};
61
62/**
63 * struct lp8755_platform_data
64 * @mphase_type : Multiphase Switcher Configurations.
65 * @buck_data : buck0~6 init voltage in uV
66 */
67struct lp8755_platform_data {
68 int mphase;
69 struct regulator_init_data *buck_data[LP8755_BUCK_MAX];
70};
71#endif
diff --git a/include/linux/platform_data/max6697.h b/include/linux/platform_data/max6697.h
new file mode 100644
index 000000000000..ed9d3b3daf02
--- /dev/null
+++ b/include/linux/platform_data/max6697.h
@@ -0,0 +1,36 @@
1/*
2 * max6697.h
3 * Copyright (c) 2012 Guenter Roeck <linux@roeck-us.net>
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#ifndef MAX6697_H
11#define MAX6697_H
12
13#include <linux/types.h>
14
15/*
16 * For all bit masks:
17 * bit 0: local temperature
18 * bit 1..7: remote temperatures
19 */
20struct max6697_platform_data {
21 bool smbus_timeout_disable; /* set to disable SMBus timeouts */
22 bool extended_range_enable; /* set to enable extended temp range */
23 bool beta_compensation; /* set to enable beta compensation */
24 u8 alert_mask; /* set bit to 1 to disable alert */
25 u8 over_temperature_mask; /* set bit to 1 to disable */
26 u8 resistance_cancellation; /* set bit to 0 to disable
27 * bit mask for MAX6581,
28 * boolean for other chips
29 */
30 u8 ideality_mask; /* set bit to 0 to disable */
31 u8 ideality_value; /* transistor ideality as per
32 * MAX6581 datasheet
33 */
34};
35
36#endif /* MAX6697_H */
diff --git a/include/linux/platform_data/microread.h b/include/linux/platform_data/microread.h
new file mode 100644
index 000000000000..cfda59b226ee
--- /dev/null
+++ b/include/linux/platform_data/microread.h
@@ -0,0 +1,35 @@
1/*
2 * Driver include for the PN544 NFC chip.
3 *
4 * Copyright (C) 2011 Tieto Poland
5 * Copyright (C) 2012 Intel Corporation. All rights reserved.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * version 2 as published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#ifndef _MICROREAD_H
22#define _MICROREAD_H
23
24#include <linux/i2c.h>
25
26#define MICROREAD_DRIVER_NAME "microread"
27
28/* board config platform data for microread */
29struct microread_nfc_platform_data {
30 unsigned int rst_gpio;
31 unsigned int irq_gpio;
32 unsigned int ioh_gpio;
33};
34
35#endif /* _MICROREAD_H */
diff --git a/include/linux/platform_data/mtd-nand-omap2.h b/include/linux/platform_data/mtd-nand-omap2.h
index 24d32ca34bef..6bf9ef43ddb1 100644
--- a/include/linux/platform_data/mtd-nand-omap2.h
+++ b/include/linux/platform_data/mtd-nand-omap2.h
@@ -60,6 +60,8 @@ struct omap_nand_platform_data {
60 int devsize; 60 int devsize;
61 enum omap_ecc ecc_opt; 61 enum omap_ecc ecc_opt;
62 struct gpmc_nand_regs reg; 62 struct gpmc_nand_regs reg;
63};
64 63
64 /* for passing the partitions */
65 struct device_node *of_node;
66};
65#endif 67#endif
diff --git a/include/linux/platform_data/mtd-onenand-omap2.h b/include/linux/platform_data/mtd-onenand-omap2.h
index 685af7e8b120..e9a9fb188f97 100644
--- a/include/linux/platform_data/mtd-onenand-omap2.h
+++ b/include/linux/platform_data/mtd-onenand-omap2.h
@@ -29,5 +29,8 @@ struct omap_onenand_platform_data {
29 u8 flags; 29 u8 flags;
30 u8 regulator_can_sleep; 30 u8 regulator_can_sleep;
31 u8 skip_initial_unlocking; 31 u8 skip_initial_unlocking;
32
33 /* for passing the partitions */
34 struct device_node *of_node;
32}; 35};
33#endif 36#endif
diff --git a/include/linux/platform_data/s3c-hsotg.h b/include/linux/platform_data/s3c-hsotg.h
index 8b79e0967f9c..3f1cbf95ec3b 100644
--- a/include/linux/platform_data/s3c-hsotg.h
+++ b/include/linux/platform_data/s3c-hsotg.h
@@ -15,6 +15,8 @@
15#ifndef __LINUX_USB_S3C_HSOTG_H 15#ifndef __LINUX_USB_S3C_HSOTG_H
16#define __LINUX_USB_S3C_HSOTG_H 16#define __LINUX_USB_S3C_HSOTG_H
17 17
18struct platform_device;
19
18enum s3c_hsotg_dmamode { 20enum s3c_hsotg_dmamode {
19 S3C_HSOTG_DMA_NONE, /* do not use DMA at-all */ 21 S3C_HSOTG_DMA_NONE, /* do not use DMA at-all */
20 S3C_HSOTG_DMA_ONLY, /* always use DMA */ 22 S3C_HSOTG_DMA_ONLY, /* always use DMA */
diff --git a/include/linux/platform_data/samsung-usbphy.h b/include/linux/platform_data/samsung-usbphy.h
new file mode 100644
index 000000000000..1bd24cba982b
--- /dev/null
+++ b/include/linux/platform_data/samsung-usbphy.h
@@ -0,0 +1,27 @@
1/*
2 * Copyright (C) 2012 Samsung Electronics Co.Ltd
3 * http://www.samsung.com/
4 * Author: Praveen Paneri <p.paneri@samsung.com>
5 *
6 * Defines platform data for samsung usb phy driver.
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 */
13
14#ifndef __SAMSUNG_USBPHY_PLATFORM_H
15#define __SAMSUNG_USBPHY_PLATFORM_H
16
17/**
18 * samsung_usbphy_data - Platform data for USB PHY driver.
19 * @pmu_isolation: Function to control usb phy isolation in PMU.
20 */
21struct samsung_usbphy_data {
22 void (*pmu_isolation)(int on);
23};
24
25extern void samsung_usbphy_set_pdata(struct samsung_usbphy_data *pd);
26
27#endif /* __SAMSUNG_USBPHY_PLATFORM_H */
diff --git a/include/linux/platform_data/sccnxp.h b/include/linux/platform_data/serial-sccnxp.h
index 7311ccd3217f..215574d1e81d 100644
--- a/include/linux/platform_data/sccnxp.h
+++ b/include/linux/platform_data/serial-sccnxp.h
@@ -11,8 +11,8 @@
11 * (at your option) any later version. 11 * (at your option) any later version.
12 */ 12 */
13 13
14#ifndef __SCCNXP_H 14#ifndef _PLATFORM_DATA_SERIAL_SCCNXP_H_
15#define __SCCNXP_H 15#define _PLATFORM_DATA_SERIAL_SCCNXP_H_
16 16
17#define SCCNXP_MAX_UARTS 2 17#define SCCNXP_MAX_UARTS 2
18 18
@@ -84,6 +84,8 @@ struct sccnxp_pdata {
84 const u8 reg_shift; 84 const u8 reg_shift;
85 /* Modem control lines configuration */ 85 /* Modem control lines configuration */
86 const u32 mctrl_cfg[SCCNXP_MAX_UARTS]; 86 const u32 mctrl_cfg[SCCNXP_MAX_UARTS];
87 /* Timer value for polling mode (usecs) */
88 const unsigned int poll_time_us;
87 /* Called during startup */ 89 /* Called during startup */
88 void (*init)(void); 90 void (*init)(void);
89 /* Called before finish */ 91 /* Called before finish */
diff --git a/include/linux/platform_data/spi-omap2-mcspi.h b/include/linux/platform_data/spi-omap2-mcspi.h
index a65572d53211..c100456eab17 100644
--- a/include/linux/platform_data/spi-omap2-mcspi.h
+++ b/include/linux/platform_data/spi-omap2-mcspi.h
@@ -22,6 +22,9 @@ struct omap2_mcspi_dev_attr {
22 22
23struct omap2_mcspi_device_config { 23struct omap2_mcspi_device_config {
24 unsigned turbo_mode:1; 24 unsigned turbo_mode:1;
25
26 /* toggle chip select after every word */
27 unsigned cs_per_word:1;
25}; 28};
26 29
27#endif 30#endif
diff --git a/include/linux/platform_data/tsl2563.h b/include/linux/platform_data/tsl2563.h
new file mode 100644
index 000000000000..c90d7a09dda7
--- /dev/null
+++ b/include/linux/platform_data/tsl2563.h
@@ -0,0 +1,8 @@
1#ifndef __LINUX_TSL2563_H
2#define __LINUX_TSL2563_H
3
4struct tsl2563_platform_data {
5 int cover_comp_gain;
6};
7
8#endif /* __LINUX_TSL2563_H */
diff --git a/include/linux/platform_data/usb-omap.h b/include/linux/platform_data/usb-omap.h
index ef65b67c56c3..e697c85ad3bc 100644
--- a/include/linux/platform_data/usb-omap.h
+++ b/include/linux/platform_data/usb-omap.h
@@ -55,13 +55,17 @@ struct ohci_hcd_omap_platform_data {
55}; 55};
56 56
57struct usbhs_omap_platform_data { 57struct usbhs_omap_platform_data {
58 enum usbhs_omap_port_mode port_mode[OMAP3_HS_USB_PORTS]; 58 enum usbhs_omap_port_mode port_mode[OMAP3_HS_USB_PORTS];
59 int reset_gpio_port[OMAP3_HS_USB_PORTS];
60 struct regulator *regulator[OMAP3_HS_USB_PORTS];
59 61
60 struct ehci_hcd_omap_platform_data *ehci_data; 62 struct ehci_hcd_omap_platform_data *ehci_data;
61 struct ohci_hcd_omap_platform_data *ohci_data; 63 struct ohci_hcd_omap_platform_data *ohci_data;
62 64
63 /* OMAP3 <= ES2.1 have a single ulpi bypass control bit */ 65 /* OMAP3 <= ES2.1 have a single ulpi bypass control bit */
64 unsigned single_ulpi_bypass:1; 66 unsigned single_ulpi_bypass:1;
67 unsigned es2_compatibility:1;
68 unsigned phy_reset:1;
65}; 69};
66 70
67/*-------------------------------------------------------------------------*/ 71/*-------------------------------------------------------------------------*/
diff --git a/include/linux/platform_data/usb3503.h b/include/linux/platform_data/usb3503.h
new file mode 100644
index 000000000000..85dcc709f7e9
--- /dev/null
+++ b/include/linux/platform_data/usb3503.h
@@ -0,0 +1,19 @@
1#ifndef __USB3503_H__
2#define __USB3503_H__
3
4#define USB3503_I2C_NAME "usb3503"
5
6enum usb3503_mode {
7 USB3503_MODE_UNKNOWN,
8 USB3503_MODE_HUB,
9 USB3503_MODE_STANDBY,
10};
11
12struct usb3503_platform_data {
13 enum usb3503_mode initial_mode;
14 int gpio_intn;
15 int gpio_connect;
16 int gpio_reset;
17};
18
19#endif
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index a9ded9a3c175..c082c71f7225 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -204,6 +204,24 @@ static inline void platform_set_drvdata(struct platform_device *pdev, void *data
204 module_driver(__platform_driver, platform_driver_register, \ 204 module_driver(__platform_driver, platform_driver_register, \
205 platform_driver_unregister) 205 platform_driver_unregister)
206 206
207/* module_platform_driver_probe() - Helper macro for drivers that don't do
208 * anything special in module init/exit. This eliminates a lot of
209 * boilerplate. Each module may only use this macro once, and
210 * calling it replaces module_init() and module_exit()
211 */
212#define module_platform_driver_probe(__platform_driver, __platform_probe) \
213static int __init __platform_driver##_init(void) \
214{ \
215 return platform_driver_probe(&(__platform_driver), \
216 __platform_probe); \
217} \
218module_init(__platform_driver##_init); \
219static void __exit __platform_driver##_exit(void) \
220{ \
221 platform_driver_unregister(&(__platform_driver)); \
222} \
223module_exit(__platform_driver##_exit);
224
207extern struct platform_device *platform_create_bundle(struct platform_driver *driver, 225extern struct platform_device *platform_create_bundle(struct platform_driver *driver,
208 int (*probe)(struct platform_device *), 226 int (*probe)(struct platform_device *),
209 struct resource *res, unsigned int n_res, 227 struct resource *res, unsigned int n_res,
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 03d7bb145311..97bcf23e045a 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -31,7 +31,6 @@
31/* 31/*
32 * Callbacks for platform drivers to implement. 32 * Callbacks for platform drivers to implement.
33 */ 33 */
34extern void (*pm_idle)(void);
35extern void (*pm_power_off)(void); 34extern void (*pm_power_off)(void);
36extern void (*pm_power_off_prepare)(void); 35extern void (*pm_power_off_prepare)(void);
37 36
diff --git a/include/linux/pm2301_charger.h b/include/linux/pm2301_charger.h
new file mode 100644
index 000000000000..fc3f026922ae
--- /dev/null
+++ b/include/linux/pm2301_charger.h
@@ -0,0 +1,61 @@
1/*
2 * PM2301 charger driver.
3 *
4 * Copyright (C) 2012 ST Ericsson Corporation
5 *
6 * Contact: Olivier LAUNAY (olivier.launay@stericsson.com
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * version 2 as published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA
21 */
22
23#ifndef __LINUX_PM2301_H
24#define __LINUX_PM2301_H
25
26/**
27 * struct pm2xxx_bm_charger_parameters - Charger specific parameters
28 * @ac_volt_max: maximum allowed AC charger voltage in mV
29 * @ac_curr_max: maximum allowed AC charger current in mA
30 */
31struct pm2xxx_bm_charger_parameters {
32 int ac_volt_max;
33 int ac_curr_max;
34};
35
36/**
37 * struct pm2xxx_bm_data - pm2xxx battery management data
38 * @enable_overshoot flag to enable VBAT overshoot control
39 * @chg_params charger parameters
40 */
41struct pm2xxx_bm_data {
42 bool enable_overshoot;
43 const struct pm2xxx_bm_charger_parameters *chg_params;
44};
45
46struct pm2xxx_charger_platform_data {
47 char **supplied_to;
48 size_t num_supplicants;
49 int i2c_bus;
50 const char *label;
51 int irq_number;
52 unsigned int lpn_gpio;
53 int irq_type;
54};
55
56struct pm2xxx_platform_data {
57 struct pm2xxx_charger_platform_data *wall_charger;
58 struct pm2xxx_bm_data *battery;
59};
60
61#endif /* __LINUX_PM2301_H */
diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h
index f271860c78d5..c785c215abfc 100644
--- a/include/linux/pm_runtime.h
+++ b/include/linux/pm_runtime.h
@@ -80,6 +80,12 @@ static inline bool pm_runtime_suspended(struct device *dev)
80 && !dev->power.disable_depth; 80 && !dev->power.disable_depth;
81} 81}
82 82
83static inline bool pm_runtime_active(struct device *dev)
84{
85 return dev->power.runtime_status == RPM_ACTIVE
86 || dev->power.disable_depth;
87}
88
83static inline bool pm_runtime_status_suspended(struct device *dev) 89static inline bool pm_runtime_status_suspended(struct device *dev)
84{ 90{
85 return dev->power.runtime_status == RPM_SUSPENDED; 91 return dev->power.runtime_status == RPM_SUSPENDED;
@@ -132,6 +138,7 @@ static inline void pm_runtime_put_noidle(struct device *dev) {}
132static inline bool device_run_wake(struct device *dev) { return false; } 138static inline bool device_run_wake(struct device *dev) { return false; }
133static inline void device_set_run_wake(struct device *dev, bool enable) {} 139static inline void device_set_run_wake(struct device *dev, bool enable) {}
134static inline bool pm_runtime_suspended(struct device *dev) { return false; } 140static inline bool pm_runtime_suspended(struct device *dev) { return false; }
141static inline bool pm_runtime_active(struct device *dev) { return true; }
135static inline bool pm_runtime_status_suspended(struct device *dev) { return false; } 142static inline bool pm_runtime_status_suspended(struct device *dev) { return false; }
136static inline bool pm_runtime_enabled(struct device *dev) { return false; } 143static inline bool pm_runtime_enabled(struct device *dev) { return false; }
137 144
diff --git a/include/linux/power/bq2415x_charger.h b/include/linux/power/bq2415x_charger.h
index 97a1665eaeaf..8dcc0f46fc0a 100644
--- a/include/linux/power/bq2415x_charger.h
+++ b/include/linux/power/bq2415x_charger.h
@@ -75,7 +75,8 @@
75 75
76/* Supported modes with maximal current limit */ 76/* Supported modes with maximal current limit */
77enum bq2415x_mode { 77enum bq2415x_mode {
78 BQ2415X_MODE_NONE, /* unknown or no charger (100mA) */ 78 BQ2415X_MODE_OFF, /* offline mode (charger disabled) */
79 BQ2415X_MODE_NONE, /* unknown charger (100mA) */
79 BQ2415X_MODE_HOST_CHARGER, /* usb host/hub charger (500mA) */ 80 BQ2415X_MODE_HOST_CHARGER, /* usb host/hub charger (500mA) */
80 BQ2415X_MODE_DEDICATED_CHARGER, /* dedicated charger (unlimited) */ 81 BQ2415X_MODE_DEDICATED_CHARGER, /* dedicated charger (unlimited) */
81 BQ2415X_MODE_BOOST, /* boost mode (charging disabled) */ 82 BQ2415X_MODE_BOOST, /* boost mode (charging disabled) */
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index 1f0ab90aff00..002a99f96331 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -54,6 +54,8 @@ enum {
54 POWER_SUPPLY_HEALTH_OVERVOLTAGE, 54 POWER_SUPPLY_HEALTH_OVERVOLTAGE,
55 POWER_SUPPLY_HEALTH_UNSPEC_FAILURE, 55 POWER_SUPPLY_HEALTH_UNSPEC_FAILURE,
56 POWER_SUPPLY_HEALTH_COLD, 56 POWER_SUPPLY_HEALTH_COLD,
57 POWER_SUPPLY_HEALTH_WATCHDOG_TIMER_EXPIRE,
58 POWER_SUPPLY_HEALTH_SAFETY_TIMER_EXPIRE,
57}; 59};
58 60
59enum { 61enum {
@@ -224,7 +226,7 @@ struct power_supply_info {
224 int use_for_apm; 226 int use_for_apm;
225}; 227};
226 228
227extern struct power_supply *power_supply_get_by_name(char *name); 229extern struct power_supply *power_supply_get_by_name(const char *name);
228extern void power_supply_changed(struct power_supply *psy); 230extern void power_supply_changed(struct power_supply *psy);
229extern int power_supply_am_i_supplied(struct power_supply *psy); 231extern int power_supply_am_i_supplied(struct power_supply *psy);
230extern int power_supply_set_battery_charged(struct power_supply *psy); 232extern int power_supply_set_battery_charged(struct power_supply *psy);
diff --git a/include/linux/pps_kernel.h b/include/linux/pps_kernel.h
index 0cc45ae1afd5..7db3eb93a079 100644
--- a/include/linux/pps_kernel.h
+++ b/include/linux/pps_kernel.h
@@ -43,7 +43,7 @@ struct pps_source_info {
43 int event, void *data); /* PPS echo function */ 43 int event, void *data); /* PPS echo function */
44 44
45 struct module *owner; 45 struct module *owner;
46 struct device *dev; 46 struct device *dev; /* Parent device for device_create */
47}; 47};
48 48
49struct pps_event_time { 49struct pps_event_time {
@@ -69,6 +69,7 @@ struct pps_device {
69 wait_queue_head_t queue; /* PPS event queue */ 69 wait_queue_head_t queue; /* PPS event queue */
70 70
71 unsigned int id; /* PPS source unique ID */ 71 unsigned int id; /* PPS source unique ID */
72 void const *lookup_cookie; /* pps_lookup_dev only */
72 struct cdev cdev; 73 struct cdev cdev;
73 struct device *dev; 74 struct device *dev;
74 struct fasync_struct *async_queue; /* fasync method */ 75 struct fasync_struct *async_queue; /* fasync method */
@@ -82,16 +83,26 @@ struct pps_device {
82extern struct device_attribute pps_attrs[]; 83extern struct device_attribute pps_attrs[];
83 84
84/* 85/*
86 * Internal functions.
87 *
88 * These are not actually part of the exported API, but this is a
89 * convenient header file to put them in.
90 */
91
92extern int pps_register_cdev(struct pps_device *pps);
93extern void pps_unregister_cdev(struct pps_device *pps);
94
95/*
85 * Exported functions 96 * Exported functions
86 */ 97 */
87 98
88extern struct pps_device *pps_register_source( 99extern struct pps_device *pps_register_source(
89 struct pps_source_info *info, int default_params); 100 struct pps_source_info *info, int default_params);
90extern void pps_unregister_source(struct pps_device *pps); 101extern void pps_unregister_source(struct pps_device *pps);
91extern int pps_register_cdev(struct pps_device *pps);
92extern void pps_unregister_cdev(struct pps_device *pps);
93extern void pps_event(struct pps_device *pps, 102extern void pps_event(struct pps_device *pps,
94 struct pps_event_time *ts, int event, void *data); 103 struct pps_event_time *ts, int event, void *data);
104/* Look up a pps device by magic cookie */
105struct pps_device *pps_lookup_dev(void const *cookie);
95 106
96static inline void timespec_to_pps_ktime(struct pps_ktime *kt, 107static inline void timespec_to_pps_ktime(struct pps_ktime *kt,
97 struct timespec ts) 108 struct timespec ts)
diff --git a/include/linux/printk.h b/include/linux/printk.h
index 9afc01e5a0a6..1249a54d17e0 100644
--- a/include/linux/printk.h
+++ b/include/linux/printk.h
@@ -98,9 +98,6 @@ int no_printk(const char *fmt, ...)
98extern asmlinkage __printf(1, 2) 98extern asmlinkage __printf(1, 2)
99void early_printk(const char *fmt, ...); 99void early_printk(const char *fmt, ...);
100 100
101extern int printk_needs_cpu(int cpu);
102extern void printk_tick(void);
103
104#ifdef CONFIG_PRINTK 101#ifdef CONFIG_PRINTK
105asmlinkage __printf(5, 0) 102asmlinkage __printf(5, 0)
106int vprintk_emit(int facility, int level, 103int vprintk_emit(int facility, int level,
@@ -255,6 +252,15 @@ extern void dump_stack(void) __cold;
255 printk_once(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) 252 printk_once(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
256#define pr_cont_once(fmt, ...) \ 253#define pr_cont_once(fmt, ...) \
257 printk_once(KERN_CONT pr_fmt(fmt), ##__VA_ARGS__) 254 printk_once(KERN_CONT pr_fmt(fmt), ##__VA_ARGS__)
255
256#if defined(DEBUG)
257#define pr_devel_once(fmt, ...) \
258 printk_once(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
259#else
260#define pr_devel_once(fmt, ...) \
261 no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
262#endif
263
258/* If you are writing a driver, please use dev_dbg instead */ 264/* If you are writing a driver, please use dev_dbg instead */
259#if defined(DEBUG) 265#if defined(DEBUG)
260#define pr_debug_once(fmt, ...) \ 266#define pr_debug_once(fmt, ...) \
@@ -298,6 +304,15 @@ extern void dump_stack(void) __cold;
298#define pr_info_ratelimited(fmt, ...) \ 304#define pr_info_ratelimited(fmt, ...) \
299 printk_ratelimited(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) 305 printk_ratelimited(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
300/* no pr_cont_ratelimited, don't do that... */ 306/* no pr_cont_ratelimited, don't do that... */
307
308#if defined(DEBUG)
309#define pr_devel_ratelimited(fmt, ...) \
310 printk_ratelimited(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
311#else
312#define pr_devel_ratelimited(fmt, ...) \
313 no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
314#endif
315
301/* If you are writing a driver, please use dev_dbg instead */ 316/* If you are writing a driver, please use dev_dbg instead */
302#if defined(DEBUG) 317#if defined(DEBUG)
303#define pr_debug_ratelimited(fmt, ...) \ 318#define pr_debug_ratelimited(fmt, ...) \
@@ -321,8 +336,13 @@ extern void hex_dump_to_buffer(const void *buf, size_t len,
321extern void print_hex_dump(const char *level, const char *prefix_str, 336extern void print_hex_dump(const char *level, const char *prefix_str,
322 int prefix_type, int rowsize, int groupsize, 337 int prefix_type, int rowsize, int groupsize,
323 const void *buf, size_t len, bool ascii); 338 const void *buf, size_t len, bool ascii);
339#if defined(CONFIG_DYNAMIC_DEBUG)
340#define print_hex_dump_bytes(prefix_str, prefix_type, buf, len) \
341 dynamic_hex_dump(prefix_str, prefix_type, 16, 1, buf, len, true)
342#else
324extern void print_hex_dump_bytes(const char *prefix_str, int prefix_type, 343extern void print_hex_dump_bytes(const char *prefix_str, int prefix_type,
325 const void *buf, size_t len); 344 const void *buf, size_t len);
345#endif /* defined(CONFIG_DYNAMIC_DEBUG) */
326#else 346#else
327static inline void print_hex_dump(const char *level, const char *prefix_str, 347static inline void print_hex_dump(const char *level, const char *prefix_str,
328 int prefix_type, int rowsize, int groupsize, 348 int prefix_type, int rowsize, int groupsize,
@@ -336,4 +356,16 @@ static inline void print_hex_dump_bytes(const char *prefix_str, int prefix_type,
336 356
337#endif 357#endif
338 358
359#if defined(CONFIG_DYNAMIC_DEBUG)
360#define print_hex_dump_debug(prefix_str, prefix_type, rowsize, \
361 groupsize, buf, len, ascii) \
362 dynamic_hex_dump(prefix_str, prefix_type, rowsize, \
363 groupsize, buf, len, ascii)
364#else
365#define print_hex_dump_debug(prefix_str, prefix_type, rowsize, \
366 groupsize, buf, len, ascii) \
367 print_hex_dump(KERN_DEBUG, prefix_str, prefix_type, rowsize, \
368 groupsize, buf, len, ascii)
369#endif /* defined(CONFIG_DYNAMIC_DEBUG) */
370
339#endif 371#endif
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index 32676b35d2f5..8307f2f94d86 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -127,7 +127,12 @@ extern void pid_ns_release_proc(struct pid_namespace *ns);
127 * proc_tty.c 127 * proc_tty.c
128 */ 128 */
129struct tty_driver; 129struct tty_driver;
130#ifdef CONFIG_TTY
130extern void proc_tty_init(void); 131extern void proc_tty_init(void);
132#else
133static inline void proc_tty_init(void)
134{ }
135#endif
131extern void proc_tty_register_driver(struct tty_driver *driver); 136extern void proc_tty_register_driver(struct tty_driver *driver);
132extern void proc_tty_unregister_driver(struct tty_driver *driver); 137extern void proc_tty_unregister_driver(struct tty_driver *driver);
133 138
@@ -171,9 +176,6 @@ static inline struct proc_dir_entry *create_proc_read_entry(const char *name,
171 return res; 176 return res;
172} 177}
173 178
174extern struct proc_dir_entry *proc_net_fops_create(struct net *net,
175 const char *name, umode_t mode, const struct file_operations *fops);
176extern void proc_net_remove(struct net *net, const char *name);
177extern struct proc_dir_entry *proc_net_mkdir(struct net *net, const char *name, 179extern struct proc_dir_entry *proc_net_mkdir(struct net *net, const char *name,
178 struct proc_dir_entry *parent); 180 struct proc_dir_entry *parent);
179 181
@@ -184,21 +186,15 @@ extern int proc_alloc_inum(unsigned int *pino);
184extern void proc_free_inum(unsigned int inum); 186extern void proc_free_inum(unsigned int inum);
185#else 187#else
186 188
187#define proc_net_fops_create(net, name, mode, fops) ({ (void)(mode), NULL; })
188static inline void proc_net_remove(struct net *net, const char *name) {}
189
190static inline void proc_flush_task(struct task_struct *task) 189static inline void proc_flush_task(struct task_struct *task)
191{ 190{
192} 191}
193 192
194static inline struct proc_dir_entry *create_proc_entry(const char *name, 193static inline struct proc_dir_entry *create_proc_entry(const char *name,
195 umode_t mode, struct proc_dir_entry *parent) { return NULL; } 194 umode_t mode, struct proc_dir_entry *parent) { return NULL; }
196static inline struct proc_dir_entry *proc_create(const char *name, 195
197 umode_t mode, struct proc_dir_entry *parent, 196#define proc_create(name, mode, parent, fops) ({ (void)(mode), NULL; })
198 const struct file_operations *proc_fops) 197
199{
200 return NULL;
201}
202static inline struct proc_dir_entry *proc_create_data(const char *name, 198static inline struct proc_dir_entry *proc_create_data(const char *name,
203 umode_t mode, struct proc_dir_entry *parent, 199 umode_t mode, struct proc_dir_entry *parent,
204 const struct file_operations *proc_fops, void *data) 200 const struct file_operations *proc_fops, void *data)
diff --git a/include/linux/profile.h b/include/linux/profile.h
index a0fc32279fc0..21123902366d 100644
--- a/include/linux/profile.h
+++ b/include/linux/profile.h
@@ -82,9 +82,6 @@ int task_handoff_unregister(struct notifier_block * n);
82int profile_event_register(enum profile_type, struct notifier_block * n); 82int profile_event_register(enum profile_type, struct notifier_block * n);
83int profile_event_unregister(enum profile_type, struct notifier_block * n); 83int profile_event_unregister(enum profile_type, struct notifier_block * n);
84 84
85int register_timer_hook(int (*hook)(struct pt_regs *));
86void unregister_timer_hook(int (*hook)(struct pt_regs *));
87
88struct pt_regs; 85struct pt_regs;
89 86
90#else 87#else
@@ -135,16 +132,6 @@ static inline int profile_event_unregister(enum profile_type t, struct notifier_
135#define profile_handoff_task(a) (0) 132#define profile_handoff_task(a) (0)
136#define profile_munmap(a) do { } while (0) 133#define profile_munmap(a) do { } while (0)
137 134
138static inline int register_timer_hook(int (*hook)(struct pt_regs *))
139{
140 return -ENOSYS;
141}
142
143static inline void unregister_timer_hook(int (*hook)(struct pt_regs *))
144{
145 return;
146}
147
148#endif /* CONFIG_PROFILING */ 135#endif /* CONFIG_PROFILING */
149 136
150#endif /* _LINUX_PROFILE_H */ 137#endif /* _LINUX_PROFILE_H */
diff --git a/include/linux/pstore.h b/include/linux/pstore.h
index 1788909d9a99..75d01760c911 100644
--- a/include/linux/pstore.h
+++ b/include/linux/pstore.h
@@ -68,12 +68,18 @@ struct pstore_info {
68 68
69#ifdef CONFIG_PSTORE 69#ifdef CONFIG_PSTORE
70extern int pstore_register(struct pstore_info *); 70extern int pstore_register(struct pstore_info *);
71extern bool pstore_cannot_block_path(enum kmsg_dump_reason reason);
71#else 72#else
72static inline int 73static inline int
73pstore_register(struct pstore_info *psi) 74pstore_register(struct pstore_info *psi)
74{ 75{
75 return -ENODEV; 76 return -ENODEV;
76} 77}
78static inline bool
79pstore_cannot_block_path(enum kmsg_dump_reason reason)
80{
81 return false;
82}
77#endif 83#endif
78 84
79#endif /*_LINUX_PSTORE_H*/ 85#endif /*_LINUX_PSTORE_H*/
diff --git a/include/linux/pxa2xx_ssp.h b/include/linux/pxa2xx_ssp.h
index f36632061c66..467cc6307b62 100644
--- a/include/linux/pxa2xx_ssp.h
+++ b/include/linux/pxa2xx_ssp.h
@@ -155,6 +155,14 @@
155#define SSACD_ACDS(x) ((x) << 0) /* Audio clock divider select */ 155#define SSACD_ACDS(x) ((x) << 0) /* Audio clock divider select */
156#define SSACD_SCDX8 (1 << 7) /* SYSCLK division ratio select */ 156#define SSACD_SCDX8 (1 << 7) /* SYSCLK division ratio select */
157 157
158/* LPSS SSP */
159#define SSITF 0x44 /* TX FIFO trigger level */
160#define SSITF_TxLoThresh(x) (((x) - 1) << 8)
161#define SSITF_TxHiThresh(x) ((x) - 1)
162
163#define SSIRF 0x48 /* RX FIFO trigger level */
164#define SSIRF_RxThresh(x) ((x) - 1)
165
158enum pxa_ssp_type { 166enum pxa_ssp_type {
159 SSP_UNDEFINED = 0, 167 SSP_UNDEFINED = 0,
160 PXA25x_SSP, /* pxa 210, 250, 255, 26x */ 168 PXA25x_SSP, /* pxa 210, 250, 255, 26x */
@@ -164,6 +172,7 @@ enum pxa_ssp_type {
164 PXA168_SSP, 172 PXA168_SSP,
165 PXA910_SSP, 173 PXA910_SSP,
166 CE4100_SSP, 174 CE4100_SSP,
175 LPSS_SSP,
167}; 176};
168 177
169struct ssp_device { 178struct ssp_device {
@@ -206,6 +215,15 @@ static inline u32 pxa_ssp_read_reg(struct ssp_device *dev, u32 reg)
206 return __raw_readl(dev->mmio_base + reg); 215 return __raw_readl(dev->mmio_base + reg);
207} 216}
208 217
218#ifdef CONFIG_ARCH_PXA
209struct ssp_device *pxa_ssp_request(int port, const char *label); 219struct ssp_device *pxa_ssp_request(int port, const char *label);
210void pxa_ssp_free(struct ssp_device *); 220void pxa_ssp_free(struct ssp_device *);
221#else
222static inline struct ssp_device *pxa_ssp_request(int port, const char *label)
223{
224 return NULL;
225}
226static inline void pxa_ssp_free(struct ssp_device *ssp) {}
227#endif
228
211#endif 229#endif
diff --git a/include/linux/random.h b/include/linux/random.h
index d9846088c2c5..347ce553a306 100644
--- a/include/linux/random.h
+++ b/include/linux/random.h
@@ -74,4 +74,10 @@ static inline int arch_get_random_int(unsigned int *v)
74} 74}
75#endif 75#endif
76 76
77/* Pseudo random number generator from numerical recipes. */
78static inline u32 next_pseudo_random32(u32 seed)
79{
80 return seed * 1664525 + 1013904223;
81}
82
77#endif /* _LINUX_RANDOM_H */ 83#endif /* _LINUX_RANDOM_H */
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 275aa3f1062d..b758ce17b309 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -53,7 +53,10 @@ extern int rcutorture_runnable; /* for sysctl */
53extern void rcutorture_record_test_transition(void); 53extern void rcutorture_record_test_transition(void);
54extern void rcutorture_record_progress(unsigned long vernum); 54extern void rcutorture_record_progress(unsigned long vernum);
55extern void do_trace_rcu_torture_read(char *rcutorturename, 55extern void do_trace_rcu_torture_read(char *rcutorturename,
56 struct rcu_head *rhp); 56 struct rcu_head *rhp,
57 unsigned long secs,
58 unsigned long c_old,
59 unsigned long c);
57#else 60#else
58static inline void rcutorture_record_test_transition(void) 61static inline void rcutorture_record_test_transition(void)
59{ 62{
@@ -63,9 +66,13 @@ static inline void rcutorture_record_progress(unsigned long vernum)
63} 66}
64#ifdef CONFIG_RCU_TRACE 67#ifdef CONFIG_RCU_TRACE
65extern void do_trace_rcu_torture_read(char *rcutorturename, 68extern void do_trace_rcu_torture_read(char *rcutorturename,
66 struct rcu_head *rhp); 69 struct rcu_head *rhp,
70 unsigned long secs,
71 unsigned long c_old,
72 unsigned long c);
67#else 73#else
68#define do_trace_rcu_torture_read(rcutorturename, rhp) do { } while (0) 74#define do_trace_rcu_torture_read(rcutorturename, rhp, secs, c_old, c) \
75 do { } while (0)
69#endif 76#endif
70#endif 77#endif
71 78
@@ -749,7 +756,7 @@ static inline void rcu_preempt_sleep_check(void)
749 * preemptible RCU implementations (TREE_PREEMPT_RCU and TINY_PREEMPT_RCU) 756 * preemptible RCU implementations (TREE_PREEMPT_RCU and TINY_PREEMPT_RCU)
750 * in CONFIG_PREEMPT kernel builds, RCU read-side critical sections may 757 * in CONFIG_PREEMPT kernel builds, RCU read-side critical sections may
751 * be preempted, but explicit blocking is illegal. Finally, in preemptible 758 * be preempted, but explicit blocking is illegal. Finally, in preemptible
752 * RCU implementations in real-time (CONFIG_PREEMPT_RT) kernel builds, 759 * RCU implementations in real-time (with -rt patchset) kernel builds,
753 * RCU read-side critical sections may be preempted and they may also 760 * RCU read-side critical sections may be preempted and they may also
754 * block, but only when acquiring spinlocks that are subject to priority 761 * block, but only when acquiring spinlocks that are subject to priority
755 * inheritance. 762 * inheritance.
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index b7e95bf942c9..bf77dfdabef9 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -28,7 +28,8 @@ struct regmap_range_cfg;
28enum regcache_type { 28enum regcache_type {
29 REGCACHE_NONE, 29 REGCACHE_NONE,
30 REGCACHE_RBTREE, 30 REGCACHE_RBTREE,
31 REGCACHE_COMPRESSED 31 REGCACHE_COMPRESSED,
32 REGCACHE_FLAT,
32}; 33};
33 34
34/** 35/**
@@ -127,7 +128,18 @@ typedef void (*regmap_unlock)(void *);
127 * @lock_arg: this field is passed as the only argument of lock/unlock 128 * @lock_arg: this field is passed as the only argument of lock/unlock
128 * functions (ignored in case regular lock/unlock functions 129 * functions (ignored in case regular lock/unlock functions
129 * are not overridden). 130 * are not overridden).
130 * 131 * @reg_read: Optional callback that if filled will be used to perform
132 * all the reads from the registers. Should only be provided for
133 * devices whos read operation cannot be represented as a simple read
134 * operation on a bus such as SPI, I2C, etc. Most of the devices do
135 * not need this.
136 * @reg_write: Same as above for writing.
137 * @fast_io: Register IO is fast. Use a spinlock instead of a mutex
138 * to perform locking. This field is ignored if custom lock/unlock
139 * functions are used (see fields lock/unlock of struct regmap_config).
140 * This field is a duplicate of a similar file in
141 * 'struct regmap_bus' and serves exact same purpose.
142 * Use it only for "no-bus" cases.
131 * @max_register: Optional, specifies the maximum valid register index. 143 * @max_register: Optional, specifies the maximum valid register index.
132 * @wr_table: Optional, points to a struct regmap_access_table specifying 144 * @wr_table: Optional, points to a struct regmap_access_table specifying
133 * valid ranges for write access. 145 * valid ranges for write access.
@@ -177,6 +189,11 @@ struct regmap_config {
177 regmap_unlock unlock; 189 regmap_unlock unlock;
178 void *lock_arg; 190 void *lock_arg;
179 191
192 int (*reg_read)(void *context, unsigned int reg, unsigned int *val);
193 int (*reg_write)(void *context, unsigned int reg, unsigned int val);
194
195 bool fast_io;
196
180 unsigned int max_register; 197 unsigned int max_register;
181 const struct regmap_access_table *wr_table; 198 const struct regmap_access_table *wr_table;
182 const struct regmap_access_table *rd_table; 199 const struct regmap_access_table *rd_table;
@@ -235,14 +252,21 @@ struct regmap_range_cfg {
235 unsigned int window_len; 252 unsigned int window_len;
236}; 253};
237 254
255struct regmap_async;
256
238typedef int (*regmap_hw_write)(void *context, const void *data, 257typedef int (*regmap_hw_write)(void *context, const void *data,
239 size_t count); 258 size_t count);
240typedef int (*regmap_hw_gather_write)(void *context, 259typedef int (*regmap_hw_gather_write)(void *context,
241 const void *reg, size_t reg_len, 260 const void *reg, size_t reg_len,
242 const void *val, size_t val_len); 261 const void *val, size_t val_len);
262typedef int (*regmap_hw_async_write)(void *context,
263 const void *reg, size_t reg_len,
264 const void *val, size_t val_len,
265 struct regmap_async *async);
243typedef int (*regmap_hw_read)(void *context, 266typedef int (*regmap_hw_read)(void *context,
244 const void *reg_buf, size_t reg_size, 267 const void *reg_buf, size_t reg_size,
245 void *val_buf, size_t val_size); 268 void *val_buf, size_t val_size);
269typedef struct regmap_async *(*regmap_hw_async_alloc)(void);
246typedef void (*regmap_hw_free_context)(void *context); 270typedef void (*regmap_hw_free_context)(void *context);
247 271
248/** 272/**
@@ -255,8 +279,11 @@ typedef void (*regmap_hw_free_context)(void *context);
255 * @write: Write operation. 279 * @write: Write operation.
256 * @gather_write: Write operation with split register/value, return -ENOTSUPP 280 * @gather_write: Write operation with split register/value, return -ENOTSUPP
257 * if not implemented on a given device. 281 * if not implemented on a given device.
282 * @async_write: Write operation which completes asynchronously, optional and
283 * must serialise with respect to non-async I/O.
258 * @read: Read operation. Data is returned in the buffer used to transmit 284 * @read: Read operation. Data is returned in the buffer used to transmit
259 * data. 285 * data.
286 * @async_alloc: Allocate a regmap_async() structure.
260 * @read_flag_mask: Mask to be set in the top byte of the register when doing 287 * @read_flag_mask: Mask to be set in the top byte of the register when doing
261 * a read. 288 * a read.
262 * @reg_format_endian_default: Default endianness for formatted register 289 * @reg_format_endian_default: Default endianness for formatted register
@@ -265,13 +292,16 @@ typedef void (*regmap_hw_free_context)(void *context);
265 * @val_format_endian_default: Default endianness for formatted register 292 * @val_format_endian_default: Default endianness for formatted register
266 * values. Used when the regmap_config specifies DEFAULT. If this is 293 * values. Used when the regmap_config specifies DEFAULT. If this is
267 * DEFAULT, BIG is assumed. 294 * DEFAULT, BIG is assumed.
295 * @async_size: Size of struct used for async work.
268 */ 296 */
269struct regmap_bus { 297struct regmap_bus {
270 bool fast_io; 298 bool fast_io;
271 regmap_hw_write write; 299 regmap_hw_write write;
272 regmap_hw_gather_write gather_write; 300 regmap_hw_gather_write gather_write;
301 regmap_hw_async_write async_write;
273 regmap_hw_read read; 302 regmap_hw_read read;
274 regmap_hw_free_context free_context; 303 regmap_hw_free_context free_context;
304 regmap_hw_async_alloc async_alloc;
275 u8 read_flag_mask; 305 u8 read_flag_mask;
276 enum regmap_endian reg_format_endian_default; 306 enum regmap_endian reg_format_endian_default;
277 enum regmap_endian val_format_endian_default; 307 enum regmap_endian val_format_endian_default;
@@ -285,9 +315,9 @@ struct regmap *regmap_init_i2c(struct i2c_client *i2c,
285 const struct regmap_config *config); 315 const struct regmap_config *config);
286struct regmap *regmap_init_spi(struct spi_device *dev, 316struct regmap *regmap_init_spi(struct spi_device *dev,
287 const struct regmap_config *config); 317 const struct regmap_config *config);
288struct regmap *regmap_init_mmio(struct device *dev, 318struct regmap *regmap_init_mmio_clk(struct device *dev, const char *clk_id,
289 void __iomem *regs, 319 void __iomem *regs,
290 const struct regmap_config *config); 320 const struct regmap_config *config);
291 321
292struct regmap *devm_regmap_init(struct device *dev, 322struct regmap *devm_regmap_init(struct device *dev,
293 const struct regmap_bus *bus, 323 const struct regmap_bus *bus,
@@ -297,9 +327,44 @@ struct regmap *devm_regmap_init_i2c(struct i2c_client *i2c,
297 const struct regmap_config *config); 327 const struct regmap_config *config);
298struct regmap *devm_regmap_init_spi(struct spi_device *dev, 328struct regmap *devm_regmap_init_spi(struct spi_device *dev,
299 const struct regmap_config *config); 329 const struct regmap_config *config);
300struct regmap *devm_regmap_init_mmio(struct device *dev, 330struct regmap *devm_regmap_init_mmio_clk(struct device *dev, const char *clk_id,
301 void __iomem *regs, 331 void __iomem *regs,
302 const struct regmap_config *config); 332 const struct regmap_config *config);
333
334/**
335 * regmap_init_mmio(): Initialise register map
336 *
337 * @dev: Device that will be interacted with
338 * @regs: Pointer to memory-mapped IO region
339 * @config: Configuration for register map
340 *
341 * The return value will be an ERR_PTR() on error or a valid pointer to
342 * a struct regmap.
343 */
344static inline struct regmap *regmap_init_mmio(struct device *dev,
345 void __iomem *regs,
346 const struct regmap_config *config)
347{
348 return regmap_init_mmio_clk(dev, NULL, regs, config);
349}
350
351/**
352 * devm_regmap_init_mmio(): Initialise managed register map
353 *
354 * @dev: Device that will be interacted with
355 * @regs: Pointer to memory-mapped IO region
356 * @config: Configuration for register map
357 *
358 * The return value will be an ERR_PTR() on error or a valid pointer
359 * to a struct regmap. The regmap will be automatically freed by the
360 * device management code.
361 */
362static inline struct regmap *devm_regmap_init_mmio(struct device *dev,
363 void __iomem *regs,
364 const struct regmap_config *config)
365{
366 return devm_regmap_init_mmio_clk(dev, NULL, regs, config);
367}
303 368
304void regmap_exit(struct regmap *map); 369void regmap_exit(struct regmap *map);
305int regmap_reinit_cache(struct regmap *map, 370int regmap_reinit_cache(struct regmap *map,
@@ -310,6 +375,8 @@ int regmap_raw_write(struct regmap *map, unsigned int reg,
310 const void *val, size_t val_len); 375 const void *val, size_t val_len);
311int regmap_bulk_write(struct regmap *map, unsigned int reg, const void *val, 376int regmap_bulk_write(struct regmap *map, unsigned int reg, const void *val,
312 size_t val_count); 377 size_t val_count);
378int regmap_raw_write_async(struct regmap *map, unsigned int reg,
379 const void *val, size_t val_len);
313int regmap_read(struct regmap *map, unsigned int reg, unsigned int *val); 380int regmap_read(struct regmap *map, unsigned int reg, unsigned int *val);
314int regmap_raw_read(struct regmap *map, unsigned int reg, 381int regmap_raw_read(struct regmap *map, unsigned int reg,
315 void *val, size_t val_len); 382 void *val, size_t val_len);
@@ -321,6 +388,7 @@ int regmap_update_bits_check(struct regmap *map, unsigned int reg,
321 unsigned int mask, unsigned int val, 388 unsigned int mask, unsigned int val,
322 bool *change); 389 bool *change);
323int regmap_get_val_bytes(struct regmap *map); 390int regmap_get_val_bytes(struct regmap *map);
391int regmap_async_complete(struct regmap *map);
324 392
325int regcache_sync(struct regmap *map); 393int regcache_sync(struct regmap *map);
326int regcache_sync_region(struct regmap *map, unsigned int min, 394int regcache_sync_region(struct regmap *map, unsigned int min,
@@ -381,6 +449,7 @@ struct regmap_irq_chip {
381 unsigned int wake_base; 449 unsigned int wake_base;
382 unsigned int irq_reg_stride; 450 unsigned int irq_reg_stride;
383 unsigned int mask_invert; 451 unsigned int mask_invert;
452 unsigned int wake_invert;
384 bool runtime_pm; 453 bool runtime_pm;
385 454
386 int num_regs; 455 int num_regs;
@@ -422,6 +491,13 @@ static inline int regmap_raw_write(struct regmap *map, unsigned int reg,
422 return -EINVAL; 491 return -EINVAL;
423} 492}
424 493
494static inline int regmap_raw_write_async(struct regmap *map, unsigned int reg,
495 const void *val, size_t val_len)
496{
497 WARN_ONCE(1, "regmap API is disabled");
498 return -EINVAL;
499}
500
425static inline int regmap_bulk_write(struct regmap *map, unsigned int reg, 501static inline int regmap_bulk_write(struct regmap *map, unsigned int reg,
426 const void *val, size_t val_count) 502 const void *val, size_t val_count)
427{ 503{
@@ -500,6 +576,11 @@ static inline void regcache_mark_dirty(struct regmap *map)
500 WARN_ONCE(1, "regmap API is disabled"); 576 WARN_ONCE(1, "regmap API is disabled");
501} 577}
502 578
579static inline void regmap_async_complete(struct regmap *map)
580{
581 WARN_ONCE(1, "regmap API is disabled");
582}
583
503static inline int regmap_register_patch(struct regmap *map, 584static inline int regmap_register_patch(struct regmap *map,
504 const struct reg_default *regs, 585 const struct reg_default *regs,
505 int num_regs) 586 int num_regs)
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
index d10bb0f39c5e..23070fd83872 100644
--- a/include/linux/regulator/driver.h
+++ b/include/linux/regulator/driver.h
@@ -193,6 +193,10 @@ enum regulator_type {
193 * 193 *
194 * @vsel_reg: Register for selector when using regulator_regmap_X_voltage_ 194 * @vsel_reg: Register for selector when using regulator_regmap_X_voltage_
195 * @vsel_mask: Mask for register bitfield used for selector 195 * @vsel_mask: Mask for register bitfield used for selector
196 * @apply_reg: Register for initiate voltage change on the output when
197 * using regulator_set_voltage_sel_regmap
198 * @apply_bit: Register bitfield used for initiate voltage change on the
199 * output when using regulator_set_voltage_sel_regmap
196 * @enable_reg: Register for control when using regmap enable/disable ops 200 * @enable_reg: Register for control when using regmap enable/disable ops
197 * @enable_mask: Mask for control when using regmap enable/disable ops 201 * @enable_mask: Mask for control when using regmap enable/disable ops
198 * 202 *
@@ -218,6 +222,8 @@ struct regulator_desc {
218 222
219 unsigned int vsel_reg; 223 unsigned int vsel_reg;
220 unsigned int vsel_mask; 224 unsigned int vsel_mask;
225 unsigned int apply_reg;
226 unsigned int apply_bit;
221 unsigned int enable_reg; 227 unsigned int enable_reg;
222 unsigned int enable_mask; 228 unsigned int enable_mask;
223 unsigned int bypass_reg; 229 unsigned int bypass_reg;
diff --git a/include/linux/ring_buffer.h b/include/linux/ring_buffer.h
index 519777e3fa01..1342e69542f3 100644
--- a/include/linux/ring_buffer.h
+++ b/include/linux/ring_buffer.h
@@ -167,6 +167,7 @@ unsigned long ring_buffer_entries_cpu(struct ring_buffer *buffer, int cpu);
167unsigned long ring_buffer_overrun_cpu(struct ring_buffer *buffer, int cpu); 167unsigned long ring_buffer_overrun_cpu(struct ring_buffer *buffer, int cpu);
168unsigned long ring_buffer_commit_overrun_cpu(struct ring_buffer *buffer, int cpu); 168unsigned long ring_buffer_commit_overrun_cpu(struct ring_buffer *buffer, int cpu);
169unsigned long ring_buffer_dropped_events_cpu(struct ring_buffer *buffer, int cpu); 169unsigned long ring_buffer_dropped_events_cpu(struct ring_buffer *buffer, int cpu);
170unsigned long ring_buffer_read_events_cpu(struct ring_buffer *buffer, int cpu);
170 171
171u64 ring_buffer_time_stamp(struct ring_buffer *buffer, int cpu); 172u64 ring_buffer_time_stamp(struct ring_buffer *buffer, int cpu);
172void ring_buffer_normalize_time_stamp(struct ring_buffer *buffer, 173void ring_buffer_normalize_time_stamp(struct ring_buffer *buffer,
diff --git a/include/linux/rtc.h b/include/linux/rtc.h
index 9531845c419f..580b24c8b8ca 100644
--- a/include/linux/rtc.h
+++ b/include/linux/rtc.h
@@ -138,6 +138,7 @@ extern void rtc_device_unregister(struct rtc_device *rtc);
138extern int rtc_read_time(struct rtc_device *rtc, struct rtc_time *tm); 138extern int rtc_read_time(struct rtc_device *rtc, struct rtc_time *tm);
139extern int rtc_set_time(struct rtc_device *rtc, struct rtc_time *tm); 139extern int rtc_set_time(struct rtc_device *rtc, struct rtc_time *tm);
140extern int rtc_set_mmss(struct rtc_device *rtc, unsigned long secs); 140extern int rtc_set_mmss(struct rtc_device *rtc, unsigned long secs);
141extern int rtc_set_ntp_time(struct timespec now);
141int __rtc_read_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm); 142int __rtc_read_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm);
142extern int rtc_read_alarm(struct rtc_device *rtc, 143extern int rtc_read_alarm(struct rtc_device *rtc,
143 struct rtc_wkalrm *alrm); 144 struct rtc_wkalrm *alrm);
@@ -148,7 +149,7 @@ extern int rtc_initialize_alarm(struct rtc_device *rtc,
148extern void rtc_update_irq(struct rtc_device *rtc, 149extern void rtc_update_irq(struct rtc_device *rtc,
149 unsigned long num, unsigned long events); 150 unsigned long num, unsigned long events);
150 151
151extern struct rtc_device *rtc_class_open(char *name); 152extern struct rtc_device *rtc_class_open(const char *name);
152extern void rtc_class_close(struct rtc_device *rtc); 153extern void rtc_class_close(struct rtc_device *rtc);
153 154
154extern int rtc_irq_register(struct rtc_device *rtc, 155extern int rtc_irq_register(struct rtc_device *rtc,
diff --git a/include/linux/sched.h b/include/linux/sched.h
index d2112477ff5e..e4112aad2964 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -304,19 +304,6 @@ static inline void lockup_detector_init(void)
304} 304}
305#endif 305#endif
306 306
307#ifdef CONFIG_DETECT_HUNG_TASK
308extern unsigned int sysctl_hung_task_panic;
309extern unsigned long sysctl_hung_task_check_count;
310extern unsigned long sysctl_hung_task_timeout_secs;
311extern unsigned long sysctl_hung_task_warnings;
312extern int proc_dohung_task_timeout_secs(struct ctl_table *table, int write,
313 void __user *buffer,
314 size_t *lenp, loff_t *ppos);
315#else
316/* Avoid need for ifdefs elsewhere in the code */
317enum { sysctl_hung_task_timeout_secs = 0 };
318#endif
319
320/* Attach to any functions which should be ignored in wchan output. */ 307/* Attach to any functions which should be ignored in wchan output. */
321#define __sched __attribute__((__section__(".sched.text"))) 308#define __sched __attribute__((__section__(".sched.text")))
322 309
@@ -338,23 +325,6 @@ extern int mutex_spin_on_owner(struct mutex *lock, struct task_struct *owner);
338struct nsproxy; 325struct nsproxy;
339struct user_namespace; 326struct user_namespace;
340 327
341/*
342 * Default maximum number of active map areas, this limits the number of vmas
343 * per mm struct. Users can overwrite this number by sysctl but there is a
344 * problem.
345 *
346 * When a program's coredump is generated as ELF format, a section is created
347 * per a vma. In ELF, the number of sections is represented in unsigned short.
348 * This means the number of sections should be smaller than 65535 at coredump.
349 * Because the kernel adds some informative sections to a image of program at
350 * generating coredump, we need some margin. The number of extra sections is
351 * 1-3 now and depends on arch. We use "5" as safe margin, here.
352 */
353#define MAPCOUNT_ELF_CORE_MARGIN (5)
354#define DEFAULT_MAX_MAP_COUNT (USHRT_MAX - MAPCOUNT_ELF_CORE_MARGIN)
355
356extern int sysctl_max_map_count;
357
358#include <linux/aio.h> 328#include <linux/aio.h>
359 329
360#ifdef CONFIG_MMU 330#ifdef CONFIG_MMU
@@ -1194,6 +1164,7 @@ struct sched_entity {
1194 /* rq "owned" by this entity/group: */ 1164 /* rq "owned" by this entity/group: */
1195 struct cfs_rq *my_q; 1165 struct cfs_rq *my_q;
1196#endif 1166#endif
1167
1197/* 1168/*
1198 * Load-tracking only depends on SMP, FAIR_GROUP_SCHED dependency below may be 1169 * Load-tracking only depends on SMP, FAIR_GROUP_SCHED dependency below may be
1199 * removed when useful for applications beyond shares distribution (e.g. 1170 * removed when useful for applications beyond shares distribution (e.g.
@@ -1208,6 +1179,7 @@ struct sched_entity {
1208struct sched_rt_entity { 1179struct sched_rt_entity {
1209 struct list_head run_list; 1180 struct list_head run_list;
1210 unsigned long timeout; 1181 unsigned long timeout;
1182 unsigned long watchdog_stamp;
1211 unsigned int time_slice; 1183 unsigned int time_slice;
1212 1184
1213 struct sched_rt_entity *back; 1185 struct sched_rt_entity *back;
@@ -1220,11 +1192,6 @@ struct sched_rt_entity {
1220#endif 1192#endif
1221}; 1193};
1222 1194
1223/*
1224 * default timeslice is 100 msecs (used only for SCHED_RR tasks).
1225 * Timeslices get refilled after they expire.
1226 */
1227#define RR_TIMESLICE (100 * HZ / 1000)
1228 1195
1229struct rcu_node; 1196struct rcu_node;
1230 1197
@@ -1368,6 +1335,15 @@ struct task_struct {
1368#ifndef CONFIG_VIRT_CPU_ACCOUNTING 1335#ifndef CONFIG_VIRT_CPU_ACCOUNTING
1369 struct cputime prev_cputime; 1336 struct cputime prev_cputime;
1370#endif 1337#endif
1338#ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN
1339 seqlock_t vtime_seqlock;
1340 unsigned long long vtime_snap;
1341 enum {
1342 VTIME_SLEEPING = 0,
1343 VTIME_USER,
1344 VTIME_SYS,
1345 } vtime_snap_whence;
1346#endif
1371 unsigned long nvcsw, nivcsw; /* context switch counts */ 1347 unsigned long nvcsw, nivcsw; /* context switch counts */
1372 struct timespec start_time; /* monotonic time */ 1348 struct timespec start_time; /* monotonic time */
1373 struct timespec real_start_time; /* boot based time */ 1349 struct timespec real_start_time; /* boot based time */
@@ -1622,37 +1598,6 @@ static inline void set_numabalancing_state(bool enabled)
1622} 1598}
1623#endif 1599#endif
1624 1600
1625/*
1626 * Priority of a process goes from 0..MAX_PRIO-1, valid RT
1627 * priority is 0..MAX_RT_PRIO-1, and SCHED_NORMAL/SCHED_BATCH
1628 * tasks are in the range MAX_RT_PRIO..MAX_PRIO-1. Priority
1629 * values are inverted: lower p->prio value means higher priority.
1630 *
1631 * The MAX_USER_RT_PRIO value allows the actual maximum
1632 * RT priority to be separate from the value exported to
1633 * user-space. This allows kernel threads to set their
1634 * priority to a value higher than any user task. Note:
1635 * MAX_RT_PRIO must not be smaller than MAX_USER_RT_PRIO.
1636 */
1637
1638#define MAX_USER_RT_PRIO 100
1639#define MAX_RT_PRIO MAX_USER_RT_PRIO
1640
1641#define MAX_PRIO (MAX_RT_PRIO + 40)
1642#define DEFAULT_PRIO (MAX_RT_PRIO + 20)
1643
1644static inline int rt_prio(int prio)
1645{
1646 if (unlikely(prio < MAX_RT_PRIO))
1647 return 1;
1648 return 0;
1649}
1650
1651static inline int rt_task(struct task_struct *p)
1652{
1653 return rt_prio(p->prio);
1654}
1655
1656static inline struct pid *task_pid(struct task_struct *task) 1601static inline struct pid *task_pid(struct task_struct *task)
1657{ 1602{
1658 return task->pids[PIDTYPE_PID].pid; 1603 return task->pids[PIDTYPE_PID].pid;
@@ -1792,6 +1737,37 @@ static inline void put_task_struct(struct task_struct *t)
1792 __put_task_struct(t); 1737 __put_task_struct(t);
1793} 1738}
1794 1739
1740#ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN
1741extern void task_cputime(struct task_struct *t,
1742 cputime_t *utime, cputime_t *stime);
1743extern void task_cputime_scaled(struct task_struct *t,
1744 cputime_t *utimescaled, cputime_t *stimescaled);
1745extern cputime_t task_gtime(struct task_struct *t);
1746#else
1747static inline void task_cputime(struct task_struct *t,
1748 cputime_t *utime, cputime_t *stime)
1749{
1750 if (utime)
1751 *utime = t->utime;
1752 if (stime)
1753 *stime = t->stime;
1754}
1755
1756static inline void task_cputime_scaled(struct task_struct *t,
1757 cputime_t *utimescaled,
1758 cputime_t *stimescaled)
1759{
1760 if (utimescaled)
1761 *utimescaled = t->utimescaled;
1762 if (stimescaled)
1763 *stimescaled = t->stimescaled;
1764}
1765
1766static inline cputime_t task_gtime(struct task_struct *t)
1767{
1768 return t->gtime;
1769}
1770#endif
1795extern void task_cputime_adjusted(struct task_struct *p, cputime_t *ut, cputime_t *st); 1771extern void task_cputime_adjusted(struct task_struct *p, cputime_t *ut, cputime_t *st);
1796extern void thread_group_cputime_adjusted(struct task_struct *p, cputime_t *ut, cputime_t *st); 1772extern void thread_group_cputime_adjusted(struct task_struct *p, cputime_t *ut, cputime_t *st);
1797 1773
@@ -2033,58 +2009,7 @@ extern void wake_up_idle_cpu(int cpu);
2033static inline void wake_up_idle_cpu(int cpu) { } 2009static inline void wake_up_idle_cpu(int cpu) { }
2034#endif 2010#endif
2035 2011
2036extern unsigned int sysctl_sched_latency;
2037extern unsigned int sysctl_sched_min_granularity;
2038extern unsigned int sysctl_sched_wakeup_granularity;
2039extern unsigned int sysctl_sched_child_runs_first;
2040
2041enum sched_tunable_scaling {
2042 SCHED_TUNABLESCALING_NONE,
2043 SCHED_TUNABLESCALING_LOG,
2044 SCHED_TUNABLESCALING_LINEAR,
2045 SCHED_TUNABLESCALING_END,
2046};
2047extern enum sched_tunable_scaling sysctl_sched_tunable_scaling;
2048
2049extern unsigned int sysctl_numa_balancing_scan_delay;
2050extern unsigned int sysctl_numa_balancing_scan_period_min;
2051extern unsigned int sysctl_numa_balancing_scan_period_max;
2052extern unsigned int sysctl_numa_balancing_scan_period_reset;
2053extern unsigned int sysctl_numa_balancing_scan_size;
2054extern unsigned int sysctl_numa_balancing_settle_count;
2055
2056#ifdef CONFIG_SCHED_DEBUG
2057extern unsigned int sysctl_sched_migration_cost;
2058extern unsigned int sysctl_sched_nr_migrate;
2059extern unsigned int sysctl_sched_time_avg;
2060extern unsigned int sysctl_timer_migration;
2061extern unsigned int sysctl_sched_shares_window;
2062
2063int sched_proc_update_handler(struct ctl_table *table, int write,
2064 void __user *buffer, size_t *length,
2065 loff_t *ppos);
2066#endif
2067#ifdef CONFIG_SCHED_DEBUG
2068static inline unsigned int get_sysctl_timer_migration(void)
2069{
2070 return sysctl_timer_migration;
2071}
2072#else
2073static inline unsigned int get_sysctl_timer_migration(void)
2074{
2075 return 1;
2076}
2077#endif
2078extern unsigned int sysctl_sched_rt_period;
2079extern int sysctl_sched_rt_runtime;
2080
2081int sched_rt_handler(struct ctl_table *table, int write,
2082 void __user *buffer, size_t *lenp,
2083 loff_t *ppos);
2084
2085#ifdef CONFIG_SCHED_AUTOGROUP 2012#ifdef CONFIG_SCHED_AUTOGROUP
2086extern unsigned int sysctl_sched_autogroup_enabled;
2087
2088extern void sched_autogroup_create_attach(struct task_struct *p); 2013extern void sched_autogroup_create_attach(struct task_struct *p);
2089extern void sched_autogroup_detach(struct task_struct *p); 2014extern void sched_autogroup_detach(struct task_struct *p);
2090extern void sched_autogroup_fork(struct signal_struct *sig); 2015extern void sched_autogroup_fork(struct signal_struct *sig);
@@ -2100,30 +2025,6 @@ static inline void sched_autogroup_fork(struct signal_struct *sig) { }
2100static inline void sched_autogroup_exit(struct signal_struct *sig) { } 2025static inline void sched_autogroup_exit(struct signal_struct *sig) { }
2101#endif 2026#endif
2102 2027
2103#ifdef CONFIG_CFS_BANDWIDTH
2104extern unsigned int sysctl_sched_cfs_bandwidth_slice;
2105#endif
2106
2107#ifdef CONFIG_RT_MUTEXES
2108extern int rt_mutex_getprio(struct task_struct *p);
2109extern void rt_mutex_setprio(struct task_struct *p, int prio);
2110extern void rt_mutex_adjust_pi(struct task_struct *p);
2111static inline bool tsk_is_pi_blocked(struct task_struct *tsk)
2112{
2113 return tsk->pi_blocked_on != NULL;
2114}
2115#else
2116static inline int rt_mutex_getprio(struct task_struct *p)
2117{
2118 return p->normal_prio;
2119}
2120# define rt_mutex_adjust_pi(p) do { } while (0)
2121static inline bool tsk_is_pi_blocked(struct task_struct *tsk)
2122{
2123 return false;
2124}
2125#endif
2126
2127extern bool yield_to(struct task_struct *p, bool preempt); 2028extern bool yield_to(struct task_struct *p, bool preempt);
2128extern void set_user_nice(struct task_struct *p, long nice); 2029extern void set_user_nice(struct task_struct *p, long nice);
2129extern int task_prio(const struct task_struct *p); 2030extern int task_prio(const struct task_struct *p);
@@ -2753,14 +2654,15 @@ static inline void set_task_cpu(struct task_struct *p, unsigned int cpu)
2753extern long sched_setaffinity(pid_t pid, const struct cpumask *new_mask); 2654extern long sched_setaffinity(pid_t pid, const struct cpumask *new_mask);
2754extern long sched_getaffinity(pid_t pid, struct cpumask *mask); 2655extern long sched_getaffinity(pid_t pid, struct cpumask *mask);
2755 2656
2756extern void normalize_rt_tasks(void);
2757
2758#ifdef CONFIG_CGROUP_SCHED 2657#ifdef CONFIG_CGROUP_SCHED
2759 2658
2760extern struct task_group root_task_group; 2659extern struct task_group root_task_group;
2761 2660
2762extern struct task_group *sched_create_group(struct task_group *parent); 2661extern struct task_group *sched_create_group(struct task_group *parent);
2662extern void sched_online_group(struct task_group *tg,
2663 struct task_group *parent);
2763extern void sched_destroy_group(struct task_group *tg); 2664extern void sched_destroy_group(struct task_group *tg);
2665extern void sched_offline_group(struct task_group *tg);
2764extern void sched_move_task(struct task_struct *tsk); 2666extern void sched_move_task(struct task_struct *tsk);
2765#ifdef CONFIG_FAIR_GROUP_SCHED 2667#ifdef CONFIG_FAIR_GROUP_SCHED
2766extern int sched_group_set_shares(struct task_group *tg, unsigned long shares); 2668extern int sched_group_set_shares(struct task_group *tg, unsigned long shares);
diff --git a/include/linux/sched/rt.h b/include/linux/sched/rt.h
new file mode 100644
index 000000000000..94e19ea28fc3
--- /dev/null
+++ b/include/linux/sched/rt.h
@@ -0,0 +1,58 @@
1#ifndef _SCHED_RT_H
2#define _SCHED_RT_H
3
4/*
5 * Priority of a process goes from 0..MAX_PRIO-1, valid RT
6 * priority is 0..MAX_RT_PRIO-1, and SCHED_NORMAL/SCHED_BATCH
7 * tasks are in the range MAX_RT_PRIO..MAX_PRIO-1. Priority
8 * values are inverted: lower p->prio value means higher priority.
9 *
10 * The MAX_USER_RT_PRIO value allows the actual maximum
11 * RT priority to be separate from the value exported to
12 * user-space. This allows kernel threads to set their
13 * priority to a value higher than any user task. Note:
14 * MAX_RT_PRIO must not be smaller than MAX_USER_RT_PRIO.
15 */
16
17#define MAX_USER_RT_PRIO 100
18#define MAX_RT_PRIO MAX_USER_RT_PRIO
19
20#define MAX_PRIO (MAX_RT_PRIO + 40)
21#define DEFAULT_PRIO (MAX_RT_PRIO + 20)
22
23static inline int rt_prio(int prio)
24{
25 if (unlikely(prio < MAX_RT_PRIO))
26 return 1;
27 return 0;
28}
29
30static inline int rt_task(struct task_struct *p)
31{
32 return rt_prio(p->prio);
33}
34
35#ifdef CONFIG_RT_MUTEXES
36extern int rt_mutex_getprio(struct task_struct *p);
37extern void rt_mutex_setprio(struct task_struct *p, int prio);
38extern void rt_mutex_adjust_pi(struct task_struct *p);
39static inline bool tsk_is_pi_blocked(struct task_struct *tsk)
40{
41 return tsk->pi_blocked_on != NULL;
42}
43#else
44static inline int rt_mutex_getprio(struct task_struct *p)
45{
46 return p->normal_prio;
47}
48# define rt_mutex_adjust_pi(p) do { } while (0)
49static inline bool tsk_is_pi_blocked(struct task_struct *tsk)
50{
51 return false;
52}
53#endif
54
55extern void normalize_rt_tasks(void);
56
57
58#endif /* _SCHED_RT_H */
diff --git a/include/linux/sched/sysctl.h b/include/linux/sched/sysctl.h
new file mode 100644
index 000000000000..d2bb0ae979d0
--- /dev/null
+++ b/include/linux/sched/sysctl.h
@@ -0,0 +1,110 @@
1#ifndef _SCHED_SYSCTL_H
2#define _SCHED_SYSCTL_H
3
4#ifdef CONFIG_DETECT_HUNG_TASK
5extern unsigned int sysctl_hung_task_panic;
6extern unsigned long sysctl_hung_task_check_count;
7extern unsigned long sysctl_hung_task_timeout_secs;
8extern unsigned long sysctl_hung_task_warnings;
9extern int proc_dohung_task_timeout_secs(struct ctl_table *table, int write,
10 void __user *buffer,
11 size_t *lenp, loff_t *ppos);
12#else
13/* Avoid need for ifdefs elsewhere in the code */
14enum { sysctl_hung_task_timeout_secs = 0 };
15#endif
16
17/*
18 * Default maximum number of active map areas, this limits the number of vmas
19 * per mm struct. Users can overwrite this number by sysctl but there is a
20 * problem.
21 *
22 * When a program's coredump is generated as ELF format, a section is created
23 * per a vma. In ELF, the number of sections is represented in unsigned short.
24 * This means the number of sections should be smaller than 65535 at coredump.
25 * Because the kernel adds some informative sections to a image of program at
26 * generating coredump, we need some margin. The number of extra sections is
27 * 1-3 now and depends on arch. We use "5" as safe margin, here.
28 */
29#define MAPCOUNT_ELF_CORE_MARGIN (5)
30#define DEFAULT_MAX_MAP_COUNT (USHRT_MAX - MAPCOUNT_ELF_CORE_MARGIN)
31
32extern int sysctl_max_map_count;
33
34extern unsigned int sysctl_sched_latency;
35extern unsigned int sysctl_sched_min_granularity;
36extern unsigned int sysctl_sched_wakeup_granularity;
37extern unsigned int sysctl_sched_child_runs_first;
38
39enum sched_tunable_scaling {
40 SCHED_TUNABLESCALING_NONE,
41 SCHED_TUNABLESCALING_LOG,
42 SCHED_TUNABLESCALING_LINEAR,
43 SCHED_TUNABLESCALING_END,
44};
45extern enum sched_tunable_scaling sysctl_sched_tunable_scaling;
46
47extern unsigned int sysctl_numa_balancing_scan_delay;
48extern unsigned int sysctl_numa_balancing_scan_period_min;
49extern unsigned int sysctl_numa_balancing_scan_period_max;
50extern unsigned int sysctl_numa_balancing_scan_period_reset;
51extern unsigned int sysctl_numa_balancing_scan_size;
52extern unsigned int sysctl_numa_balancing_settle_count;
53
54#ifdef CONFIG_SCHED_DEBUG
55extern unsigned int sysctl_sched_migration_cost;
56extern unsigned int sysctl_sched_nr_migrate;
57extern unsigned int sysctl_sched_time_avg;
58extern unsigned int sysctl_timer_migration;
59extern unsigned int sysctl_sched_shares_window;
60
61int sched_proc_update_handler(struct ctl_table *table, int write,
62 void __user *buffer, size_t *length,
63 loff_t *ppos);
64#endif
65#ifdef CONFIG_SCHED_DEBUG
66static inline unsigned int get_sysctl_timer_migration(void)
67{
68 return sysctl_timer_migration;
69}
70#else
71static inline unsigned int get_sysctl_timer_migration(void)
72{
73 return 1;
74}
75#endif
76
77/*
78 * control realtime throttling:
79 *
80 * /proc/sys/kernel/sched_rt_period_us
81 * /proc/sys/kernel/sched_rt_runtime_us
82 */
83extern unsigned int sysctl_sched_rt_period;
84extern int sysctl_sched_rt_runtime;
85
86#ifdef CONFIG_CFS_BANDWIDTH
87extern unsigned int sysctl_sched_cfs_bandwidth_slice;
88#endif
89
90#ifdef CONFIG_SCHED_AUTOGROUP
91extern unsigned int sysctl_sched_autogroup_enabled;
92#endif
93
94/*
95 * default timeslice is 100 msecs (used only for SCHED_RR tasks).
96 * Timeslices get refilled after they expire.
97 */
98#define RR_TIMESLICE (100 * HZ / 1000)
99
100extern int sched_rr_timeslice;
101
102extern int sched_rr_handler(struct ctl_table *table, int write,
103 void __user *buffer, size_t *lenp,
104 loff_t *ppos);
105
106extern int sched_rt_handler(struct ctl_table *table, int write,
107 void __user *buffer, size_t *lenp,
108 loff_t *ppos);
109
110#endif /* _SCHED_SYSCTL_H */
diff --git a/include/linux/security.h b/include/linux/security.h
index 0f6afc657f77..eee7478cda70 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -989,17 +989,29 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
989 * tells the LSM to decrement the number of secmark labeling rules loaded 989 * tells the LSM to decrement the number of secmark labeling rules loaded
990 * @req_classify_flow: 990 * @req_classify_flow:
991 * Sets the flow's sid to the openreq sid. 991 * Sets the flow's sid to the openreq sid.
992 * @tun_dev_alloc_security:
993 * This hook allows a module to allocate a security structure for a TUN
994 * device.
995 * @security pointer to a security structure pointer.
996 * Returns a zero on success, negative values on failure.
997 * @tun_dev_free_security:
998 * This hook allows a module to free the security structure for a TUN
999 * device.
1000 * @security pointer to the TUN device's security structure
992 * @tun_dev_create: 1001 * @tun_dev_create:
993 * Check permissions prior to creating a new TUN device. 1002 * Check permissions prior to creating a new TUN device.
994 * @tun_dev_post_create: 1003 * @tun_dev_attach_queue:
995 * This hook allows a module to update or allocate a per-socket security 1004 * Check permissions prior to attaching to a TUN device queue.
996 * structure. 1005 * @security pointer to the TUN device's security structure.
997 * @sk contains the newly created sock structure.
998 * @tun_dev_attach: 1006 * @tun_dev_attach:
999 * Check permissions prior to attaching to a persistent TUN device. This 1007 * This hook can be used by the module to update any security state
1000 * hook can also be used by the module to update any security state
1001 * associated with the TUN device's sock structure. 1008 * associated with the TUN device's sock structure.
1002 * @sk contains the existing sock structure. 1009 * @sk contains the existing sock structure.
1010 * @security pointer to the TUN device's security structure.
1011 * @tun_dev_open:
1012 * This hook can be used by the module to update any security state
1013 * associated with the TUN device's security structure.
1014 * @security pointer to the TUN devices's security structure.
1003 * 1015 *
1004 * Security hooks for XFRM operations. 1016 * Security hooks for XFRM operations.
1005 * 1017 *
@@ -1620,9 +1632,12 @@ struct security_operations {
1620 void (*secmark_refcount_inc) (void); 1632 void (*secmark_refcount_inc) (void);
1621 void (*secmark_refcount_dec) (void); 1633 void (*secmark_refcount_dec) (void);
1622 void (*req_classify_flow) (const struct request_sock *req, struct flowi *fl); 1634 void (*req_classify_flow) (const struct request_sock *req, struct flowi *fl);
1623 int (*tun_dev_create)(void); 1635 int (*tun_dev_alloc_security) (void **security);
1624 void (*tun_dev_post_create)(struct sock *sk); 1636 void (*tun_dev_free_security) (void *security);
1625 int (*tun_dev_attach)(struct sock *sk); 1637 int (*tun_dev_create) (void);
1638 int (*tun_dev_attach_queue) (void *security);
1639 int (*tun_dev_attach) (struct sock *sk, void *security);
1640 int (*tun_dev_open) (void *security);
1626#endif /* CONFIG_SECURITY_NETWORK */ 1641#endif /* CONFIG_SECURITY_NETWORK */
1627 1642
1628#ifdef CONFIG_SECURITY_NETWORK_XFRM 1643#ifdef CONFIG_SECURITY_NETWORK_XFRM
@@ -2566,9 +2581,12 @@ void security_inet_conn_established(struct sock *sk,
2566int security_secmark_relabel_packet(u32 secid); 2581int security_secmark_relabel_packet(u32 secid);
2567void security_secmark_refcount_inc(void); 2582void security_secmark_refcount_inc(void);
2568void security_secmark_refcount_dec(void); 2583void security_secmark_refcount_dec(void);
2584int security_tun_dev_alloc_security(void **security);
2585void security_tun_dev_free_security(void *security);
2569int security_tun_dev_create(void); 2586int security_tun_dev_create(void);
2570void security_tun_dev_post_create(struct sock *sk); 2587int security_tun_dev_attach_queue(void *security);
2571int security_tun_dev_attach(struct sock *sk); 2588int security_tun_dev_attach(struct sock *sk, void *security);
2589int security_tun_dev_open(void *security);
2572 2590
2573#else /* CONFIG_SECURITY_NETWORK */ 2591#else /* CONFIG_SECURITY_NETWORK */
2574static inline int security_unix_stream_connect(struct sock *sock, 2592static inline int security_unix_stream_connect(struct sock *sock,
@@ -2733,16 +2751,31 @@ static inline void security_secmark_refcount_dec(void)
2733{ 2751{
2734} 2752}
2735 2753
2754static inline int security_tun_dev_alloc_security(void **security)
2755{
2756 return 0;
2757}
2758
2759static inline void security_tun_dev_free_security(void *security)
2760{
2761}
2762
2736static inline int security_tun_dev_create(void) 2763static inline int security_tun_dev_create(void)
2737{ 2764{
2738 return 0; 2765 return 0;
2739} 2766}
2740 2767
2741static inline void security_tun_dev_post_create(struct sock *sk) 2768static inline int security_tun_dev_attach_queue(void *security)
2769{
2770 return 0;
2771}
2772
2773static inline int security_tun_dev_attach(struct sock *sk, void *security)
2742{ 2774{
2775 return 0;
2743} 2776}
2744 2777
2745static inline int security_tun_dev_attach(struct sock *sk) 2778static inline int security_tun_dev_open(void *security)
2746{ 2779{
2747 return 0; 2780 return 0;
2748} 2781}
diff --git a/include/linux/serial_8250.h b/include/linux/serial_8250.h
index c490d20b3fb8..af47a8af6024 100644
--- a/include/linux/serial_8250.h
+++ b/include/linux/serial_8250.h
@@ -59,6 +59,8 @@ enum {
59 PLAT8250_DEV_SM501, 59 PLAT8250_DEV_SM501,
60}; 60};
61 61
62struct uart_8250_dma;
63
62/* 64/*
63 * This should be used by drivers which want to register 65 * This should be used by drivers which want to register
64 * their own 8250 ports without registering their own 66 * their own 8250 ports without registering their own
@@ -91,6 +93,8 @@ struct uart_8250_port {
91#define MSR_SAVE_FLAGS UART_MSR_ANY_DELTA 93#define MSR_SAVE_FLAGS UART_MSR_ANY_DELTA
92 unsigned char msr_saved_flags; 94 unsigned char msr_saved_flags;
93 95
96 struct uart_8250_dma *dma;
97
94 /* 8250 specific callbacks */ 98 /* 8250 specific callbacks */
95 int (*dl_read)(struct uart_8250_port *); 99 int (*dl_read)(struct uart_8250_port *);
96 void (*dl_write)(struct uart_8250_port *, int); 100 void (*dl_write)(struct uart_8250_port *, int);
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index c6690a2a27fb..87d4bbc773fc 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -29,7 +29,6 @@
29#include <linux/tty.h> 29#include <linux/tty.h>
30#include <linux/mutex.h> 30#include <linux/mutex.h>
31#include <linux/sysrq.h> 31#include <linux/sysrq.h>
32#include <linux/pps_kernel.h>
33#include <uapi/linux/serial_core.h> 32#include <uapi/linux/serial_core.h>
34 33
35struct uart_port; 34struct uart_port;
@@ -37,8 +36,8 @@ struct serial_struct;
37struct device; 36struct device;
38 37
39/* 38/*
40 * This structure describes all the operations that can be 39 * This structure describes all the operations that can be done on the
41 * done on the physical hardware. 40 * physical hardware. See Documentation/serial/driver for details.
42 */ 41 */
43struct uart_ops { 42struct uart_ops {
44 unsigned int (*tx_empty)(struct uart_port *); 43 unsigned int (*tx_empty)(struct uart_port *);
@@ -65,7 +64,7 @@ struct uart_ops {
65 /* 64 /*
66 * Return a string describing the type of the port 65 * Return a string describing the type of the port
67 */ 66 */
68 const char *(*type)(struct uart_port *); 67 const char *(*type)(struct uart_port *);
69 68
70 /* 69 /*
71 * Release IO and memory resources used by the port. 70 * Release IO and memory resources used by the port.
@@ -83,7 +82,7 @@ struct uart_ops {
83 int (*ioctl)(struct uart_port *, unsigned int, unsigned long); 82 int (*ioctl)(struct uart_port *, unsigned int, unsigned long);
84#ifdef CONFIG_CONSOLE_POLL 83#ifdef CONFIG_CONSOLE_POLL
85 int (*poll_init)(struct uart_port *); 84 int (*poll_init)(struct uart_port *);
86 void (*poll_put_char)(struct uart_port *, unsigned char); 85 void (*poll_put_char)(struct uart_port *, unsigned char);
87 int (*poll_get_char)(struct uart_port *); 86 int (*poll_get_char)(struct uart_port *);
88#endif 87#endif
89}; 88};
@@ -134,9 +133,8 @@ struct uart_port {
134#define UPIO_HUB6 (1) 133#define UPIO_HUB6 (1)
135#define UPIO_MEM (2) 134#define UPIO_MEM (2)
136#define UPIO_MEM32 (3) 135#define UPIO_MEM32 (3)
137#define UPIO_AU (4) /* Au1x00 type IO */ 136#define UPIO_AU (4) /* Au1x00 and RT288x type IO */
138#define UPIO_TSI (5) /* Tsi108/109 type IO */ 137#define UPIO_TSI (5) /* Tsi108/109 type IO */
139#define UPIO_RM9000 (6) /* RM9000 type IO */
140 138
141 unsigned int read_status_mask; /* driver specific */ 139 unsigned int read_status_mask; /* driver specific */
142 unsigned int ignore_status_mask; /* driver specific */ 140 unsigned int ignore_status_mask; /* driver specific */
@@ -208,13 +206,25 @@ static inline void serial_port_out(struct uart_port *up, int offset, int value)
208 up->serial_out(up, offset, value); 206 up->serial_out(up, offset, value);
209} 207}
210 208
209/**
210 * enum uart_pm_state - power states for UARTs
211 * @UART_PM_STATE_ON: UART is powered, up and operational
212 * @UART_PM_STATE_OFF: UART is powered off
213 * @UART_PM_STATE_UNDEFINED: sentinel
214 */
215enum uart_pm_state {
216 UART_PM_STATE_ON = 0,
217 UART_PM_STATE_OFF = 3, /* number taken from ACPI */
218 UART_PM_STATE_UNDEFINED,
219};
220
211/* 221/*
212 * This is the state information which is persistent across opens. 222 * This is the state information which is persistent across opens.
213 */ 223 */
214struct uart_state { 224struct uart_state {
215 struct tty_port port; 225 struct tty_port port;
216 226
217 int pm_state; 227 enum uart_pm_state pm_state;
218 struct circ_buf xmit; 228 struct circ_buf xmit;
219 229
220 struct uart_port *uart_port; 230 struct uart_port *uart_port;
diff --git a/include/linux/sh_pfc.h b/include/linux/sh_pfc.h
deleted file mode 100644
index c19a0925829a..000000000000
--- a/include/linux/sh_pfc.h
+++ /dev/null
@@ -1,236 +0,0 @@
1/*
2 * SuperH Pin Function Controller Support
3 *
4 * Copyright (c) 2008 Magnus Damm
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10
11#ifndef __SH_PFC_H
12#define __SH_PFC_H
13
14#include <linux/stringify.h>
15#include <asm-generic/gpio.h>
16
17typedef unsigned short pinmux_enum_t;
18typedef unsigned short pinmux_flag_t;
19
20enum {
21 PINMUX_TYPE_NONE,
22
23 PINMUX_TYPE_FUNCTION,
24 PINMUX_TYPE_GPIO,
25 PINMUX_TYPE_OUTPUT,
26 PINMUX_TYPE_INPUT,
27 PINMUX_TYPE_INPUT_PULLUP,
28 PINMUX_TYPE_INPUT_PULLDOWN,
29
30 PINMUX_FLAG_TYPE, /* must be last */
31};
32
33#define PINMUX_FLAG_DBIT_SHIFT 5
34#define PINMUX_FLAG_DBIT (0x1f << PINMUX_FLAG_DBIT_SHIFT)
35#define PINMUX_FLAG_DREG_SHIFT 10
36#define PINMUX_FLAG_DREG (0x3f << PINMUX_FLAG_DREG_SHIFT)
37
38struct pinmux_gpio {
39 pinmux_enum_t enum_id;
40 pinmux_flag_t flags;
41 const char *name;
42};
43
44#define PINMUX_GPIO(gpio, data_or_mark) \
45 [gpio] = { .name = __stringify(gpio), .enum_id = data_or_mark, .flags = PINMUX_TYPE_NONE }
46
47#define PINMUX_DATA(data_or_mark, ids...) data_or_mark, ids, 0
48
49struct pinmux_cfg_reg {
50 unsigned long reg, reg_width, field_width;
51 unsigned long *cnt;
52 pinmux_enum_t *enum_ids;
53 unsigned long *var_field_width;
54};
55
56#define PINMUX_CFG_REG(name, r, r_width, f_width) \
57 .reg = r, .reg_width = r_width, .field_width = f_width, \
58 .cnt = (unsigned long [r_width / f_width]) {}, \
59 .enum_ids = (pinmux_enum_t [(r_width / f_width) * (1 << f_width)])
60
61#define PINMUX_CFG_REG_VAR(name, r, r_width, var_fw0, var_fwn...) \
62 .reg = r, .reg_width = r_width, \
63 .cnt = (unsigned long [r_width]) {}, \
64 .var_field_width = (unsigned long [r_width]) { var_fw0, var_fwn, 0 }, \
65 .enum_ids = (pinmux_enum_t [])
66
67struct pinmux_data_reg {
68 unsigned long reg, reg_width, reg_shadow;
69 pinmux_enum_t *enum_ids;
70 void __iomem *mapped_reg;
71};
72
73#define PINMUX_DATA_REG(name, r, r_width) \
74 .reg = r, .reg_width = r_width, \
75 .enum_ids = (pinmux_enum_t [r_width]) \
76
77struct pinmux_irq {
78 int irq;
79 pinmux_enum_t *enum_ids;
80};
81
82#define PINMUX_IRQ(irq_nr, ids...) \
83 { .irq = irq_nr, .enum_ids = (pinmux_enum_t []) { ids, 0 } } \
84
85struct pinmux_range {
86 pinmux_enum_t begin;
87 pinmux_enum_t end;
88 pinmux_enum_t force;
89};
90
91struct pfc_window {
92 phys_addr_t phys;
93 void __iomem *virt;
94 unsigned long size;
95};
96
97struct sh_pfc {
98 char *name;
99 pinmux_enum_t reserved_id;
100 struct pinmux_range data;
101 struct pinmux_range input;
102 struct pinmux_range input_pd;
103 struct pinmux_range input_pu;
104 struct pinmux_range output;
105 struct pinmux_range mark;
106 struct pinmux_range function;
107
108 unsigned first_gpio, last_gpio;
109
110 struct pinmux_gpio *gpios;
111 struct pinmux_cfg_reg *cfg_regs;
112 struct pinmux_data_reg *data_regs;
113
114 pinmux_enum_t *gpio_data;
115 unsigned int gpio_data_size;
116
117 struct pinmux_irq *gpio_irq;
118 unsigned int gpio_irq_size;
119
120 spinlock_t lock;
121
122 struct resource *resource;
123 unsigned int num_resources;
124 struct pfc_window *window;
125
126 unsigned long unlock_reg;
127};
128
129/* XXX compat for now */
130#define pinmux_info sh_pfc
131
132/* drivers/sh/pfc/gpio.c */
133int sh_pfc_register_gpiochip(struct sh_pfc *pfc);
134
135/* drivers/sh/pfc/pinctrl.c */
136int sh_pfc_register_pinctrl(struct sh_pfc *pfc);
137
138/* drivers/sh/pfc/core.c */
139int register_sh_pfc(struct sh_pfc *pfc);
140
141int sh_pfc_read_bit(struct pinmux_data_reg *dr, unsigned long in_pos);
142void sh_pfc_write_bit(struct pinmux_data_reg *dr, unsigned long in_pos,
143 unsigned long value);
144int sh_pfc_get_data_reg(struct sh_pfc *pfc, unsigned gpio,
145 struct pinmux_data_reg **drp, int *bitp);
146int sh_pfc_gpio_to_enum(struct sh_pfc *pfc, unsigned gpio, int pos,
147 pinmux_enum_t *enum_idp);
148int sh_pfc_config_gpio(struct sh_pfc *pfc, unsigned gpio, int pinmux_type,
149 int cfg_mode);
150
151/* xxx */
152static inline int register_pinmux(struct pinmux_info *pip)
153{
154 struct sh_pfc *pfc = pip;
155 return register_sh_pfc(pfc);
156}
157
158enum { GPIO_CFG_DRYRUN, GPIO_CFG_REQ, GPIO_CFG_FREE };
159
160/* helper macro for port */
161#define PORT_1(fn, pfx, sfx) fn(pfx, sfx)
162
163#define PORT_10(fn, pfx, sfx) \
164 PORT_1(fn, pfx##0, sfx), PORT_1(fn, pfx##1, sfx), \
165 PORT_1(fn, pfx##2, sfx), PORT_1(fn, pfx##3, sfx), \
166 PORT_1(fn, pfx##4, sfx), PORT_1(fn, pfx##5, sfx), \
167 PORT_1(fn, pfx##6, sfx), PORT_1(fn, pfx##7, sfx), \
168 PORT_1(fn, pfx##8, sfx), PORT_1(fn, pfx##9, sfx)
169
170#define PORT_90(fn, pfx, sfx) \
171 PORT_10(fn, pfx##1, sfx), PORT_10(fn, pfx##2, sfx), \
172 PORT_10(fn, pfx##3, sfx), PORT_10(fn, pfx##4, sfx), \
173 PORT_10(fn, pfx##5, sfx), PORT_10(fn, pfx##6, sfx), \
174 PORT_10(fn, pfx##7, sfx), PORT_10(fn, pfx##8, sfx), \
175 PORT_10(fn, pfx##9, sfx)
176
177#define _PORT_ALL(pfx, sfx) pfx##_##sfx
178#define _GPIO_PORT(pfx, sfx) PINMUX_GPIO(GPIO_PORT##pfx, PORT##pfx##_DATA)
179#define PORT_ALL(str) CPU_ALL_PORT(_PORT_ALL, PORT, str)
180#define GPIO_PORT_ALL() CPU_ALL_PORT(_GPIO_PORT, , unused)
181#define GPIO_FN(str) PINMUX_GPIO(GPIO_FN_##str, str##_MARK)
182
183/* helper macro for pinmux_enum_t */
184#define PORT_DATA_I(nr) \
185 PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, PORT##nr##_IN)
186
187#define PORT_DATA_I_PD(nr) \
188 PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, \
189 PORT##nr##_IN, PORT##nr##_IN_PD)
190
191#define PORT_DATA_I_PU(nr) \
192 PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, \
193 PORT##nr##_IN, PORT##nr##_IN_PU)
194
195#define PORT_DATA_I_PU_PD(nr) \
196 PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, \
197 PORT##nr##_IN, PORT##nr##_IN_PD, PORT##nr##_IN_PU)
198
199#define PORT_DATA_O(nr) \
200 PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, PORT##nr##_OUT)
201
202#define PORT_DATA_IO(nr) \
203 PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, PORT##nr##_OUT, \
204 PORT##nr##_IN)
205
206#define PORT_DATA_IO_PD(nr) \
207 PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, PORT##nr##_OUT, \
208 PORT##nr##_IN, PORT##nr##_IN_PD)
209
210#define PORT_DATA_IO_PU(nr) \
211 PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, PORT##nr##_OUT, \
212 PORT##nr##_IN, PORT##nr##_IN_PU)
213
214#define PORT_DATA_IO_PU_PD(nr) \
215 PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, PORT##nr##_OUT, \
216 PORT##nr##_IN, PORT##nr##_IN_PD, PORT##nr##_IN_PU)
217
218/* helper macro for top 4 bits in PORTnCR */
219#define _PCRH(in, in_pd, in_pu, out) \
220 0, (out), (in), 0, \
221 0, 0, 0, 0, \
222 0, 0, (in_pd), 0, \
223 0, 0, (in_pu), 0
224
225#define PORTCR(nr, reg) \
226 { \
227 PINMUX_CFG_REG("PORT" nr "CR", reg, 8, 4) { \
228 _PCRH(PORT##nr##_IN, PORT##nr##_IN_PD, \
229 PORT##nr##_IN_PU, PORT##nr##_OUT), \
230 PORT##nr##_FN0, PORT##nr##_FN1, \
231 PORT##nr##_FN2, PORT##nr##_FN3, \
232 PORT##nr##_FN4, PORT##nr##_FN5, \
233 PORT##nr##_FN6, PORT##nr##_FN7 } \
234 }
235
236#endif /* __SH_PFC_H */
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 320e976d5ab8..821c7f45d2a7 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -230,6 +230,13 @@ enum {
230 230
231 /* generate wifi status information (where possible) */ 231 /* generate wifi status information (where possible) */
232 SKBTX_WIFI_STATUS = 1 << 4, 232 SKBTX_WIFI_STATUS = 1 << 4,
233
234 /* This indicates at least one fragment might be overwritten
235 * (as in vmsplice(), sendfile() ...)
236 * If we need to compute a TX checksum, we'll need to copy
237 * all frags to avoid possible bad checksum
238 */
239 SKBTX_SHARED_FRAG = 1 << 5,
233}; 240};
234 241
235/* 242/*
@@ -307,6 +314,8 @@ enum {
307 SKB_GSO_TCPV6 = 1 << 4, 314 SKB_GSO_TCPV6 = 1 << 4,
308 315
309 SKB_GSO_FCOE = 1 << 5, 316 SKB_GSO_FCOE = 1 << 5,
317
318 SKB_GSO_GRE = 1 << 6,
310}; 319};
311 320
312#if BITS_PER_LONG > 32 321#if BITS_PER_LONG > 32
@@ -797,6 +806,16 @@ static inline int skb_cloned(const struct sk_buff *skb)
797 (atomic_read(&skb_shinfo(skb)->dataref) & SKB_DATAREF_MASK) != 1; 806 (atomic_read(&skb_shinfo(skb)->dataref) & SKB_DATAREF_MASK) != 1;
798} 807}
799 808
809static inline int skb_unclone(struct sk_buff *skb, gfp_t pri)
810{
811 might_sleep_if(pri & __GFP_WAIT);
812
813 if (skb_cloned(skb))
814 return pskb_expand_head(skb, 0, 0, pri);
815
816 return 0;
817}
818
800/** 819/**
801 * skb_header_cloned - is the header a clone 820 * skb_header_cloned - is the header a clone
802 * @skb: buffer to check 821 * @skb: buffer to check
@@ -1492,6 +1511,11 @@ static inline void skb_set_inner_network_header(struct sk_buff *skb,
1492 skb->inner_network_header += offset; 1511 skb->inner_network_header += offset;
1493} 1512}
1494 1513
1514static inline bool skb_transport_header_was_set(const struct sk_buff *skb)
1515{
1516 return skb->transport_header != ~0U;
1517}
1518
1495static inline unsigned char *skb_transport_header(const struct sk_buff *skb) 1519static inline unsigned char *skb_transport_header(const struct sk_buff *skb)
1496{ 1520{
1497 return skb->head + skb->transport_header; 1521 return skb->head + skb->transport_header;
@@ -1580,6 +1604,11 @@ static inline void skb_set_inner_network_header(struct sk_buff *skb,
1580 skb->inner_network_header = skb->data + offset; 1604 skb->inner_network_header = skb->data + offset;
1581} 1605}
1582 1606
1607static inline bool skb_transport_header_was_set(const struct sk_buff *skb)
1608{
1609 return skb->transport_header != NULL;
1610}
1611
1583static inline unsigned char *skb_transport_header(const struct sk_buff *skb) 1612static inline unsigned char *skb_transport_header(const struct sk_buff *skb)
1584{ 1613{
1585 return skb->transport_header; 1614 return skb->transport_header;
@@ -1815,6 +1844,10 @@ static inline void __skb_queue_purge(struct sk_buff_head *list)
1815 kfree_skb(skb); 1844 kfree_skb(skb);
1816} 1845}
1817 1846
1847#define NETDEV_FRAG_PAGE_MAX_ORDER get_order(32768)
1848#define NETDEV_FRAG_PAGE_MAX_SIZE (PAGE_SIZE << NETDEV_FRAG_PAGE_MAX_ORDER)
1849#define NETDEV_PAGECNT_MAX_BIAS NETDEV_FRAG_PAGE_MAX_SIZE
1850
1818extern void *netdev_alloc_frag(unsigned int fragsz); 1851extern void *netdev_alloc_frag(unsigned int fragsz);
1819 1852
1820extern struct sk_buff *__netdev_alloc_skb(struct net_device *dev, 1853extern struct sk_buff *__netdev_alloc_skb(struct net_device *dev,
@@ -2191,6 +2224,19 @@ static inline int skb_linearize(struct sk_buff *skb)
2191} 2224}
2192 2225
2193/** 2226/**
2227 * skb_has_shared_frag - can any frag be overwritten
2228 * @skb: buffer to test
2229 *
2230 * Return true if the skb has at least one frag that might be modified
2231 * by an external entity (as in vmsplice()/sendfile())
2232 */
2233static inline bool skb_has_shared_frag(const struct sk_buff *skb)
2234{
2235 return skb_is_nonlinear(skb) &&
2236 skb_shinfo(skb)->tx_flags & SKBTX_SHARED_FRAG;
2237}
2238
2239/**
2194 * skb_linearize_cow - make sure skb is linear and writable 2240 * skb_linearize_cow - make sure skb is linear and writable
2195 * @skb: buffer to process 2241 * @skb: buffer to process
2196 * 2242 *
@@ -2688,6 +2734,21 @@ static inline struct sec_path *skb_sec_path(struct sk_buff *skb)
2688} 2734}
2689#endif 2735#endif
2690 2736
2737/* Keeps track of mac header offset relative to skb->head.
2738 * It is useful for TSO of Tunneling protocol. e.g. GRE.
2739 * For non-tunnel skb it points to skb_mac_header() and for
2740 * tunnel skb it points to outer mac header. */
2741struct skb_gso_cb {
2742 int mac_offset;
2743};
2744#define SKB_GSO_CB(skb) ((struct skb_gso_cb *)(skb)->cb)
2745
2746static inline int skb_tnl_header_len(const struct sk_buff *inner_skb)
2747{
2748 return (skb_mac_header(inner_skb) - inner_skb->head) -
2749 SKB_GSO_CB(inner_skb)->mac_offset;
2750}
2751
2691static inline bool skb_is_gso(const struct sk_buff *skb) 2752static inline bool skb_is_gso(const struct sk_buff *skb)
2692{ 2753{
2693 return skb_shinfo(skb)->gso_size; 2754 return skb_shinfo(skb)->gso_size;
diff --git a/include/linux/smp.h b/include/linux/smp.h
index dd6f06be3c9f..3e07a7df6478 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -89,7 +89,8 @@ void kick_all_cpus_sync(void);
89#ifdef CONFIG_USE_GENERIC_SMP_HELPERS 89#ifdef CONFIG_USE_GENERIC_SMP_HELPERS
90void __init call_function_init(void); 90void __init call_function_init(void);
91void generic_smp_call_function_single_interrupt(void); 91void generic_smp_call_function_single_interrupt(void);
92void generic_smp_call_function_interrupt(void); 92#define generic_smp_call_function_interrupt \
93 generic_smp_call_function_single_interrupt
93#else 94#else
94static inline void call_function_init(void) { } 95static inline void call_function_init(void) { }
95#endif 96#endif
diff --git a/include/linux/smpboot.h b/include/linux/smpboot.h
index e0106d8581d3..c65dee059913 100644
--- a/include/linux/smpboot.h
+++ b/include/linux/smpboot.h
@@ -14,6 +14,8 @@ struct smpboot_thread_data;
14 * @thread_should_run: Check whether the thread should run or not. Called with 14 * @thread_should_run: Check whether the thread should run or not. Called with
15 * preemption disabled. 15 * preemption disabled.
16 * @thread_fn: The associated thread function 16 * @thread_fn: The associated thread function
17 * @create: Optional setup function, called when the thread gets
18 * created (Not called from the thread context)
17 * @setup: Optional setup function, called when the thread gets 19 * @setup: Optional setup function, called when the thread gets
18 * operational the first time 20 * operational the first time
19 * @cleanup: Optional cleanup function, called when the thread 21 * @cleanup: Optional cleanup function, called when the thread
@@ -22,6 +24,7 @@ struct smpboot_thread_data;
22 * parked (cpu offline) 24 * parked (cpu offline)
23 * @unpark: Optional unpark function, called when the thread is 25 * @unpark: Optional unpark function, called when the thread is
24 * unparked (cpu online) 26 * unparked (cpu online)
27 * @selfparking: Thread is not parked by the park function.
25 * @thread_comm: The base name of the thread 28 * @thread_comm: The base name of the thread
26 */ 29 */
27struct smp_hotplug_thread { 30struct smp_hotplug_thread {
@@ -29,10 +32,12 @@ struct smp_hotplug_thread {
29 struct list_head list; 32 struct list_head list;
30 int (*thread_should_run)(unsigned int cpu); 33 int (*thread_should_run)(unsigned int cpu);
31 void (*thread_fn)(unsigned int cpu); 34 void (*thread_fn)(unsigned int cpu);
35 void (*create)(unsigned int cpu);
32 void (*setup)(unsigned int cpu); 36 void (*setup)(unsigned int cpu);
33 void (*cleanup)(unsigned int cpu, bool online); 37 void (*cleanup)(unsigned int cpu, bool online);
34 void (*park)(unsigned int cpu); 38 void (*park)(unsigned int cpu);
35 void (*unpark)(unsigned int cpu); 39 void (*unpark)(unsigned int cpu);
40 bool selfparking;
36 const char *thread_comm; 41 const char *thread_comm;
37}; 42};
38 43
diff --git a/include/linux/socket.h b/include/linux/socket.h
index 9a546ff853dc..2b9f74b0ffea 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -178,7 +178,8 @@ struct ucred {
178#define AF_CAIF 37 /* CAIF sockets */ 178#define AF_CAIF 37 /* CAIF sockets */
179#define AF_ALG 38 /* Algorithm sockets */ 179#define AF_ALG 38 /* Algorithm sockets */
180#define AF_NFC 39 /* NFC sockets */ 180#define AF_NFC 39 /* NFC sockets */
181#define AF_MAX 40 /* For now.. */ 181#define AF_VSOCK 40 /* vSockets */
182#define AF_MAX 41 /* For now.. */
182 183
183/* Protocol families, same as address families. */ 184/* Protocol families, same as address families. */
184#define PF_UNSPEC AF_UNSPEC 185#define PF_UNSPEC AF_UNSPEC
@@ -221,6 +222,7 @@ struct ucred {
221#define PF_CAIF AF_CAIF 222#define PF_CAIF AF_CAIF
222#define PF_ALG AF_ALG 223#define PF_ALG AF_ALG
223#define PF_NFC AF_NFC 224#define PF_NFC AF_NFC
225#define PF_VSOCK AF_VSOCK
224#define PF_MAX AF_MAX 226#define PF_MAX AF_MAX
225 227
226/* Maximum queue length specifiable by listen. */ 228/* Maximum queue length specifiable by listen. */
diff --git a/include/linux/spi/pxa2xx_spi.h b/include/linux/spi/pxa2xx_spi.h
index c73d1445c77e..82d5111cd0c2 100644
--- a/include/linux/spi/pxa2xx_spi.h
+++ b/include/linux/spi/pxa2xx_spi.h
@@ -28,6 +28,15 @@ struct pxa2xx_spi_master {
28 u32 clock_enable; 28 u32 clock_enable;
29 u16 num_chipselect; 29 u16 num_chipselect;
30 u8 enable_dma; 30 u8 enable_dma;
31
32 /* DMA engine specific config */
33 int rx_chan_id;
34 int tx_chan_id;
35 int rx_slave_id;
36 int tx_slave_id;
37
38 /* For non-PXA arches */
39 struct ssp_device ssp;
31}; 40};
32 41
33/* spi_board_info.controller_data for SPI slave devices, 42/* spi_board_info.controller_data for SPI slave devices,
@@ -35,6 +44,7 @@ struct pxa2xx_spi_master {
35 */ 44 */
36struct pxa2xx_spi_chip { 45struct pxa2xx_spi_chip {
37 u8 tx_threshold; 46 u8 tx_threshold;
47 u8 tx_hi_threshold;
38 u8 rx_threshold; 48 u8 rx_threshold;
39 u8 dma_burst_size; 49 u8 dma_burst_size;
40 u32 timeout; 50 u32 timeout;
@@ -50,103 +60,5 @@ struct pxa2xx_spi_chip {
50 60
51extern void pxa2xx_set_spi_info(unsigned id, struct pxa2xx_spi_master *info); 61extern void pxa2xx_set_spi_info(unsigned id, struct pxa2xx_spi_master *info);
52 62
53#else
54/*
55 * This is the implemtation for CE4100 on x86. ARM defines them in mach/ or
56 * plat/ include path.
57 * The CE4100 does not provide DMA support. This bits are here to let the driver
58 * compile and will never be used. Maybe we get DMA support at a later point in
59 * time.
60 */
61
62#define DCSR(n) (n)
63#define DSADR(n) (n)
64#define DTADR(n) (n)
65#define DCMD(n) (n)
66#define DRCMR(n) (n)
67
68#define DCSR_RUN (1 << 31) /* Run Bit */
69#define DCSR_NODESC (1 << 30) /* No-Descriptor Fetch */
70#define DCSR_STOPIRQEN (1 << 29) /* Stop Interrupt Enable */
71#define DCSR_REQPEND (1 << 8) /* Request Pending (read-only) */
72#define DCSR_STOPSTATE (1 << 3) /* Stop State (read-only) */
73#define DCSR_ENDINTR (1 << 2) /* End Interrupt */
74#define DCSR_STARTINTR (1 << 1) /* Start Interrupt */
75#define DCSR_BUSERR (1 << 0) /* Bus Error Interrupt */
76
77#define DCSR_EORIRQEN (1 << 28) /* End of Receive Interrupt Enable */
78#define DCSR_EORJMPEN (1 << 27) /* Jump to next descriptor on EOR */
79#define DCSR_EORSTOPEN (1 << 26) /* STOP on an EOR */
80#define DCSR_SETCMPST (1 << 25) /* Set Descriptor Compare Status */
81#define DCSR_CLRCMPST (1 << 24) /* Clear Descriptor Compare Status */
82#define DCSR_CMPST (1 << 10) /* The Descriptor Compare Status */
83#define DCSR_EORINTR (1 << 9) /* The end of Receive */
84
85#define DRCMR_MAPVLD (1 << 7) /* Map Valid */
86#define DRCMR_CHLNUM 0x1f /* mask for Channel Number */
87
88#define DDADR_DESCADDR 0xfffffff0 /* Address of next descriptor */
89#define DDADR_STOP (1 << 0) /* Stop */
90
91#define DCMD_INCSRCADDR (1 << 31) /* Source Address Increment Setting. */
92#define DCMD_INCTRGADDR (1 << 30) /* Target Address Increment Setting. */
93#define DCMD_FLOWSRC (1 << 29) /* Flow Control by the source. */
94#define DCMD_FLOWTRG (1 << 28) /* Flow Control by the target. */
95#define DCMD_STARTIRQEN (1 << 22) /* Start Interrupt Enable */
96#define DCMD_ENDIRQEN (1 << 21) /* End Interrupt Enable */
97#define DCMD_ENDIAN (1 << 18) /* Device Endian-ness. */
98#define DCMD_BURST8 (1 << 16) /* 8 byte burst */
99#define DCMD_BURST16 (2 << 16) /* 16 byte burst */
100#define DCMD_BURST32 (3 << 16) /* 32 byte burst */
101#define DCMD_WIDTH1 (1 << 14) /* 1 byte width */
102#define DCMD_WIDTH2 (2 << 14) /* 2 byte width (HalfWord) */
103#define DCMD_WIDTH4 (3 << 14) /* 4 byte width (Word) */
104#define DCMD_LENGTH 0x01fff /* length mask (max = 8K - 1) */
105
106/*
107 * Descriptor structure for PXA's DMA engine
108 * Note: this structure must always be aligned to a 16-byte boundary.
109 */
110
111typedef enum {
112 DMA_PRIO_HIGH = 0,
113 DMA_PRIO_MEDIUM = 1,
114 DMA_PRIO_LOW = 2
115} pxa_dma_prio;
116
117/*
118 * DMA registration
119 */
120
121static inline int pxa_request_dma(char *name,
122 pxa_dma_prio prio,
123 void (*irq_handler)(int, void *),
124 void *data)
125{
126 return -ENODEV;
127}
128
129static inline void pxa_free_dma(int dma_ch)
130{
131}
132
133/*
134 * The CE4100 does not have the clk framework implemented and SPI clock can
135 * not be switched on/off or the divider changed.
136 */
137static inline void clk_disable(struct clk *clk)
138{
139}
140
141static inline int clk_enable(struct clk *clk)
142{
143 return 0;
144}
145
146static inline unsigned long clk_get_rate(struct clk *clk)
147{
148 return 3686400;
149}
150
151#endif 63#endif
152#endif 64#endif
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index f62918946d86..38c2b925923d 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -57,6 +57,8 @@ extern struct bus_type spi_bus_type;
57 * @modalias: Name of the driver to use with this device, or an alias 57 * @modalias: Name of the driver to use with this device, or an alias
58 * for that name. This appears in the sysfs "modalias" attribute 58 * for that name. This appears in the sysfs "modalias" attribute
59 * for driver coldplugging, and in uevents used for hotplugging 59 * for driver coldplugging, and in uevents used for hotplugging
60 * @cs_gpio: gpio number of the chipselect line (optional, -EINVAL when
61 * when not using a GPIO line)
60 * 62 *
61 * A @spi_device is used to interchange data between an SPI slave 63 * A @spi_device is used to interchange data between an SPI slave
62 * (usually a discrete chip) and CPU memory. 64 * (usually a discrete chip) and CPU memory.
@@ -258,6 +260,9 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv)
258 * @unprepare_transfer_hardware: there are currently no more messages on the 260 * @unprepare_transfer_hardware: there are currently no more messages on the
259 * queue so the subsystem notifies the driver that it may relax the 261 * queue so the subsystem notifies the driver that it may relax the
260 * hardware by issuing this call 262 * hardware by issuing this call
263 * @cs_gpios: Array of GPIOs to use as chip select lines; one per CS
264 * number. Any individual value may be -EINVAL for CS lines that
265 * are not GPIOs (driven by the SPI controller itself).
261 * 266 *
262 * Each SPI master controller can communicate with one or more @spi_device 267 * Each SPI master controller can communicate with one or more @spi_device
263 * children. These make a small bus, sharing MOSI, MISO and SCK signals 268 * children. These make a small bus, sharing MOSI, MISO and SCK signals
@@ -591,6 +596,26 @@ spi_transfer_del(struct spi_transfer *t)
591 list_del(&t->transfer_list); 596 list_del(&t->transfer_list);
592} 597}
593 598
599/**
600 * spi_message_init_with_transfers - Initialize spi_message and append transfers
601 * @m: spi_message to be initialized
602 * @xfers: An array of spi transfers
603 * @num_xfers: Number of items in the xfer array
604 *
605 * This function initializes the given spi_message and adds each spi_transfer in
606 * the given array to the message.
607 */
608static inline void
609spi_message_init_with_transfers(struct spi_message *m,
610struct spi_transfer *xfers, unsigned int num_xfers)
611{
612 unsigned int i;
613
614 spi_message_init(m);
615 for (i = 0; i < num_xfers; ++i)
616 spi_message_add_tail(&xfers[i], m);
617}
618
594/* It's fine to embed message and transaction structures in other data 619/* It's fine to embed message and transaction structures in other data
595 * structures so long as you don't free them while they're in use. 620 * structures so long as you don't free them while they're in use.
596 */ 621 */
@@ -683,6 +708,30 @@ spi_read(struct spi_device *spi, void *buf, size_t len)
683 return spi_sync(spi, &m); 708 return spi_sync(spi, &m);
684} 709}
685 710
711/**
712 * spi_sync_transfer - synchronous SPI data transfer
713 * @spi: device with which data will be exchanged
714 * @xfers: An array of spi_transfers
715 * @num_xfers: Number of items in the xfer array
716 * Context: can sleep
717 *
718 * Does a synchronous SPI data transfer of the given spi_transfer array.
719 *
720 * For more specific semantics see spi_sync().
721 *
722 * It returns zero on success, else a negative error code.
723 */
724static inline int
725spi_sync_transfer(struct spi_device *spi, struct spi_transfer *xfers,
726 unsigned int num_xfers)
727{
728 struct spi_message msg;
729
730 spi_message_init_with_transfers(&msg, xfers, num_xfers);
731
732 return spi_sync(spi, &msg);
733}
734
686/* this copies txbuf and rxbuf data; for small transfers only! */ 735/* this copies txbuf and rxbuf data; for small transfers only! */
687extern int spi_write_then_read(struct spi_device *spi, 736extern int spi_write_then_read(struct spi_device *spi,
688 const void *txbuf, unsigned n_tx, 737 const void *txbuf, unsigned n_tx,
diff --git a/include/linux/spi/spi_gpio.h b/include/linux/spi/spi_gpio.h
index 369b3d7d5b95..1634ce31c06d 100644
--- a/include/linux/spi/spi_gpio.h
+++ b/include/linux/spi/spi_gpio.h
@@ -62,8 +62,8 @@
62 */ 62 */
63struct spi_gpio_platform_data { 63struct spi_gpio_platform_data {
64 unsigned sck; 64 unsigned sck;
65 unsigned mosi; 65 unsigned long mosi;
66 unsigned miso; 66 unsigned long miso;
67 67
68 u16 num_chipselect; 68 u16 num_chipselect;
69}; 69};
diff --git a/include/linux/srcu.h b/include/linux/srcu.h
index 6eb691b08358..04f4121a23ae 100644
--- a/include/linux/srcu.h
+++ b/include/linux/srcu.h
@@ -151,30 +151,14 @@ void srcu_barrier(struct srcu_struct *sp);
151 * Checks debug_lockdep_rcu_enabled() to prevent false positives during boot 151 * Checks debug_lockdep_rcu_enabled() to prevent false positives during boot
152 * and while lockdep is disabled. 152 * and while lockdep is disabled.
153 * 153 *
154 * Note that if the CPU is in the idle loop from an RCU point of view 154 * Note that SRCU is based on its own statemachine and it doesn't
155 * (ie: that we are in the section between rcu_idle_enter() and 155 * relies on normal RCU, it can be called from the CPU which
156 * rcu_idle_exit()) then srcu_read_lock_held() returns false even if 156 * is in the idle loop from an RCU point of view or offline.
157 * the CPU did an srcu_read_lock(). The reason for this is that RCU
158 * ignores CPUs that are in such a section, considering these as in
159 * extended quiescent state, so such a CPU is effectively never in an
160 * RCU read-side critical section regardless of what RCU primitives it
161 * invokes. This state of affairs is required --- we need to keep an
162 * RCU-free window in idle where the CPU may possibly enter into low
163 * power mode. This way we can notice an extended quiescent state to
164 * other CPUs that started a grace period. Otherwise we would delay any
165 * grace period as long as we run in the idle task.
166 *
167 * Similarly, we avoid claiming an SRCU read lock held if the current
168 * CPU is offline.
169 */ 157 */
170static inline int srcu_read_lock_held(struct srcu_struct *sp) 158static inline int srcu_read_lock_held(struct srcu_struct *sp)
171{ 159{
172 if (!debug_lockdep_rcu_enabled()) 160 if (!debug_lockdep_rcu_enabled())
173 return 1; 161 return 1;
174 if (rcu_is_cpu_idle())
175 return 0;
176 if (!rcu_lockdep_current_cpu_online())
177 return 0;
178 return lock_is_held(&sp->dep_map); 162 return lock_is_held(&sp->dep_map);
179} 163}
180 164
@@ -236,8 +220,6 @@ static inline int srcu_read_lock(struct srcu_struct *sp) __acquires(sp)
236 int retval = __srcu_read_lock(sp); 220 int retval = __srcu_read_lock(sp);
237 221
238 rcu_lock_acquire(&(sp)->dep_map); 222 rcu_lock_acquire(&(sp)->dep_map);
239 rcu_lockdep_assert(!rcu_is_cpu_idle(),
240 "srcu_read_lock() used illegally while idle");
241 return retval; 223 return retval;
242} 224}
243 225
@@ -251,8 +233,6 @@ static inline int srcu_read_lock(struct srcu_struct *sp) __acquires(sp)
251static inline void srcu_read_unlock(struct srcu_struct *sp, int idx) 233static inline void srcu_read_unlock(struct srcu_struct *sp, int idx)
252 __releases(sp) 234 __releases(sp)
253{ 235{
254 rcu_lockdep_assert(!rcu_is_cpu_idle(),
255 "srcu_read_unlock() used illegally while idle");
256 rcu_lock_release(&(sp)->dep_map); 236 rcu_lock_release(&(sp)->dep_map);
257 __srcu_read_unlock(sp, idx); 237 __srcu_read_unlock(sp, idx);
258} 238}
diff --git a/include/linux/ssb/ssb_driver_gige.h b/include/linux/ssb/ssb_driver_gige.h
index 6b05dcd927ff..86a12b0cb239 100644
--- a/include/linux/ssb/ssb_driver_gige.h
+++ b/include/linux/ssb/ssb_driver_gige.h
@@ -97,21 +97,16 @@ static inline bool ssb_gige_must_flush_posted_writes(struct pci_dev *pdev)
97 return 0; 97 return 0;
98} 98}
99 99
100#ifdef CONFIG_BCM47XX
101#include <asm/mach-bcm47xx/nvram.h>
102/* Get the device MAC address */ 100/* Get the device MAC address */
103static inline void ssb_gige_get_macaddr(struct pci_dev *pdev, u8 *macaddr) 101static inline int ssb_gige_get_macaddr(struct pci_dev *pdev, u8 *macaddr)
104{
105 char buf[20];
106 if (nvram_getenv("et0macaddr", buf, sizeof(buf)) < 0)
107 return;
108 nvram_parse_macaddr(buf, macaddr);
109}
110#else
111static inline void ssb_gige_get_macaddr(struct pci_dev *pdev, u8 *macaddr)
112{ 102{
103 struct ssb_gige *dev = pdev_to_ssb_gige(pdev);
104 if (!dev)
105 return -ENODEV;
106
107 memcpy(macaddr, dev->dev->bus->sprom.et0mac, 6);
108 return 0;
113} 109}
114#endif
115 110
116extern int ssb_gige_pcibios_plat_dev_init(struct ssb_device *sdev, 111extern int ssb_gige_pcibios_plat_dev_init(struct ssb_device *sdev,
117 struct pci_dev *pdev); 112 struct pci_dev *pdev);
@@ -175,6 +170,10 @@ static inline bool ssb_gige_must_flush_posted_writes(struct pci_dev *pdev)
175{ 170{
176 return 0; 171 return 0;
177} 172}
173static inline int ssb_gige_get_macaddr(struct pci_dev *pdev, u8 *macaddr)
174{
175 return -ENODEV;
176}
178 177
179#endif /* CONFIG_SSB_DRIVER_GIGE */ 178#endif /* CONFIG_SSB_DRIVER_GIGE */
180#endif /* LINUX_SSB_DRIVER_GIGE_H_ */ 179#endif /* LINUX_SSB_DRIVER_GIGE_H_ */
diff --git a/include/linux/ssb/ssb_driver_mips.h b/include/linux/ssb/ssb_driver_mips.h
index 07a9c7a2e088..afe79d40a99e 100644
--- a/include/linux/ssb/ssb_driver_mips.h
+++ b/include/linux/ssb/ssb_driver_mips.h
@@ -45,6 +45,11 @@ void ssb_mipscore_init(struct ssb_mipscore *mcore)
45{ 45{
46} 46}
47 47
48static inline unsigned int ssb_mips_irq(struct ssb_device *dev)
49{
50 return 0;
51}
52
48#endif /* CONFIG_SSB_DRIVER_MIPS */ 53#endif /* CONFIG_SSB_DRIVER_MIPS */
49 54
50#endif /* LINUX_SSB_MIPSCORE_H_ */ 55#endif /* LINUX_SSB_MIPSCORE_H_ */
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h
index b64f8eb0b973..84ca436b76c2 100644
--- a/include/linux/sunrpc/sched.h
+++ b/include/linux/sunrpc/sched.h
@@ -87,7 +87,6 @@ struct rpc_task {
87 tk_cred_retry : 2, 87 tk_cred_retry : 2,
88 tk_rebind_retry : 2; 88 tk_rebind_retry : 2;
89}; 89};
90#define tk_xprt tk_client->cl_xprt
91 90
92/* support walking a list of tasks on a wait queue */ 91/* support walking a list of tasks on a wait queue */
93#define task_for_each(task, pos, head) \ 92#define task_for_each(task, pos, head) \
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
index 951cb9b7d02b..30834be03011 100644
--- a/include/linux/sunrpc/xprt.h
+++ b/include/linux/sunrpc/xprt.h
@@ -117,12 +117,12 @@ struct rpc_xprt_ops {
117 void (*alloc_slot)(struct rpc_xprt *xprt, struct rpc_task *task); 117 void (*alloc_slot)(struct rpc_xprt *xprt, struct rpc_task *task);
118 void (*rpcbind)(struct rpc_task *task); 118 void (*rpcbind)(struct rpc_task *task);
119 void (*set_port)(struct rpc_xprt *xprt, unsigned short port); 119 void (*set_port)(struct rpc_xprt *xprt, unsigned short port);
120 void (*connect)(struct rpc_task *task); 120 void (*connect)(struct rpc_xprt *xprt, struct rpc_task *task);
121 void * (*buf_alloc)(struct rpc_task *task, size_t size); 121 void * (*buf_alloc)(struct rpc_task *task, size_t size);
122 void (*buf_free)(void *buffer); 122 void (*buf_free)(void *buffer);
123 int (*send_request)(struct rpc_task *task); 123 int (*send_request)(struct rpc_task *task);
124 void (*set_retrans_timeout)(struct rpc_task *task); 124 void (*set_retrans_timeout)(struct rpc_task *task);
125 void (*timer)(struct rpc_task *task); 125 void (*timer)(struct rpc_xprt *xprt, struct rpc_task *task);
126 void (*release_request)(struct rpc_task *task); 126 void (*release_request)(struct rpc_task *task);
127 void (*close)(struct rpc_xprt *xprt); 127 void (*close)(struct rpc_xprt *xprt);
128 void (*destroy)(struct rpc_xprt *xprt); 128 void (*destroy)(struct rpc_xprt *xprt);
@@ -313,7 +313,7 @@ void xprt_set_retrans_timeout_rtt(struct rpc_task *task);
313void xprt_wake_pending_tasks(struct rpc_xprt *xprt, int status); 313void xprt_wake_pending_tasks(struct rpc_xprt *xprt, int status);
314void xprt_wait_for_buffer_space(struct rpc_task *task, rpc_action action); 314void xprt_wait_for_buffer_space(struct rpc_task *task, rpc_action action);
315void xprt_write_space(struct rpc_xprt *xprt); 315void xprt_write_space(struct rpc_xprt *xprt);
316void xprt_adjust_cwnd(struct rpc_task *task, int result); 316void xprt_adjust_cwnd(struct rpc_xprt *xprt, struct rpc_task *task, int result);
317struct rpc_rqst * xprt_lookup_rqst(struct rpc_xprt *xprt, __be32 xid); 317struct rpc_rqst * xprt_lookup_rqst(struct rpc_xprt *xprt, __be32 xid);
318void xprt_complete_rqst(struct rpc_task *task, int copied); 318void xprt_complete_rqst(struct rpc_task *task, int copied);
319void xprt_release_rqst_cong(struct rpc_task *task); 319void xprt_release_rqst_cong(struct rpc_task *task);
diff --git a/include/linux/sunserialcore.h b/include/linux/sunserialcore.h
index 68e7430bb0fe..dbe4d7fca1b8 100644
--- a/include/linux/sunserialcore.h
+++ b/include/linux/sunserialcore.h
@@ -13,6 +13,10 @@
13#ifndef _SERIAL_SUN_H 13#ifndef _SERIAL_SUN_H
14#define _SERIAL_SUN_H 14#define _SERIAL_SUN_H
15 15
16#include <linux/device.h>
17#include <linux/serial_core.h>
18#include <linux/console.h>
19
16/* Serial keyboard defines for L1-A processing... */ 20/* Serial keyboard defines for L1-A processing... */
17#define SUNKBD_RESET 0xff 21#define SUNKBD_RESET 0xff
18#define SUNKBD_L1 0x01 22#define SUNKBD_L1 0x01
diff --git a/include/linux/sunxi_timer.h b/include/linux/sunxi_timer.h
index b9165bba6e61..18081787e5f3 100644
--- a/include/linux/sunxi_timer.h
+++ b/include/linux/sunxi_timer.h
@@ -19,6 +19,6 @@
19 19
20#include <asm/mach/time.h> 20#include <asm/mach/time.h>
21 21
22extern struct sys_timer sunxi_timer; 22void sunxi_timer_init(void);
23 23
24#endif 24#endif
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index 0c808d7fa579..d4e3f16d5e89 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -34,8 +34,10 @@ static inline void pm_restore_console(void)
34typedef int __bitwise suspend_state_t; 34typedef int __bitwise suspend_state_t;
35 35
36#define PM_SUSPEND_ON ((__force suspend_state_t) 0) 36#define PM_SUSPEND_ON ((__force suspend_state_t) 0)
37#define PM_SUSPEND_STANDBY ((__force suspend_state_t) 1) 37#define PM_SUSPEND_FREEZE ((__force suspend_state_t) 1)
38#define PM_SUSPEND_STANDBY ((__force suspend_state_t) 2)
38#define PM_SUSPEND_MEM ((__force suspend_state_t) 3) 39#define PM_SUSPEND_MEM ((__force suspend_state_t) 3)
40#define PM_SUSPEND_MIN PM_SUSPEND_FREEZE
39#define PM_SUSPEND_MAX ((__force suspend_state_t) 4) 41#define PM_SUSPEND_MAX ((__force suspend_state_t) 4)
40 42
41enum suspend_stat_step { 43enum suspend_stat_step {
@@ -192,6 +194,7 @@ struct platform_suspend_ops {
192 */ 194 */
193extern void suspend_set_ops(const struct platform_suspend_ops *ops); 195extern void suspend_set_ops(const struct platform_suspend_ops *ops);
194extern int suspend_valid_only_mem(suspend_state_t state); 196extern int suspend_valid_only_mem(suspend_state_t state);
197extern void freeze_wake(void);
195 198
196/** 199/**
197 * arch_suspend_disable_irqs - disable IRQs for suspend 200 * arch_suspend_disable_irqs - disable IRQs for suspend
@@ -217,6 +220,7 @@ extern int pm_suspend(suspend_state_t state);
217 220
218static inline void suspend_set_ops(const struct platform_suspend_ops *ops) {} 221static inline void suspend_set_ops(const struct platform_suspend_ops *ops) {}
219static inline int pm_suspend(suspend_state_t state) { return -ENOSYS; } 222static inline int pm_suspend(suspend_state_t state) { return -ENOSYS; }
223static inline void freeze_wake(void) {}
220#endif /* !CONFIG_SUSPEND */ 224#endif /* !CONFIG_SUSPEND */
221 225
222/* struct pbe is used for creating lists of pages that should be restored 226/* struct pbe is used for creating lists of pages that should be restored
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index 381f06db2fe5..e2cee22f578a 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -181,6 +181,10 @@ int sysfs_merge_group(struct kobject *kobj,
181 const struct attribute_group *grp); 181 const struct attribute_group *grp);
182void sysfs_unmerge_group(struct kobject *kobj, 182void sysfs_unmerge_group(struct kobject *kobj,
183 const struct attribute_group *grp); 183 const struct attribute_group *grp);
184int sysfs_add_link_to_group(struct kobject *kobj, const char *group_name,
185 struct kobject *target, const char *link_name);
186void sysfs_remove_link_from_group(struct kobject *kobj, const char *group_name,
187 const char *link_name);
184 188
185void sysfs_notify(struct kobject *kobj, const char *dir, const char *attr); 189void sysfs_notify(struct kobject *kobj, const char *dir, const char *attr);
186void sysfs_notify_dirent(struct sysfs_dirent *sd); 190void sysfs_notify_dirent(struct sysfs_dirent *sd);
@@ -326,6 +330,18 @@ static inline void sysfs_unmerge_group(struct kobject *kobj,
326{ 330{
327} 331}
328 332
333static inline int sysfs_add_link_to_group(struct kobject *kobj,
334 const char *group_name, struct kobject *target,
335 const char *link_name)
336{
337 return 0;
338}
339
340static inline void sysfs_remove_link_from_group(struct kobject *kobj,
341 const char *group_name, const char *link_name)
342{
343}
344
329static inline void sysfs_notify(struct kobject *kobj, const char *dir, 345static inline void sysfs_notify(struct kobject *kobj, const char *dir,
330 const char *attr) 346 const char *attr)
331{ 347{
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 4e1d2283e3cc..f28408c07dc2 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -162,6 +162,8 @@ struct tcp_sock {
162 u32 rcv_tstamp; /* timestamp of last received ACK (for keepalives) */ 162 u32 rcv_tstamp; /* timestamp of last received ACK (for keepalives) */
163 u32 lsndtime; /* timestamp of last sent data packet (for restart window) */ 163 u32 lsndtime; /* timestamp of last sent data packet (for restart window) */
164 164
165 u32 tsoffset; /* timestamp offset */
166
165 struct list_head tsq_node; /* anchor in tsq_tasklet.head list */ 167 struct list_head tsq_node; /* anchor in tsq_tasklet.head list */
166 unsigned long tsq_flags; 168 unsigned long tsq_flags;
167 169
@@ -246,7 +248,6 @@ struct tcp_sock {
246 u32 sacked_out; /* SACK'd packets */ 248 u32 sacked_out; /* SACK'd packets */
247 u32 fackets_out; /* FACK'd packets */ 249 u32 fackets_out; /* FACK'd packets */
248 u32 tso_deferred; 250 u32 tso_deferred;
249 u32 bytes_acked; /* Appropriate Byte Counting - RFC3465 */
250 251
251 /* from STCP, retrans queue hinting */ 252 /* from STCP, retrans queue hinting */
252 struct sk_buff* lost_skb_hint; 253 struct sk_buff* lost_skb_hint;
@@ -354,6 +355,7 @@ struct tcp_timewait_sock {
354 u32 tw_rcv_nxt; 355 u32 tw_rcv_nxt;
355 u32 tw_snd_nxt; 356 u32 tw_snd_nxt;
356 u32 tw_rcv_wnd; 357 u32 tw_rcv_wnd;
358 u32 tw_ts_offset;
357 u32 tw_ts_recent; 359 u32 tw_ts_recent;
358 long tw_ts_recent_stamp; 360 long tw_ts_recent_stamp;
359#ifdef CONFIG_TCP_MD5SIG 361#ifdef CONFIG_TCP_MD5SIG
diff --git a/include/linux/tegra-soc.h b/include/linux/tegra-soc.h
new file mode 100644
index 000000000000..95f611d78f3a
--- /dev/null
+++ b/include/linux/tegra-soc.h
@@ -0,0 +1,22 @@
1/*
2 * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#ifndef __LINUX_TEGRA_SOC_H_
18#define __LINUX_TEGRA_SOC_H_
19
20u32 tegra_read_chipid(void);
21
22#endif /* __LINUX_TEGRA_SOC_H_ */
diff --git a/include/linux/tick.h b/include/linux/tick.h
index 1a6567b48492..553272e6af55 100644
--- a/include/linux/tick.h
+++ b/include/linux/tick.h
@@ -8,6 +8,8 @@
8 8
9#include <linux/clockchips.h> 9#include <linux/clockchips.h>
10#include <linux/irqflags.h> 10#include <linux/irqflags.h>
11#include <linux/percpu.h>
12#include <linux/hrtimer.h>
11 13
12#ifdef CONFIG_GENERIC_CLOCKEVENTS 14#ifdef CONFIG_GENERIC_CLOCKEVENTS
13 15
@@ -122,13 +124,26 @@ static inline int tick_oneshot_mode_active(void) { return 0; }
122#endif /* !CONFIG_GENERIC_CLOCKEVENTS */ 124#endif /* !CONFIG_GENERIC_CLOCKEVENTS */
123 125
124# ifdef CONFIG_NO_HZ 126# ifdef CONFIG_NO_HZ
127DECLARE_PER_CPU(struct tick_sched, tick_cpu_sched);
128
129static inline int tick_nohz_tick_stopped(void)
130{
131 return __this_cpu_read(tick_cpu_sched.tick_stopped);
132}
133
125extern void tick_nohz_idle_enter(void); 134extern void tick_nohz_idle_enter(void);
126extern void tick_nohz_idle_exit(void); 135extern void tick_nohz_idle_exit(void);
127extern void tick_nohz_irq_exit(void); 136extern void tick_nohz_irq_exit(void);
128extern ktime_t tick_nohz_get_sleep_length(void); 137extern ktime_t tick_nohz_get_sleep_length(void);
129extern u64 get_cpu_idle_time_us(int cpu, u64 *last_update_time); 138extern u64 get_cpu_idle_time_us(int cpu, u64 *last_update_time);
130extern u64 get_cpu_iowait_time_us(int cpu, u64 *last_update_time); 139extern u64 get_cpu_iowait_time_us(int cpu, u64 *last_update_time);
131# else 140
141# else /* !CONFIG_NO_HZ */
142static inline int tick_nohz_tick_stopped(void)
143{
144 return 0;
145}
146
132static inline void tick_nohz_idle_enter(void) { } 147static inline void tick_nohz_idle_enter(void) { }
133static inline void tick_nohz_idle_exit(void) { } 148static inline void tick_nohz_idle_exit(void) { }
134 149
diff --git a/include/linux/time.h b/include/linux/time.h
index 4d358e9d10f1..d4835dfdf25e 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -115,8 +115,20 @@ static inline bool timespec_valid_strict(const struct timespec *ts)
115 return true; 115 return true;
116} 116}
117 117
118extern bool persistent_clock_exist;
119
120#ifdef ALWAYS_USE_PERSISTENT_CLOCK
121#define has_persistent_clock() true
122#else
123static inline bool has_persistent_clock(void)
124{
125 return persistent_clock_exist;
126}
127#endif
128
118extern void read_persistent_clock(struct timespec *ts); 129extern void read_persistent_clock(struct timespec *ts);
119extern void read_boot_clock(struct timespec *ts); 130extern void read_boot_clock(struct timespec *ts);
131extern int persistent_clock_is_local;
120extern int update_persistent_clock(struct timespec now); 132extern int update_persistent_clock(struct timespec now);
121void timekeeping_init(void); 133void timekeeping_init(void);
122extern int timekeeping_suspended; 134extern int timekeeping_suspended;
@@ -142,9 +154,7 @@ void timekeeping_inject_sleeptime(struct timespec *delta);
142 * finer then tick granular time. 154 * finer then tick granular time.
143 */ 155 */
144#ifdef CONFIG_ARCH_USES_GETTIMEOFFSET 156#ifdef CONFIG_ARCH_USES_GETTIMEOFFSET
145extern u32 arch_gettimeoffset(void); 157extern u32 (*arch_gettimeoffset)(void);
146#else
147static inline u32 arch_gettimeoffset(void) { return 0; }
148#endif 158#endif
149 159
150extern void do_gettimeofday(struct timeval *tv); 160extern void do_gettimeofday(struct timeval *tv);
@@ -158,6 +168,7 @@ extern int do_setitimer(int which, struct itimerval *value,
158 struct itimerval *ovalue); 168 struct itimerval *ovalue);
159extern unsigned int alarm_setitimer(unsigned int seconds); 169extern unsigned int alarm_setitimer(unsigned int seconds);
160extern int do_getitimer(int which, struct itimerval *value); 170extern int do_getitimer(int which, struct itimerval *value);
171extern int __getnstimeofday(struct timespec *tv);
161extern void getnstimeofday(struct timespec *tv); 172extern void getnstimeofday(struct timespec *tv);
162extern void getrawmonotonic(struct timespec *ts); 173extern void getrawmonotonic(struct timespec *ts);
163extern void getnstime_raw_and_real(struct timespec *ts_raw, 174extern void getnstime_raw_and_real(struct timespec *ts_raw,
diff --git a/include/linux/tsacct_kern.h b/include/linux/tsacct_kern.h
index 44893e5ec8f7..3251965bf4cc 100644
--- a/include/linux/tsacct_kern.h
+++ b/include/linux/tsacct_kern.h
@@ -23,12 +23,15 @@ static inline void bacct_add_tsk(struct user_namespace *user_ns,
23#ifdef CONFIG_TASK_XACCT 23#ifdef CONFIG_TASK_XACCT
24extern void xacct_add_tsk(struct taskstats *stats, struct task_struct *p); 24extern void xacct_add_tsk(struct taskstats *stats, struct task_struct *p);
25extern void acct_update_integrals(struct task_struct *tsk); 25extern void acct_update_integrals(struct task_struct *tsk);
26extern void acct_account_cputime(struct task_struct *tsk);
26extern void acct_clear_integrals(struct task_struct *tsk); 27extern void acct_clear_integrals(struct task_struct *tsk);
27#else 28#else
28static inline void xacct_add_tsk(struct taskstats *stats, struct task_struct *p) 29static inline void xacct_add_tsk(struct taskstats *stats, struct task_struct *p)
29{} 30{}
30static inline void acct_update_integrals(struct task_struct *tsk) 31static inline void acct_update_integrals(struct task_struct *tsk)
31{} 32{}
33static inline void acct_account_cputime(struct task_struct *tsk)
34{}
32static inline void acct_clear_integrals(struct task_struct *tsk) 35static inline void acct_clear_integrals(struct task_struct *tsk)
33{} 36{}
34#endif /* CONFIG_TASK_XACCT */ 37#endif /* CONFIG_TASK_XACCT */
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 8db1b569c37a..c75d886b0307 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -202,7 +202,8 @@ struct tty_port {
202 unsigned long iflags; /* TTYP_ internal flags */ 202 unsigned long iflags; /* TTYP_ internal flags */
203#define TTYP_FLUSHING 1 /* Flushing to ldisc in progress */ 203#define TTYP_FLUSHING 1 /* Flushing to ldisc in progress */
204#define TTYP_FLUSHPENDING 2 /* Queued buffer flush pending */ 204#define TTYP_FLUSHPENDING 2 /* Queued buffer flush pending */
205 unsigned char console:1; /* port is a console */ 205 unsigned char console:1, /* port is a console */
206 low_latency:1; /* direct buffer flush */
206 struct mutex mutex; /* Locking */ 207 struct mutex mutex; /* Locking */
207 struct mutex buf_mutex; /* Buffer alloc lock */ 208 struct mutex buf_mutex; /* Buffer alloc lock */
208 unsigned char *xmit_buf; /* Optional buffer */ 209 unsigned char *xmit_buf; /* Optional buffer */
@@ -254,7 +255,7 @@ struct tty_struct {
254 int count; 255 int count;
255 struct winsize winsize; /* termios mutex */ 256 struct winsize winsize; /* termios mutex */
256 unsigned char stopped:1, hw_stopped:1, flow_stopped:1, packet:1; 257 unsigned char stopped:1, hw_stopped:1, flow_stopped:1, packet:1;
257 unsigned char low_latency:1, warned:1; 258 unsigned char warned:1;
258 unsigned char ctrl_status; /* ctrl_lock */ 259 unsigned char ctrl_status; /* ctrl_lock */
259 unsigned int receive_room; /* Bytes free for queue */ 260 unsigned int receive_room; /* Bytes free for queue */
260 261
@@ -317,11 +318,43 @@ struct tty_file_private {
317 318
318#define TTY_WRITE_FLUSH(tty) tty_write_flush((tty)) 319#define TTY_WRITE_FLUSH(tty) tty_write_flush((tty))
319 320
321#ifdef CONFIG_TTY
322extern void console_init(void);
323extern void tty_kref_put(struct tty_struct *tty);
324extern struct pid *tty_get_pgrp(struct tty_struct *tty);
325extern void tty_vhangup_self(void);
326extern void disassociate_ctty(int priv);
327extern dev_t tty_devnum(struct tty_struct *tty);
328extern void proc_clear_tty(struct task_struct *p);
329extern struct tty_struct *get_current_tty(void);
330/* tty_io.c */
331extern int __init tty_init(void);
332#else
333static inline void console_init(void)
334{ }
335static inline void tty_kref_put(struct tty_struct *tty)
336{ }
337static inline struct pid *tty_get_pgrp(struct tty_struct *tty)
338{ return NULL; }
339static inline void tty_vhangup_self(void)
340{ }
341static inline void disassociate_ctty(int priv)
342{ }
343static inline dev_t tty_devnum(struct tty_struct *tty)
344{ return 0; }
345static inline void proc_clear_tty(struct task_struct *p)
346{ }
347static inline struct tty_struct *get_current_tty(void)
348{ return NULL; }
349/* tty_io.c */
350static inline int __init tty_init(void)
351{ return 0; }
352#endif
353
320extern void tty_write_flush(struct tty_struct *); 354extern void tty_write_flush(struct tty_struct *);
321 355
322extern struct ktermios tty_std_termios; 356extern struct ktermios tty_std_termios;
323 357
324extern void console_init(void);
325extern int vcs_init(void); 358extern int vcs_init(void);
326 359
327extern struct class *tty_class; 360extern struct class *tty_class;
@@ -341,7 +374,6 @@ static inline struct tty_struct *tty_kref_get(struct tty_struct *tty)
341 kref_get(&tty->kref); 374 kref_get(&tty->kref);
342 return tty; 375 return tty;
343} 376}
344extern void tty_kref_put(struct tty_struct *tty);
345 377
346extern int tty_paranoia_check(struct tty_struct *tty, struct inode *inode, 378extern int tty_paranoia_check(struct tty_struct *tty, struct inode *inode,
347 const char *routine); 379 const char *routine);
@@ -373,20 +405,16 @@ extern void tty_driver_remove_tty(struct tty_driver *driver,
373 struct tty_struct *tty); 405 struct tty_struct *tty);
374extern void tty_free_termios(struct tty_struct *tty); 406extern void tty_free_termios(struct tty_struct *tty);
375extern int is_current_pgrp_orphaned(void); 407extern int is_current_pgrp_orphaned(void);
376extern struct pid *tty_get_pgrp(struct tty_struct *tty);
377extern int is_ignored(int sig); 408extern int is_ignored(int sig);
378extern int tty_signal(int sig, struct tty_struct *tty); 409extern int tty_signal(int sig, struct tty_struct *tty);
379extern void tty_hangup(struct tty_struct *tty); 410extern void tty_hangup(struct tty_struct *tty);
380extern void tty_vhangup(struct tty_struct *tty); 411extern void tty_vhangup(struct tty_struct *tty);
381extern void tty_vhangup_locked(struct tty_struct *tty); 412extern void tty_vhangup_locked(struct tty_struct *tty);
382extern void tty_vhangup_self(void);
383extern void tty_unhangup(struct file *filp); 413extern void tty_unhangup(struct file *filp);
384extern int tty_hung_up_p(struct file *filp); 414extern int tty_hung_up_p(struct file *filp);
385extern void do_SAK(struct tty_struct *tty); 415extern void do_SAK(struct tty_struct *tty);
386extern void __do_SAK(struct tty_struct *tty); 416extern void __do_SAK(struct tty_struct *tty);
387extern void disassociate_ctty(int priv);
388extern void no_tty(void); 417extern void no_tty(void);
389extern void tty_flip_buffer_push(struct tty_struct *tty);
390extern void tty_flush_to_ldisc(struct tty_struct *tty); 418extern void tty_flush_to_ldisc(struct tty_struct *tty);
391extern void tty_buffer_free_all(struct tty_port *port); 419extern void tty_buffer_free_all(struct tty_port *port);
392extern void tty_buffer_flush(struct tty_struct *tty); 420extern void tty_buffer_flush(struct tty_struct *tty);
@@ -415,9 +443,6 @@ extern long tty_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
415extern int tty_mode_ioctl(struct tty_struct *tty, struct file *file, 443extern int tty_mode_ioctl(struct tty_struct *tty, struct file *file,
416 unsigned int cmd, unsigned long arg); 444 unsigned int cmd, unsigned long arg);
417extern int tty_perform_flush(struct tty_struct *tty, unsigned long arg); 445extern int tty_perform_flush(struct tty_struct *tty, unsigned long arg);
418extern dev_t tty_devnum(struct tty_struct *tty);
419extern void proc_clear_tty(struct task_struct *p);
420extern struct tty_struct *get_current_tty(void);
421extern void tty_default_fops(struct file_operations *fops); 446extern void tty_default_fops(struct file_operations *fops);
422extern struct tty_struct *alloc_tty_struct(void); 447extern struct tty_struct *alloc_tty_struct(void);
423extern int tty_alloc_file(struct file *file); 448extern int tty_alloc_file(struct file *file);
@@ -543,9 +568,6 @@ static inline int tty_audit_push_task(struct task_struct *tsk,
543} 568}
544#endif 569#endif
545 570
546/* tty_io.c */
547extern int __init tty_init(void);
548
549/* tty_ioctl.c */ 571/* tty_ioctl.c */
550extern int n_tty_ioctl_helper(struct tty_struct *tty, struct file *file, 572extern int n_tty_ioctl_helper(struct tty_struct *tty, struct file *file,
551 unsigned int cmd, unsigned long arg); 573 unsigned int cmd, unsigned long arg);
diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h
index dd976cfb6131..756a60989294 100644
--- a/include/linux/tty_driver.h
+++ b/include/linux/tty_driver.h
@@ -40,6 +40,7 @@
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 * 44 *
44 * Required method. 45 * Required method.
45 * 46 *
diff --git a/include/linux/tty_flip.h b/include/linux/tty_flip.h
index 2002344ed36a..e0f252633b47 100644
--- a/include/linux/tty_flip.h
+++ b/include/linux/tty_flip.h
@@ -1,28 +1,34 @@
1#ifndef _LINUX_TTY_FLIP_H 1#ifndef _LINUX_TTY_FLIP_H
2#define _LINUX_TTY_FLIP_H 2#define _LINUX_TTY_FLIP_H
3 3
4extern int tty_buffer_request_room(struct tty_struct *tty, size_t size); 4extern int tty_buffer_request_room(struct tty_port *port, size_t size);
5extern int tty_insert_flip_string_flags(struct tty_struct *tty, const unsigned char *chars, const char *flags, size_t size); 5extern int tty_insert_flip_string_flags(struct tty_port *port,
6extern int tty_insert_flip_string_fixed_flag(struct tty_struct *tty, const unsigned char *chars, char flag, size_t size); 6 const unsigned char *chars, const char *flags, size_t size);
7extern int tty_prepare_flip_string(struct tty_struct *tty, unsigned char **chars, size_t size); 7extern int tty_insert_flip_string_fixed_flag(struct tty_port *port,
8extern int tty_prepare_flip_string_flags(struct tty_struct *tty, unsigned char **chars, char **flags, size_t size); 8 const unsigned char *chars, char flag, size_t size);
9void tty_schedule_flip(struct tty_struct *tty); 9extern int tty_prepare_flip_string(struct tty_port *port,
10 unsigned char **chars, size_t size);
11extern int tty_prepare_flip_string_flags(struct tty_port *port,
12 unsigned char **chars, char **flags, size_t size);
13extern void tty_flip_buffer_push(struct tty_port *port);
14void tty_schedule_flip(struct tty_port *port);
10 15
11static inline int tty_insert_flip_char(struct tty_struct *tty, 16static inline int tty_insert_flip_char(struct tty_port *port,
12 unsigned char ch, char flag) 17 unsigned char ch, char flag)
13{ 18{
14 struct tty_buffer *tb = tty->port->buf.tail; 19 struct tty_buffer *tb = port->buf.tail;
15 if (tb && tb->used < tb->size) { 20 if (tb && tb->used < tb->size) {
16 tb->flag_buf_ptr[tb->used] = flag; 21 tb->flag_buf_ptr[tb->used] = flag;
17 tb->char_buf_ptr[tb->used++] = ch; 22 tb->char_buf_ptr[tb->used++] = ch;
18 return 1; 23 return 1;
19 } 24 }
20 return tty_insert_flip_string_flags(tty, &ch, &flag, 1); 25 return tty_insert_flip_string_flags(port, &ch, &flag, 1);
21} 26}
22 27
23static inline int tty_insert_flip_string(struct tty_struct *tty, const unsigned char *chars, size_t size) 28static inline int tty_insert_flip_string(struct tty_port *port,
29 const unsigned char *chars, size_t size)
24{ 30{
25 return tty_insert_flip_string_fixed_flag(tty, chars, TTY_NORMAL, size); 31 return tty_insert_flip_string_fixed_flag(port, chars, TTY_NORMAL, size);
26} 32}
27 33
28#endif /* _LINUX_TTY_FLIP_H */ 34#endif /* _LINUX_TTY_FLIP_H */
diff --git a/include/linux/tty_ldisc.h b/include/linux/tty_ldisc.h
index fb79dd8d1537..455a0d7bf220 100644
--- a/include/linux/tty_ldisc.h
+++ b/include/linux/tty_ldisc.h
@@ -100,16 +100,14 @@
100 * seek to perform this action quickly but should wait until 100 * seek to perform this action quickly but should wait until
101 * any pending driver I/O is completed. 101 * any pending driver I/O is completed.
102 * 102 *
103 * void (*dcd_change)(struct tty_struct *tty, unsigned int status, 103 * void (*dcd_change)(struct tty_struct *tty, unsigned int status)
104 * struct pps_event_time *ts)
105 * 104 *
106 * Tells the discipline that the DCD pin has changed its status and 105 * Tells the discipline that the DCD pin has changed its status.
107 * the relative timestamp. Pointer ts cannot be NULL. 106 * Used exclusively by the N_PPS (Pulse-Per-Second) line discipline.
108 */ 107 */
109 108
110#include <linux/fs.h> 109#include <linux/fs.h>
111#include <linux/wait.h> 110#include <linux/wait.h>
112#include <linux/pps_kernel.h>
113#include <linux/wait.h> 111#include <linux/wait.h>
114 112
115struct tty_ldisc_ops { 113struct tty_ldisc_ops {
@@ -144,8 +142,7 @@ struct tty_ldisc_ops {
144 void (*receive_buf)(struct tty_struct *, const unsigned char *cp, 142 void (*receive_buf)(struct tty_struct *, const unsigned char *cp,
145 char *fp, int count); 143 char *fp, int count);
146 void (*write_wakeup)(struct tty_struct *); 144 void (*write_wakeup)(struct tty_struct *);
147 void (*dcd_change)(struct tty_struct *, unsigned int, 145 void (*dcd_change)(struct tty_struct *, unsigned int);
148 struct pps_event_time *);
149 146
150 struct module *owner; 147 struct module *owner;
151 148
diff --git a/include/linux/uprobes.h b/include/linux/uprobes.h
index 4f628a6fc5b4..02b83db8e2c5 100644
--- a/include/linux/uprobes.h
+++ b/include/linux/uprobes.h
@@ -35,13 +35,20 @@ struct inode;
35# include <asm/uprobes.h> 35# include <asm/uprobes.h>
36#endif 36#endif
37 37
38#define UPROBE_HANDLER_REMOVE 1
39#define UPROBE_HANDLER_MASK 1
40
41enum uprobe_filter_ctx {
42 UPROBE_FILTER_REGISTER,
43 UPROBE_FILTER_UNREGISTER,
44 UPROBE_FILTER_MMAP,
45};
46
38struct uprobe_consumer { 47struct uprobe_consumer {
39 int (*handler)(struct uprobe_consumer *self, struct pt_regs *regs); 48 int (*handler)(struct uprobe_consumer *self, struct pt_regs *regs);
40 /* 49 bool (*filter)(struct uprobe_consumer *self,
41 * filter is optional; If a filter exists, handler is run 50 enum uprobe_filter_ctx ctx,
42 * if and only if filter returns true. 51 struct mm_struct *mm);
43 */
44 bool (*filter)(struct uprobe_consumer *self, struct task_struct *task);
45 52
46 struct uprobe_consumer *next; 53 struct uprobe_consumer *next;
47}; 54};
@@ -94,6 +101,7 @@ extern int __weak set_swbp(struct arch_uprobe *aup, struct mm_struct *mm, unsign
94extern int __weak set_orig_insn(struct arch_uprobe *aup, struct mm_struct *mm, unsigned long vaddr); 101extern int __weak set_orig_insn(struct arch_uprobe *aup, struct mm_struct *mm, unsigned long vaddr);
95extern bool __weak is_swbp_insn(uprobe_opcode_t *insn); 102extern bool __weak is_swbp_insn(uprobe_opcode_t *insn);
96extern int uprobe_register(struct inode *inode, loff_t offset, struct uprobe_consumer *uc); 103extern int uprobe_register(struct inode *inode, loff_t offset, struct uprobe_consumer *uc);
104extern int uprobe_apply(struct inode *inode, loff_t offset, struct uprobe_consumer *uc, bool);
97extern void uprobe_unregister(struct inode *inode, loff_t offset, struct uprobe_consumer *uc); 105extern void uprobe_unregister(struct inode *inode, loff_t offset, struct uprobe_consumer *uc);
98extern int uprobe_mmap(struct vm_area_struct *vma); 106extern int uprobe_mmap(struct vm_area_struct *vma);
99extern void uprobe_munmap(struct vm_area_struct *vma, unsigned long start, unsigned long end); 107extern void uprobe_munmap(struct vm_area_struct *vma, unsigned long start, unsigned long end);
@@ -117,6 +125,11 @@ uprobe_register(struct inode *inode, loff_t offset, struct uprobe_consumer *uc)
117{ 125{
118 return -ENOSYS; 126 return -ENOSYS;
119} 127}
128static inline int
129uprobe_apply(struct inode *inode, loff_t offset, struct uprobe_consumer *uc, bool add)
130{
131 return -ENOSYS;
132}
120static inline void 133static inline void
121uprobe_unregister(struct inode *inode, loff_t offset, struct uprobe_consumer *uc) 134uprobe_unregister(struct inode *inode, loff_t offset, struct uprobe_consumer *uc)
122{ 135{
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 689b14b26c8d..4d22d0f6167a 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -357,6 +357,8 @@ struct usb_bus {
357 int bandwidth_int_reqs; /* number of Interrupt requests */ 357 int bandwidth_int_reqs; /* number of Interrupt requests */
358 int bandwidth_isoc_reqs; /* number of Isoc. requests */ 358 int bandwidth_isoc_reqs; /* number of Isoc. requests */
359 359
360 unsigned resuming_ports; /* bit array: resuming root-hub ports */
361
360#if defined(CONFIG_USB_MON) || defined(CONFIG_USB_MON_MODULE) 362#if defined(CONFIG_USB_MON) || defined(CONFIG_USB_MON_MODULE)
361 struct mon_bus *mon_bus; /* non-null when associated */ 363 struct mon_bus *mon_bus; /* non-null when associated */
362 int monitored; /* non-zero when monitored */ 364 int monitored; /* non-zero when monitored */
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h
index b09c37e04a91..3c671c1b37f6 100644
--- a/include/linux/usb/composite.h
+++ b/include/linux/usb/composite.h
@@ -77,6 +77,8 @@ struct usb_configuration;
77 * in interface or class descriptors; endpoints; I/O buffers; and so on. 77 * in interface or class descriptors; endpoints; I/O buffers; and so on.
78 * @unbind: Reverses @bind; called as a side effect of unregistering the 78 * @unbind: Reverses @bind; called as a side effect of unregistering the
79 * driver which added this function. 79 * driver which added this function.
80 * @free_func: free the struct usb_function.
81 * @mod: (internal) points to the module that created this structure.
80 * @set_alt: (REQUIRED) Reconfigures altsettings; function drivers may 82 * @set_alt: (REQUIRED) Reconfigures altsettings; function drivers may
81 * initialize usb_ep.driver data at this time (when it is used). 83 * initialize usb_ep.driver data at this time (when it is used).
82 * Note that setting an interface to its current altsetting resets 84 * Note that setting an interface to its current altsetting resets
@@ -116,6 +118,7 @@ struct usb_configuration;
116 * two or more distinct instances within the same configuration, providing 118 * two or more distinct instances within the same configuration, providing
117 * several independent logical data links to a USB host. 119 * several independent logical data links to a USB host.
118 */ 120 */
121
119struct usb_function { 122struct usb_function {
120 const char *name; 123 const char *name;
121 struct usb_gadget_strings **strings; 124 struct usb_gadget_strings **strings;
@@ -136,6 +139,8 @@ struct usb_function {
136 struct usb_function *); 139 struct usb_function *);
137 void (*unbind)(struct usb_configuration *, 140 void (*unbind)(struct usb_configuration *,
138 struct usb_function *); 141 struct usb_function *);
142 void (*free_func)(struct usb_function *f);
143 struct module *mod;
139 144
140 /* runtime state management */ 145 /* runtime state management */
141 int (*set_alt)(struct usb_function *, 146 int (*set_alt)(struct usb_function *,
@@ -156,6 +161,7 @@ struct usb_function {
156 /* internals */ 161 /* internals */
157 struct list_head list; 162 struct list_head list;
158 DECLARE_BITMAP(endpoints, 32); 163 DECLARE_BITMAP(endpoints, 32);
164 const struct usb_function_instance *fi;
159}; 165};
160 166
161int usb_add_function(struct usb_configuration *, struct usb_function *); 167int usb_add_function(struct usb_configuration *, struct usb_function *);
@@ -184,7 +190,8 @@ int config_ep_by_speed(struct usb_gadget *g, struct usb_function *f,
184 * @bConfigurationValue: Copied into configuration descriptor. 190 * @bConfigurationValue: Copied into configuration descriptor.
185 * @iConfiguration: Copied into configuration descriptor. 191 * @iConfiguration: Copied into configuration descriptor.
186 * @bmAttributes: Copied into configuration descriptor. 192 * @bmAttributes: Copied into configuration descriptor.
187 * @bMaxPower: Copied into configuration descriptor. 193 * @MaxPower: Power consumtion in mA. Used to compute bMaxPower in the
194 * configuration descriptor after considering the bus speed.
188 * @cdev: assigned by @usb_add_config() before calling @bind(); this is 195 * @cdev: assigned by @usb_add_config() before calling @bind(); this is
189 * the device associated with this configuration. 196 * the device associated with this configuration.
190 * 197 *
@@ -230,7 +237,7 @@ struct usb_configuration {
230 u8 bConfigurationValue; 237 u8 bConfigurationValue;
231 u8 iConfiguration; 238 u8 iConfiguration;
232 u8 bmAttributes; 239 u8 bmAttributes;
233 u8 bMaxPower; 240 u16 MaxPower;
234 241
235 struct usb_composite_dev *cdev; 242 struct usb_composite_dev *cdev;
236 243
@@ -316,7 +323,15 @@ struct usb_composite_driver {
316extern int usb_composite_probe(struct usb_composite_driver *driver); 323extern int usb_composite_probe(struct usb_composite_driver *driver);
317extern void usb_composite_unregister(struct usb_composite_driver *driver); 324extern void usb_composite_unregister(struct usb_composite_driver *driver);
318extern void usb_composite_setup_continue(struct usb_composite_dev *cdev); 325extern void usb_composite_setup_continue(struct usb_composite_dev *cdev);
326extern int composite_dev_prepare(struct usb_composite_driver *composite,
327 struct usb_composite_dev *cdev);
328void composite_dev_cleanup(struct usb_composite_dev *cdev);
319 329
330static inline struct usb_composite_driver *to_cdriver(
331 struct usb_gadget_driver *gdrv)
332{
333 return container_of(gdrv, struct usb_composite_driver, gadget_driver);
334}
320 335
321/** 336/**
322 * struct usb_composite_device - represents one composite usb gadget 337 * struct usb_composite_device - represents one composite usb gadget
@@ -360,6 +375,7 @@ struct usb_composite_dev {
360 unsigned int suspended:1; 375 unsigned int suspended:1;
361 struct usb_device_descriptor desc; 376 struct usb_device_descriptor desc;
362 struct list_head configs; 377 struct list_head configs;
378 struct list_head gstrings;
363 struct usb_composite_driver *driver; 379 struct usb_composite_driver *driver;
364 u8 next_string_id; 380 u8 next_string_id;
365 char *def_manufacturer; 381 char *def_manufacturer;
@@ -381,8 +397,15 @@ struct usb_composite_dev {
381extern int usb_string_id(struct usb_composite_dev *c); 397extern int usb_string_id(struct usb_composite_dev *c);
382extern int usb_string_ids_tab(struct usb_composite_dev *c, 398extern int usb_string_ids_tab(struct usb_composite_dev *c,
383 struct usb_string *str); 399 struct usb_string *str);
400extern struct usb_string *usb_gstrings_attach(struct usb_composite_dev *cdev,
401 struct usb_gadget_strings **sp, unsigned n_strings);
402
384extern int usb_string_ids_n(struct usb_composite_dev *c, unsigned n); 403extern int usb_string_ids_n(struct usb_composite_dev *c, unsigned n);
385 404
405extern void composite_disconnect(struct usb_gadget *gadget);
406extern int composite_setup(struct usb_gadget *gadget,
407 const struct usb_ctrlrequest *ctrl);
408
386/* 409/*
387 * Some systems will need runtime overrides for the product identifiers 410 * Some systems will need runtime overrides for the product identifiers
388 * published in the device descriptor, either numbers or strings or both. 411 * published in the device descriptor, either numbers or strings or both.
@@ -431,6 +454,54 @@ static inline u16 get_default_bcdDevice(void)
431 return bcdDevice; 454 return bcdDevice;
432} 455}
433 456
457struct usb_function_driver {
458 const char *name;
459 struct module *mod;
460 struct list_head list;
461 struct usb_function_instance *(*alloc_inst)(void);
462 struct usb_function *(*alloc_func)(struct usb_function_instance *inst);
463};
464
465struct usb_function_instance {
466 struct usb_function_driver *fd;
467 void (*free_func_inst)(struct usb_function_instance *inst);
468};
469
470void usb_function_unregister(struct usb_function_driver *f);
471int usb_function_register(struct usb_function_driver *newf);
472void usb_put_function_instance(struct usb_function_instance *fi);
473void usb_put_function(struct usb_function *f);
474struct usb_function_instance *usb_get_function_instance(const char *name);
475struct usb_function *usb_get_function(struct usb_function_instance *fi);
476
477struct usb_configuration *usb_get_config(struct usb_composite_dev *cdev,
478 int val);
479int usb_add_config_only(struct usb_composite_dev *cdev,
480 struct usb_configuration *config);
481void usb_remove_function(struct usb_configuration *c, struct usb_function *f);
482
483#define DECLARE_USB_FUNCTION(_name, _inst_alloc, _func_alloc) \
484 static struct usb_function_driver _name ## usb_func = { \
485 .name = __stringify(_name), \
486 .mod = THIS_MODULE, \
487 .alloc_inst = _inst_alloc, \
488 .alloc_func = _func_alloc, \
489 }; \
490 MODULE_ALIAS("usbfunc:"__stringify(_name));
491
492#define DECLARE_USB_FUNCTION_INIT(_name, _inst_alloc, _func_alloc) \
493 DECLARE_USB_FUNCTION(_name, _inst_alloc, _func_alloc) \
494 static int __init _name ## mod_init(void) \
495 { \
496 return usb_function_register(&_name ## usb_func); \
497 } \
498 static void __exit _name ## mod_exit(void) \
499 { \
500 usb_function_unregister(&_name ## usb_func); \
501 } \
502 module_init(_name ## mod_init); \
503 module_exit(_name ## mod_exit)
504
434/* messaging utils */ 505/* messaging utils */
435#define DBG(d, fmt, args...) \ 506#define DBG(d, fmt, args...) \
436 dev_dbg(&(d)->gadget->dev , fmt , ## args) 507 dev_dbg(&(d)->gadget->dev , fmt , ## args)
diff --git a/include/linux/usb/dwc3-omap.h b/include/linux/usb/dwc3-omap.h
new file mode 100644
index 000000000000..51eae14477f7
--- /dev/null
+++ b/include/linux/usb/dwc3-omap.h
@@ -0,0 +1,30 @@
1/*
2 * Copyright (C) 2013 by Texas Instruments
3 *
4 * The Inventra Controller Driver for Linux is free software; you
5 * can redistribute it and/or modify it under the terms of the GNU
6 * General Public License version 2 as published by the Free Software
7 * Foundation.
8 */
9
10#ifndef __DWC3_OMAP_H__
11#define __DWC3_OMAP_H__
12
13enum omap_dwc3_vbus_id_status {
14 OMAP_DWC3_UNKNOWN = 0,
15 OMAP_DWC3_ID_GROUND,
16 OMAP_DWC3_ID_FLOAT,
17 OMAP_DWC3_VBUS_VALID,
18 OMAP_DWC3_VBUS_OFF,
19};
20
21#if (defined(CONFIG_USB_DWC3) || defined(CONFIG_USB_DWC3_MODULE))
22extern void dwc3_omap_mailbox(enum omap_dwc3_vbus_id_status status);
23#else
24static inline void dwc3_omap_mailbox(enum omap_dwc3_vbus_id_status status)
25{
26 return;
27}
28#endif
29
30#endif /* __DWC3_OMAP_H__ */
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index 0af6569b8cc6..2e297e80d59a 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -471,12 +471,6 @@ struct usb_gadget_ops {
471 struct usb_gadget_driver *); 471 struct usb_gadget_driver *);
472 int (*udc_stop)(struct usb_gadget *, 472 int (*udc_stop)(struct usb_gadget *,
473 struct usb_gadget_driver *); 473 struct usb_gadget_driver *);
474
475 /* Those two are deprecated */
476 int (*start)(struct usb_gadget_driver *,
477 int (*bind)(struct usb_gadget *,
478 struct usb_gadget_driver *driver));
479 int (*stop)(struct usb_gadget_driver *);
480}; 474};
481 475
482/** 476/**
@@ -880,6 +874,8 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver);
880 874
881extern int usb_add_gadget_udc(struct device *parent, struct usb_gadget *gadget); 875extern int usb_add_gadget_udc(struct device *parent, struct usb_gadget *gadget);
882extern void usb_del_gadget_udc(struct usb_gadget *gadget); 876extern void usb_del_gadget_udc(struct usb_gadget *gadget);
877extern int udc_attach_driver(const char *name,
878 struct usb_gadget_driver *driver);
883 879
884/*-------------------------------------------------------------------------*/ 880/*-------------------------------------------------------------------------*/
885 881
@@ -911,6 +907,11 @@ struct usb_gadget_strings {
911 struct usb_string *strings; 907 struct usb_string *strings;
912}; 908};
913 909
910struct usb_gadget_string_container {
911 struct list_head list;
912 u8 *stash[0];
913};
914
914/* put descriptor for string with that id into buf (buflen >= 256) */ 915/* put descriptor for string with that id into buf (buflen >= 256) */
915int usb_gadget_get_string(struct usb_gadget_strings *table, int id, u8 *buf); 916int usb_gadget_get_string(struct usb_gadget_strings *table, int id, u8 *buf);
916 917
diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h
index 608050b2545f..0a78df5f6cfd 100644
--- a/include/linux/usb/hcd.h
+++ b/include/linux/usb/hcd.h
@@ -430,6 +430,9 @@ extern void usb_hcd_poll_rh_status(struct usb_hcd *hcd);
430extern void usb_wakeup_notification(struct usb_device *hdev, 430extern void usb_wakeup_notification(struct usb_device *hdev,
431 unsigned int portnum); 431 unsigned int portnum);
432 432
433extern void usb_hcd_start_port_resume(struct usb_bus *bus, int portnum);
434extern void usb_hcd_end_port_resume(struct usb_bus *bus, int portnum);
435
433/* The D0/D1 toggle bits ... USE WITH CAUTION (they're almost hcd-internal) */ 436/* The D0/D1 toggle bits ... USE WITH CAUTION (they're almost hcd-internal) */
434#define usb_gettoggle(dev, ep, out) (((dev)->toggle[out] >> (ep)) & 1) 437#define usb_gettoggle(dev, ep, out) (((dev)->toggle[out] >> (ep)) & 1)
435#define usb_dotoggle(dev, ep, out) ((dev)->toggle[out] ^= (1 << (ep))) 438#define usb_dotoggle(dev, ep, out) ((dev)->toggle[out] ^= (1 << (ep)))
diff --git a/include/linux/usb/musb.h b/include/linux/usb/musb.h
index eb505250940a..053c26841cc3 100644
--- a/include/linux/usb/musb.h
+++ b/include/linux/usb/musb.h
@@ -99,6 +99,8 @@ struct musb_hdrc_platform_data {
99 /* MUSB_HOST, MUSB_PERIPHERAL, or MUSB_OTG */ 99 /* MUSB_HOST, MUSB_PERIPHERAL, or MUSB_OTG */
100 u8 mode; 100 u8 mode;
101 101
102 u8 has_mailbox:1;
103
102 /* for clk_get() */ 104 /* for clk_get() */
103 const char *clock; 105 const char *clock;
104 106
diff --git a/include/linux/usb/omap_control_usb.h b/include/linux/usb/omap_control_usb.h
new file mode 100644
index 000000000000..27b5b8c931b0
--- /dev/null
+++ b/include/linux/usb/omap_control_usb.h
@@ -0,0 +1,92 @@
1/*
2 * omap_control_usb.h - Header file for the USB part of control module.
3 *
4 * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com
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; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * Author: Kishon Vijay Abraham I <kishon@ti.com>
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 */
18
19#ifndef __OMAP_CONTROL_USB_H__
20#define __OMAP_CONTROL_USB_H__
21
22struct omap_control_usb {
23 struct device *dev;
24
25 u32 __iomem *dev_conf;
26 u32 __iomem *otghs_control;
27 u32 __iomem *phy_power;
28
29 struct clk *sys_clk;
30
31 u32 type;
32};
33
34struct omap_control_usb_platform_data {
35 u8 type;
36};
37
38enum omap_control_usb_mode {
39 USB_MODE_UNDEFINED = 0,
40 USB_MODE_HOST,
41 USB_MODE_DEVICE,
42 USB_MODE_DISCONNECT,
43};
44
45/* To differentiate ctrl module IP having either mailbox or USB3 PHY power */
46#define OMAP_CTRL_DEV_TYPE1 0x1
47#define OMAP_CTRL_DEV_TYPE2 0x2
48
49#define OMAP_CTRL_DEV_PHY_PD BIT(0)
50
51#define OMAP_CTRL_DEV_AVALID BIT(0)
52#define OMAP_CTRL_DEV_BVALID BIT(1)
53#define OMAP_CTRL_DEV_VBUSVALID BIT(2)
54#define OMAP_CTRL_DEV_SESSEND BIT(3)
55#define OMAP_CTRL_DEV_IDDIG BIT(4)
56
57#define OMAP_CTRL_USB_PWRCTL_CLK_CMD_MASK 0x003FC000
58#define OMAP_CTRL_USB_PWRCTL_CLK_CMD_SHIFT 0xE
59
60#define OMAP_CTRL_USB_PWRCTL_CLK_FREQ_MASK 0xFFC00000
61#define OMAP_CTRL_USB_PWRCTL_CLK_FREQ_SHIFT 0x16
62
63#define OMAP_CTRL_USB3_PHY_TX_RX_POWERON 0x3
64#define OMAP_CTRL_USB3_PHY_TX_RX_POWEROFF 0x0
65
66#if IS_ENABLED(CONFIG_OMAP_CONTROL_USB)
67extern struct device *omap_get_control_dev(void);
68extern void omap_control_usb_phy_power(struct device *dev, int on);
69extern void omap_control_usb3_phy_power(struct device *dev, bool on);
70extern void omap_control_usb_set_mode(struct device *dev,
71 enum omap_control_usb_mode mode);
72#else
73static inline struct device *omap_get_control_dev(void)
74{
75 return ERR_PTR(-ENODEV);
76}
77
78static inline void omap_control_usb_phy_power(struct device *dev, int on)
79{
80}
81
82static inline void omap_control_usb3_phy_power(struct device *dev, int on)
83{
84}
85
86static inline void omap_control_usb_set_mode(struct device *dev,
87 enum omap_control_usb_mode mode)
88{
89}
90#endif
91
92#endif /* __OMAP_CONTROL_USB_H__ */
diff --git a/include/linux/usb/omap_usb.h b/include/linux/usb/omap_usb.h
index 0ea17f8ae820..6ae29360e1d2 100644
--- a/include/linux/usb/omap_usb.h
+++ b/include/linux/usb/omap_usb.h
@@ -19,19 +19,29 @@
19#ifndef __DRIVERS_OMAP_USB2_H 19#ifndef __DRIVERS_OMAP_USB2_H
20#define __DRIVERS_OMAP_USB2_H 20#define __DRIVERS_OMAP_USB2_H
21 21
22#include <linux/io.h>
22#include <linux/usb/otg.h> 23#include <linux/usb/otg.h>
23 24
25struct usb_dpll_params {
26 u16 m;
27 u8 n;
28 u8 freq:3;
29 u8 sd;
30 u32 mf;
31};
32
24struct omap_usb { 33struct omap_usb {
25 struct usb_phy phy; 34 struct usb_phy phy;
26 struct phy_companion *comparator; 35 struct phy_companion *comparator;
36 void __iomem *pll_ctrl_base;
27 struct device *dev; 37 struct device *dev;
28 u32 __iomem *control_dev; 38 struct device *control_dev;
29 struct clk *wkupclk; 39 struct clk *wkupclk;
40 struct clk *sys_clk;
41 struct clk *optclk;
30 u8 is_suspended:1; 42 u8 is_suspended:1;
31}; 43};
32 44
33#define PHY_PD 0x1
34
35#define phy_to_omapusb(x) container_of((x), struct omap_usb, phy) 45#define phy_to_omapusb(x) container_of((x), struct omap_usb, phy)
36 46
37#if defined(CONFIG_OMAP_USB2) || defined(CONFIG_OMAP_USB2_MODULE) 47#if defined(CONFIG_OMAP_USB2) || defined(CONFIG_OMAP_USB2_MODULE)
@@ -43,4 +53,15 @@ static inline int omap_usb2_set_comparator(struct phy_companion *comparator)
43} 53}
44#endif 54#endif
45 55
56static inline u32 omap_usb_readl(void __iomem *addr, unsigned offset)
57{
58 return __raw_readl(addr + offset);
59}
60
61static inline void omap_usb_writel(void __iomem *addr, unsigned offset,
62 u32 data)
63{
64 __raw_writel(data, addr + offset);
65}
66
46#endif /* __DRIVERS_OMAP_USB_H */ 67#endif /* __DRIVERS_OMAP_USB_H */
diff --git a/include/linux/usb/phy.h b/include/linux/usb/phy.h
index a29ae1eb9346..15847cbdb512 100644
--- a/include/linux/usb/phy.h
+++ b/include/linux/usb/phy.h
@@ -106,9 +106,25 @@ struct usb_phy {
106 enum usb_device_speed speed); 106 enum usb_device_speed speed);
107}; 107};
108 108
109/**
110 * struct usb_phy_bind - represent the binding for the phy
111 * @dev_name: the device name of the device that will bind to the phy
112 * @phy_dev_name: the device name of the phy
113 * @index: used if a single controller uses multiple phys
114 * @phy: reference to the phy
115 * @list: to maintain a linked list of the binding information
116 */
117struct usb_phy_bind {
118 const char *dev_name;
119 const char *phy_dev_name;
120 u8 index;
121 struct usb_phy *phy;
122 struct list_head list;
123};
109 124
110/* for board-specific init logic */ 125/* for board-specific init logic */
111extern int usb_add_phy(struct usb_phy *, enum usb_phy_type type); 126extern int usb_add_phy(struct usb_phy *, enum usb_phy_type type);
127extern int usb_add_phy_dev(struct usb_phy *);
112extern void usb_remove_phy(struct usb_phy *); 128extern void usb_remove_phy(struct usb_phy *);
113 129
114/* helpers for direct access thru low-level io interface */ 130/* helpers for direct access thru low-level io interface */
@@ -149,8 +165,14 @@ usb_phy_shutdown(struct usb_phy *x)
149extern struct usb_phy *usb_get_phy(enum usb_phy_type type); 165extern struct usb_phy *usb_get_phy(enum usb_phy_type type);
150extern struct usb_phy *devm_usb_get_phy(struct device *dev, 166extern struct usb_phy *devm_usb_get_phy(struct device *dev,
151 enum usb_phy_type type); 167 enum usb_phy_type type);
168extern struct usb_phy *usb_get_phy_dev(struct device *dev, u8 index);
169extern struct usb_phy *devm_usb_get_phy_dev(struct device *dev, u8 index);
170extern struct usb_phy *devm_usb_get_phy_by_phandle(struct device *dev,
171 const char *phandle, u8 index);
152extern void usb_put_phy(struct usb_phy *); 172extern void usb_put_phy(struct usb_phy *);
153extern void devm_usb_put_phy(struct device *dev, struct usb_phy *x); 173extern void devm_usb_put_phy(struct device *dev, struct usb_phy *x);
174extern int usb_bind_phy(const char *dev_name, u8 index,
175 const char *phy_dev_name);
154#else 176#else
155static inline struct usb_phy *usb_get_phy(enum usb_phy_type type) 177static inline struct usb_phy *usb_get_phy(enum usb_phy_type type)
156{ 178{
@@ -163,6 +185,22 @@ static inline struct usb_phy *devm_usb_get_phy(struct device *dev,
163 return NULL; 185 return NULL;
164} 186}
165 187
188static inline struct usb_phy *usb_get_phy_dev(struct device *dev, u8 index)
189{
190 return NULL;
191}
192
193static inline struct usb_phy *devm_usb_get_phy_dev(struct device *dev, u8 index)
194{
195 return NULL;
196}
197
198static inline struct usb_phy *devm_usb_get_phy_by_phandle(struct device *dev,
199 const char *phandle, u8 index)
200{
201 return NULL;
202}
203
166static inline void usb_put_phy(struct usb_phy *x) 204static inline void usb_put_phy(struct usb_phy *x)
167{ 205{
168} 206}
@@ -171,6 +209,11 @@ static inline void devm_usb_put_phy(struct device *dev, struct usb_phy *x)
171{ 209{
172} 210}
173 211
212static inline int usb_bind_phy(const char *dev_name, u8 index,
213 const char *phy_dev_name)
214{
215 return -EOPNOTSUPP;
216}
174#endif 217#endif
175 218
176static inline int 219static inline int
diff --git a/include/linux/usb/samsung_usb_phy.h b/include/linux/usb/samsung_usb_phy.h
new file mode 100644
index 000000000000..916782699f1c
--- /dev/null
+++ b/include/linux/usb/samsung_usb_phy.h
@@ -0,0 +1,16 @@
1/*
2 * Copyright (C) 2012 Samsung Electronics Co.Ltd
3 * http://www.samsung.com/
4 *
5 * Defines phy types for samsung usb phy controllers - HOST or DEIVCE.
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 */
12
13enum samsung_usb_phy_type {
14 USB_PHY_TYPE_DEVICE,
15 USB_PHY_TYPE_HOST,
16};
diff --git a/include/linux/usb/tegra_usb_phy.h b/include/linux/usb/tegra_usb_phy.h
index 176b1ca06ae4..9ebebe906925 100644
--- a/include/linux/usb/tegra_usb_phy.h
+++ b/include/linux/usb/tegra_usb_phy.h
@@ -59,22 +59,24 @@ struct tegra_usb_phy {
59 struct usb_phy *ulpi; 59 struct usb_phy *ulpi;
60 struct usb_phy u_phy; 60 struct usb_phy u_phy;
61 struct device *dev; 61 struct device *dev;
62 bool is_legacy_phy;
63 bool is_ulpi_phy;
62}; 64};
63 65
64struct tegra_usb_phy *tegra_usb_phy_open(struct device *dev, int instance, 66struct tegra_usb_phy *tegra_usb_phy_open(struct device *dev, int instance,
65 void __iomem *regs, void *config, enum tegra_usb_phy_mode phy_mode); 67 void __iomem *regs, void *config, enum tegra_usb_phy_mode phy_mode);
66 68
67void tegra_usb_phy_clk_disable(struct tegra_usb_phy *phy); 69void tegra_usb_phy_preresume(struct usb_phy *phy);
68 70
69void tegra_usb_phy_clk_enable(struct tegra_usb_phy *phy); 71void tegra_usb_phy_postresume(struct usb_phy *phy);
70 72
71void tegra_usb_phy_preresume(struct tegra_usb_phy *phy); 73void tegra_ehci_phy_restore_start(struct usb_phy *phy,
74 enum tegra_usb_phy_port_speed port_speed);
72 75
73void tegra_usb_phy_postresume(struct tegra_usb_phy *phy); 76void tegra_ehci_phy_restore_end(struct usb_phy *phy);
74 77
75void tegra_ehci_phy_restore_start(struct tegra_usb_phy *phy, 78void tegra_ehci_set_pts(struct usb_phy *x, u8 pts_val);
76 enum tegra_usb_phy_port_speed port_speed);
77 79
78void tegra_ehci_phy_restore_end(struct tegra_usb_phy *phy); 80void tegra_ehci_set_phcd(struct usb_phy *x, bool enable);
79 81
80#endif /* __TEGRA_USB_PHY_H */ 82#endif /* __TEGRA_USB_PHY_H */
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
index bd45eb7bedc8..0e5ac93bab10 100644
--- a/include/linux/usb/usbnet.h
+++ b/include/linux/usb/usbnet.h
@@ -33,6 +33,7 @@ struct usbnet {
33 wait_queue_head_t *wait; 33 wait_queue_head_t *wait;
34 struct mutex phy_mutex; 34 struct mutex phy_mutex;
35 unsigned char suspend_count; 35 unsigned char suspend_count;
36 unsigned char pkt_cnt, pkt_err;
36 37
37 /* i/o info: pipes etc */ 38 /* i/o info: pipes etc */
38 unsigned in, out; 39 unsigned in, out;
@@ -70,6 +71,7 @@ struct usbnet {
70# define EVENT_DEV_OPEN 7 71# define EVENT_DEV_OPEN 7
71# define EVENT_DEVICE_REPORT_IDLE 8 72# define EVENT_DEVICE_REPORT_IDLE 8
72# define EVENT_NO_RUNTIME_PM 9 73# define EVENT_NO_RUNTIME_PM 9
74# define EVENT_RX_KILL 10
73}; 75};
74 76
75static inline struct usb_driver *driver_of(struct usb_interface *intf) 77static inline struct usb_driver *driver_of(struct usb_interface *intf)
@@ -107,6 +109,7 @@ struct driver_info {
107 */ 109 */
108#define FLAG_MULTI_PACKET 0x2000 110#define FLAG_MULTI_PACKET 0x2000
109#define FLAG_RX_ASSEMBLE 0x4000 /* rx packets may span >1 frames */ 111#define FLAG_RX_ASSEMBLE 0x4000 /* rx packets may span >1 frames */
112#define FLAG_NOARP 0x8000 /* device can't do ARP */
110 113
111 /* init device ... can sleep, or cause probe() failure */ 114 /* init device ... can sleep, or cause probe() failure */
112 int (*bind)(struct usbnet *, struct usb_interface *); 115 int (*bind)(struct usbnet *, struct usb_interface *);
diff --git a/include/linux/vmw_vmci_api.h b/include/linux/vmw_vmci_api.h
new file mode 100644
index 000000000000..023430e265fe
--- /dev/null
+++ b/include/linux/vmw_vmci_api.h
@@ -0,0 +1,82 @@
1/*
2 * VMware VMCI Driver
3 *
4 * Copyright (C) 2012 VMware, Inc. All rights reserved.
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 version 2 and no later version.
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 MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * for more details.
14 */
15
16#ifndef __VMW_VMCI_API_H__
17#define __VMW_VMCI_API_H__
18
19#include <linux/uidgid.h>
20#include <linux/vmw_vmci_defs.h>
21
22#undef VMCI_KERNEL_API_VERSION
23#define VMCI_KERNEL_API_VERSION_1 1
24#define VMCI_KERNEL_API_VERSION_2 2
25#define VMCI_KERNEL_API_VERSION VMCI_KERNEL_API_VERSION_2
26
27typedef void (vmci_device_shutdown_fn) (void *device_registration,
28 void *user_data);
29
30int vmci_datagram_create_handle(u32 resource_id, u32 flags,
31 vmci_datagram_recv_cb recv_cb,
32 void *client_data,
33 struct vmci_handle *out_handle);
34int vmci_datagram_create_handle_priv(u32 resource_id, u32 flags, u32 priv_flags,
35 vmci_datagram_recv_cb recv_cb,
36 void *client_data,
37 struct vmci_handle *out_handle);
38int vmci_datagram_destroy_handle(struct vmci_handle handle);
39int vmci_datagram_send(struct vmci_datagram *msg);
40int vmci_doorbell_create(struct vmci_handle *handle, u32 flags,
41 u32 priv_flags,
42 vmci_callback notify_cb, void *client_data);
43int vmci_doorbell_destroy(struct vmci_handle handle);
44int vmci_doorbell_notify(struct vmci_handle handle, u32 priv_flags);
45u32 vmci_get_context_id(void);
46bool vmci_is_context_owner(u32 context_id, kuid_t uid);
47
48int vmci_event_subscribe(u32 event,
49 vmci_event_cb callback, void *callback_data,
50 u32 *subid);
51int vmci_event_unsubscribe(u32 subid);
52u32 vmci_context_get_priv_flags(u32 context_id);
53int vmci_qpair_alloc(struct vmci_qp **qpair,
54 struct vmci_handle *handle,
55 u64 produce_qsize,
56 u64 consume_qsize,
57 u32 peer, u32 flags, u32 priv_flags);
58int vmci_qpair_detach(struct vmci_qp **qpair);
59int vmci_qpair_get_produce_indexes(const struct vmci_qp *qpair,
60 u64 *producer_tail,
61 u64 *consumer_head);
62int vmci_qpair_get_consume_indexes(const struct vmci_qp *qpair,
63 u64 *consumer_tail,
64 u64 *producer_head);
65s64 vmci_qpair_produce_free_space(const struct vmci_qp *qpair);
66s64 vmci_qpair_produce_buf_ready(const struct vmci_qp *qpair);
67s64 vmci_qpair_consume_free_space(const struct vmci_qp *qpair);
68s64 vmci_qpair_consume_buf_ready(const struct vmci_qp *qpair);
69ssize_t vmci_qpair_enqueue(struct vmci_qp *qpair,
70 const void *buf, size_t buf_size, int mode);
71ssize_t vmci_qpair_dequeue(struct vmci_qp *qpair,
72 void *buf, size_t buf_size, int mode);
73ssize_t vmci_qpair_peek(struct vmci_qp *qpair, void *buf, size_t buf_size,
74 int mode);
75ssize_t vmci_qpair_enquev(struct vmci_qp *qpair,
76 void *iov, size_t iov_size, int mode);
77ssize_t vmci_qpair_dequev(struct vmci_qp *qpair,
78 void *iov, size_t iov_size, int mode);
79ssize_t vmci_qpair_peekv(struct vmci_qp *qpair, void *iov, size_t iov_size,
80 int mode);
81
82#endif /* !__VMW_VMCI_API_H__ */
diff --git a/include/linux/vmw_vmci_defs.h b/include/linux/vmw_vmci_defs.h
new file mode 100644
index 000000000000..65ac54c61c18
--- /dev/null
+++ b/include/linux/vmw_vmci_defs.h
@@ -0,0 +1,880 @@
1/*
2 * VMware VMCI Driver
3 *
4 * Copyright (C) 2012 VMware, Inc. All rights reserved.
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 version 2 and no later version.
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 MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * for more details.
14 */
15
16#ifndef _VMW_VMCI_DEF_H_
17#define _VMW_VMCI_DEF_H_
18
19#include <linux/atomic.h>
20
21/* Register offsets. */
22#define VMCI_STATUS_ADDR 0x00
23#define VMCI_CONTROL_ADDR 0x04
24#define VMCI_ICR_ADDR 0x08
25#define VMCI_IMR_ADDR 0x0c
26#define VMCI_DATA_OUT_ADDR 0x10
27#define VMCI_DATA_IN_ADDR 0x14
28#define VMCI_CAPS_ADDR 0x18
29#define VMCI_RESULT_LOW_ADDR 0x1c
30#define VMCI_RESULT_HIGH_ADDR 0x20
31
32/* Max number of devices. */
33#define VMCI_MAX_DEVICES 1
34
35/* Status register bits. */
36#define VMCI_STATUS_INT_ON 0x1
37
38/* Control register bits. */
39#define VMCI_CONTROL_RESET 0x1
40#define VMCI_CONTROL_INT_ENABLE 0x2
41#define VMCI_CONTROL_INT_DISABLE 0x4
42
43/* Capabilities register bits. */
44#define VMCI_CAPS_HYPERCALL 0x1
45#define VMCI_CAPS_GUESTCALL 0x2
46#define VMCI_CAPS_DATAGRAM 0x4
47#define VMCI_CAPS_NOTIFICATIONS 0x8
48
49/* Interrupt Cause register bits. */
50#define VMCI_ICR_DATAGRAM 0x1
51#define VMCI_ICR_NOTIFICATION 0x2
52
53/* Interrupt Mask register bits. */
54#define VMCI_IMR_DATAGRAM 0x1
55#define VMCI_IMR_NOTIFICATION 0x2
56
57/* Interrupt type. */
58enum {
59 VMCI_INTR_TYPE_INTX = 0,
60 VMCI_INTR_TYPE_MSI = 1,
61 VMCI_INTR_TYPE_MSIX = 2,
62};
63
64/* Maximum MSI/MSI-X interrupt vectors in the device. */
65#define VMCI_MAX_INTRS 2
66
67/*
68 * Supported interrupt vectors. There is one for each ICR value above,
69 * but here they indicate the position in the vector array/message ID.
70 */
71enum {
72 VMCI_INTR_DATAGRAM = 0,
73 VMCI_INTR_NOTIFICATION = 1,
74};
75
76/*
77 * A single VMCI device has an upper limit of 128MB on the amount of
78 * memory that can be used for queue pairs.
79 */
80#define VMCI_MAX_GUEST_QP_MEMORY (128 * 1024 * 1024)
81
82/*
83 * Queues with pre-mapped data pages must be small, so that we don't pin
84 * too much kernel memory (especially on vmkernel). We limit a queuepair to
85 * 32 KB, or 16 KB per queue for symmetrical pairs.
86 */
87#define VMCI_MAX_PINNED_QP_MEMORY (32 * 1024)
88
89/*
90 * We have a fixed set of resource IDs available in the VMX.
91 * This allows us to have a very simple implementation since we statically
92 * know how many will create datagram handles. If a new caller arrives and
93 * we have run out of slots we can manually increment the maximum size of
94 * available resource IDs.
95 *
96 * VMCI reserved hypervisor datagram resource IDs.
97 */
98enum {
99 VMCI_RESOURCES_QUERY = 0,
100 VMCI_GET_CONTEXT_ID = 1,
101 VMCI_SET_NOTIFY_BITMAP = 2,
102 VMCI_DOORBELL_LINK = 3,
103 VMCI_DOORBELL_UNLINK = 4,
104 VMCI_DOORBELL_NOTIFY = 5,
105 /*
106 * VMCI_DATAGRAM_REQUEST_MAP and VMCI_DATAGRAM_REMOVE_MAP are
107 * obsoleted by the removal of VM to VM communication.
108 */
109 VMCI_DATAGRAM_REQUEST_MAP = 6,
110 VMCI_DATAGRAM_REMOVE_MAP = 7,
111 VMCI_EVENT_SUBSCRIBE = 8,
112 VMCI_EVENT_UNSUBSCRIBE = 9,
113 VMCI_QUEUEPAIR_ALLOC = 10,
114 VMCI_QUEUEPAIR_DETACH = 11,
115
116 /*
117 * VMCI_VSOCK_VMX_LOOKUP was assigned to 12 for Fusion 3.0/3.1,
118 * WS 7.0/7.1 and ESX 4.1
119 */
120 VMCI_HGFS_TRANSPORT = 13,
121 VMCI_UNITY_PBRPC_REGISTER = 14,
122 VMCI_RPC_PRIVILEGED = 15,
123 VMCI_RPC_UNPRIVILEGED = 16,
124 VMCI_RESOURCE_MAX = 17,
125};
126
127/*
128 * struct vmci_handle - Ownership information structure
129 * @context: The VMX context ID.
130 * @resource: The resource ID (used for locating in resource hash).
131 *
132 * The vmci_handle structure is used to track resources used within
133 * vmw_vmci.
134 */
135struct vmci_handle {
136 u32 context;
137 u32 resource;
138};
139
140#define vmci_make_handle(_cid, _rid) \
141 (struct vmci_handle){ .context = _cid, .resource = _rid }
142
143static inline bool vmci_handle_is_equal(struct vmci_handle h1,
144 struct vmci_handle h2)
145{
146 return h1.context == h2.context && h1.resource == h2.resource;
147}
148
149#define VMCI_INVALID_ID ~0
150static const struct vmci_handle VMCI_INVALID_HANDLE = {
151 .context = VMCI_INVALID_ID,
152 .resource = VMCI_INVALID_ID
153};
154
155static inline bool vmci_handle_is_invalid(struct vmci_handle h)
156{
157 return vmci_handle_is_equal(h, VMCI_INVALID_HANDLE);
158}
159
160/*
161 * The below defines can be used to send anonymous requests.
162 * This also indicates that no response is expected.
163 */
164#define VMCI_ANON_SRC_CONTEXT_ID VMCI_INVALID_ID
165#define VMCI_ANON_SRC_RESOURCE_ID VMCI_INVALID_ID
166static const struct vmci_handle VMCI_ANON_SRC_HANDLE = {
167 .context = VMCI_ANON_SRC_CONTEXT_ID,
168 .resource = VMCI_ANON_SRC_RESOURCE_ID
169};
170
171/* The lowest 16 context ids are reserved for internal use. */
172#define VMCI_RESERVED_CID_LIMIT ((u32) 16)
173
174/*
175 * Hypervisor context id, used for calling into hypervisor
176 * supplied services from the VM.
177 */
178#define VMCI_HYPERVISOR_CONTEXT_ID 0
179
180/*
181 * Well-known context id, a logical context that contains a set of
182 * well-known services. This context ID is now obsolete.
183 */
184#define VMCI_WELL_KNOWN_CONTEXT_ID 1
185
186/*
187 * Context ID used by host endpoints.
188 */
189#define VMCI_HOST_CONTEXT_ID 2
190
191#define VMCI_CONTEXT_IS_VM(_cid) (VMCI_INVALID_ID != (_cid) && \
192 (_cid) > VMCI_HOST_CONTEXT_ID)
193
194/*
195 * The VMCI_CONTEXT_RESOURCE_ID is used together with vmci_make_handle to make
196 * handles that refer to a specific context.
197 */
198#define VMCI_CONTEXT_RESOURCE_ID 0
199
200/*
201 * VMCI error codes.
202 */
203enum {
204 VMCI_SUCCESS_QUEUEPAIR_ATTACH = 5,
205 VMCI_SUCCESS_QUEUEPAIR_CREATE = 4,
206 VMCI_SUCCESS_LAST_DETACH = 3,
207 VMCI_SUCCESS_ACCESS_GRANTED = 2,
208 VMCI_SUCCESS_ENTRY_DEAD = 1,
209 VMCI_SUCCESS = 0,
210 VMCI_ERROR_INVALID_RESOURCE = (-1),
211 VMCI_ERROR_INVALID_ARGS = (-2),
212 VMCI_ERROR_NO_MEM = (-3),
213 VMCI_ERROR_DATAGRAM_FAILED = (-4),
214 VMCI_ERROR_MORE_DATA = (-5),
215 VMCI_ERROR_NO_MORE_DATAGRAMS = (-6),
216 VMCI_ERROR_NO_ACCESS = (-7),
217 VMCI_ERROR_NO_HANDLE = (-8),
218 VMCI_ERROR_DUPLICATE_ENTRY = (-9),
219 VMCI_ERROR_DST_UNREACHABLE = (-10),
220 VMCI_ERROR_PAYLOAD_TOO_LARGE = (-11),
221 VMCI_ERROR_INVALID_PRIV = (-12),
222 VMCI_ERROR_GENERIC = (-13),
223 VMCI_ERROR_PAGE_ALREADY_SHARED = (-14),
224 VMCI_ERROR_CANNOT_SHARE_PAGE = (-15),
225 VMCI_ERROR_CANNOT_UNSHARE_PAGE = (-16),
226 VMCI_ERROR_NO_PROCESS = (-17),
227 VMCI_ERROR_NO_DATAGRAM = (-18),
228 VMCI_ERROR_NO_RESOURCES = (-19),
229 VMCI_ERROR_UNAVAILABLE = (-20),
230 VMCI_ERROR_NOT_FOUND = (-21),
231 VMCI_ERROR_ALREADY_EXISTS = (-22),
232 VMCI_ERROR_NOT_PAGE_ALIGNED = (-23),
233 VMCI_ERROR_INVALID_SIZE = (-24),
234 VMCI_ERROR_REGION_ALREADY_SHARED = (-25),
235 VMCI_ERROR_TIMEOUT = (-26),
236 VMCI_ERROR_DATAGRAM_INCOMPLETE = (-27),
237 VMCI_ERROR_INCORRECT_IRQL = (-28),
238 VMCI_ERROR_EVENT_UNKNOWN = (-29),
239 VMCI_ERROR_OBSOLETE = (-30),
240 VMCI_ERROR_QUEUEPAIR_MISMATCH = (-31),
241 VMCI_ERROR_QUEUEPAIR_NOTSET = (-32),
242 VMCI_ERROR_QUEUEPAIR_NOTOWNER = (-33),
243 VMCI_ERROR_QUEUEPAIR_NOTATTACHED = (-34),
244 VMCI_ERROR_QUEUEPAIR_NOSPACE = (-35),
245 VMCI_ERROR_QUEUEPAIR_NODATA = (-36),
246 VMCI_ERROR_BUSMEM_INVALIDATION = (-37),
247 VMCI_ERROR_MODULE_NOT_LOADED = (-38),
248 VMCI_ERROR_DEVICE_NOT_FOUND = (-39),
249 VMCI_ERROR_QUEUEPAIR_NOT_READY = (-40),
250 VMCI_ERROR_WOULD_BLOCK = (-41),
251
252 /* VMCI clients should return error code within this range */
253 VMCI_ERROR_CLIENT_MIN = (-500),
254 VMCI_ERROR_CLIENT_MAX = (-550),
255
256 /* Internal error codes. */
257 VMCI_SHAREDMEM_ERROR_BAD_CONTEXT = (-1000),
258};
259
260/* VMCI reserved events. */
261enum {
262 /* Only applicable to guest endpoints */
263 VMCI_EVENT_CTX_ID_UPDATE = 0,
264
265 /* Applicable to guest and host */
266 VMCI_EVENT_CTX_REMOVED = 1,
267
268 /* Only applicable to guest endpoints */
269 VMCI_EVENT_QP_RESUMED = 2,
270
271 /* Applicable to guest and host */
272 VMCI_EVENT_QP_PEER_ATTACH = 3,
273
274 /* Applicable to guest and host */
275 VMCI_EVENT_QP_PEER_DETACH = 4,
276
277 /*
278 * Applicable to VMX and vmk. On vmk,
279 * this event has the Context payload type.
280 */
281 VMCI_EVENT_MEM_ACCESS_ON = 5,
282
283 /*
284 * Applicable to VMX and vmk. Same as
285 * above for the payload type.
286 */
287 VMCI_EVENT_MEM_ACCESS_OFF = 6,
288 VMCI_EVENT_MAX = 7,
289};
290
291/*
292 * Of the above events, a few are reserved for use in the VMX, and
293 * other endpoints (guest and host kernel) should not use them. For
294 * the rest of the events, we allow both host and guest endpoints to
295 * subscribe to them, to maintain the same API for host and guest
296 * endpoints.
297 */
298#define VMCI_EVENT_VALID_VMX(_event) ((_event) == VMCI_EVENT_MEM_ACCESS_ON || \
299 (_event) == VMCI_EVENT_MEM_ACCESS_OFF)
300
301#define VMCI_EVENT_VALID(_event) ((_event) < VMCI_EVENT_MAX && \
302 !VMCI_EVENT_VALID_VMX(_event))
303
304/* Reserved guest datagram resource ids. */
305#define VMCI_EVENT_HANDLER 0
306
307/*
308 * VMCI coarse-grained privileges (per context or host
309 * process/endpoint. An entity with the restricted flag is only
310 * allowed to interact with the hypervisor and trusted entities.
311 */
312enum {
313 VMCI_NO_PRIVILEGE_FLAGS = 0,
314 VMCI_PRIVILEGE_FLAG_RESTRICTED = 1,
315 VMCI_PRIVILEGE_FLAG_TRUSTED = 2,
316 VMCI_PRIVILEGE_ALL_FLAGS = (VMCI_PRIVILEGE_FLAG_RESTRICTED |
317 VMCI_PRIVILEGE_FLAG_TRUSTED),
318 VMCI_DEFAULT_PROC_PRIVILEGE_FLAGS = VMCI_NO_PRIVILEGE_FLAGS,
319 VMCI_LEAST_PRIVILEGE_FLAGS = VMCI_PRIVILEGE_FLAG_RESTRICTED,
320 VMCI_MAX_PRIVILEGE_FLAGS = VMCI_PRIVILEGE_FLAG_TRUSTED,
321};
322
323/* 0 through VMCI_RESERVED_RESOURCE_ID_MAX are reserved. */
324#define VMCI_RESERVED_RESOURCE_ID_MAX 1023
325
326/*
327 * Driver version.
328 *
329 * Increment major version when you make an incompatible change.
330 * Compatibility goes both ways (old driver with new executable
331 * as well as new driver with old executable).
332 */
333
334/* Never change VMCI_VERSION_SHIFT_WIDTH */
335#define VMCI_VERSION_SHIFT_WIDTH 16
336#define VMCI_MAKE_VERSION(_major, _minor) \
337 ((_major) << VMCI_VERSION_SHIFT_WIDTH | (u16) (_minor))
338
339#define VMCI_VERSION_MAJOR(v) ((u32) (v) >> VMCI_VERSION_SHIFT_WIDTH)
340#define VMCI_VERSION_MINOR(v) ((u16) (v))
341
342/*
343 * VMCI_VERSION is always the current version. Subsequently listed
344 * versions are ways of detecting previous versions of the connecting
345 * application (i.e., VMX).
346 *
347 * VMCI_VERSION_NOVMVM: This version removed support for VM to VM
348 * communication.
349 *
350 * VMCI_VERSION_NOTIFY: This version introduced doorbell notification
351 * support.
352 *
353 * VMCI_VERSION_HOSTQP: This version introduced host end point support
354 * for hosted products.
355 *
356 * VMCI_VERSION_PREHOSTQP: This is the version prior to the adoption of
357 * support for host end-points.
358 *
359 * VMCI_VERSION_PREVERS2: This fictional version number is intended to
360 * represent the version of a VMX which doesn't call into the driver
361 * with ioctl VERSION2 and thus doesn't establish its version with the
362 * driver.
363 */
364
365#define VMCI_VERSION VMCI_VERSION_NOVMVM
366#define VMCI_VERSION_NOVMVM VMCI_MAKE_VERSION(11, 0)
367#define VMCI_VERSION_NOTIFY VMCI_MAKE_VERSION(10, 0)
368#define VMCI_VERSION_HOSTQP VMCI_MAKE_VERSION(9, 0)
369#define VMCI_VERSION_PREHOSTQP VMCI_MAKE_VERSION(8, 0)
370#define VMCI_VERSION_PREVERS2 VMCI_MAKE_VERSION(1, 0)
371
372#define VMCI_SOCKETS_MAKE_VERSION(_p) \
373 ((((_p)[0] & 0xFF) << 24) | (((_p)[1] & 0xFF) << 16) | ((_p)[2]))
374
375/*
376 * The VMCI IOCTLs. We use identity code 7, as noted in ioctl-number.h, and
377 * we start at sequence 9f. This gives us the same values that our shipping
378 * products use, starting at 1951, provided we leave out the direction and
379 * structure size. Note that VMMon occupies the block following us, starting
380 * at 2001.
381 */
382#define IOCTL_VMCI_VERSION _IO(7, 0x9f) /* 1951 */
383#define IOCTL_VMCI_INIT_CONTEXT _IO(7, 0xa0)
384#define IOCTL_VMCI_QUEUEPAIR_SETVA _IO(7, 0xa4)
385#define IOCTL_VMCI_NOTIFY_RESOURCE _IO(7, 0xa5)
386#define IOCTL_VMCI_NOTIFICATIONS_RECEIVE _IO(7, 0xa6)
387#define IOCTL_VMCI_VERSION2 _IO(7, 0xa7)
388#define IOCTL_VMCI_QUEUEPAIR_ALLOC _IO(7, 0xa8)
389#define IOCTL_VMCI_QUEUEPAIR_SETPAGEFILE _IO(7, 0xa9)
390#define IOCTL_VMCI_QUEUEPAIR_DETACH _IO(7, 0xaa)
391#define IOCTL_VMCI_DATAGRAM_SEND _IO(7, 0xab)
392#define IOCTL_VMCI_DATAGRAM_RECEIVE _IO(7, 0xac)
393#define IOCTL_VMCI_CTX_ADD_NOTIFICATION _IO(7, 0xaf)
394#define IOCTL_VMCI_CTX_REMOVE_NOTIFICATION _IO(7, 0xb0)
395#define IOCTL_VMCI_CTX_GET_CPT_STATE _IO(7, 0xb1)
396#define IOCTL_VMCI_CTX_SET_CPT_STATE _IO(7, 0xb2)
397#define IOCTL_VMCI_GET_CONTEXT_ID _IO(7, 0xb3)
398#define IOCTL_VMCI_SOCKETS_VERSION _IO(7, 0xb4)
399#define IOCTL_VMCI_SOCKETS_GET_AF_VALUE _IO(7, 0xb8)
400#define IOCTL_VMCI_SOCKETS_GET_LOCAL_CID _IO(7, 0xb9)
401#define IOCTL_VMCI_SET_NOTIFY _IO(7, 0xcb) /* 1995 */
402/*IOCTL_VMMON_START _IO(7, 0xd1)*/ /* 2001 */
403
404/*
405 * struct vmci_queue_header - VMCI Queue Header information.
406 *
407 * A Queue cannot stand by itself as designed. Each Queue's header
408 * contains a pointer into itself (the producer_tail) and into its peer
409 * (consumer_head). The reason for the separation is one of
410 * accessibility: Each end-point can modify two things: where the next
411 * location to enqueue is within its produce_q (producer_tail); and
412 * where the next dequeue location is in its consume_q (consumer_head).
413 *
414 * An end-point cannot modify the pointers of its peer (guest to
415 * guest; NOTE that in the host both queue headers are mapped r/w).
416 * But, each end-point needs read access to both Queue header
417 * structures in order to determine how much space is used (or left)
418 * in the Queue. This is because for an end-point to know how full
419 * its produce_q is, it needs to use the consumer_head that points into
420 * the produce_q but -that- consumer_head is in the Queue header for
421 * that end-points consume_q.
422 *
423 * Thoroughly confused? Sorry.
424 *
425 * producer_tail: the point to enqueue new entrants. When you approach
426 * a line in a store, for example, you walk up to the tail.
427 *
428 * consumer_head: the point in the queue from which the next element is
429 * dequeued. In other words, who is next in line is he who is at the
430 * head of the line.
431 *
432 * Also, producer_tail points to an empty byte in the Queue, whereas
433 * consumer_head points to a valid byte of data (unless producer_tail ==
434 * consumer_head in which case consumer_head does not point to a valid
435 * byte of data).
436 *
437 * For a queue of buffer 'size' bytes, the tail and head pointers will be in
438 * the range [0, size-1].
439 *
440 * If produce_q_header->producer_tail == consume_q_header->consumer_head
441 * then the produce_q is empty.
442 */
443struct vmci_queue_header {
444 /* All fields are 64bit and aligned. */
445 struct vmci_handle handle; /* Identifier. */
446 atomic64_t producer_tail; /* Offset in this queue. */
447 atomic64_t consumer_head; /* Offset in peer queue. */
448};
449
450/*
451 * struct vmci_datagram - Base struct for vmci datagrams.
452 * @dst: A vmci_handle that tracks the destination of the datagram.
453 * @src: A vmci_handle that tracks the source of the datagram.
454 * @payload_size: The size of the payload.
455 *
456 * vmci_datagram structs are used when sending vmci datagrams. They include
457 * the necessary source and destination information to properly route
458 * the information along with the size of the package.
459 */
460struct vmci_datagram {
461 struct vmci_handle dst;
462 struct vmci_handle src;
463 u64 payload_size;
464};
465
466/*
467 * Second flag is for creating a well-known handle instead of a per context
468 * handle. Next flag is for deferring datagram delivery, so that the
469 * datagram callback is invoked in a delayed context (not interrupt context).
470 */
471#define VMCI_FLAG_DG_NONE 0
472#define VMCI_FLAG_WELLKNOWN_DG_HND 0x1
473#define VMCI_FLAG_ANYCID_DG_HND 0x2
474#define VMCI_FLAG_DG_DELAYED_CB 0x4
475
476/*
477 * Maximum supported size of a VMCI datagram for routable datagrams.
478 * Datagrams going to the hypervisor are allowed to be larger.
479 */
480#define VMCI_MAX_DG_SIZE (17 * 4096)
481#define VMCI_MAX_DG_PAYLOAD_SIZE (VMCI_MAX_DG_SIZE - \
482 sizeof(struct vmci_datagram))
483#define VMCI_DG_PAYLOAD(_dg) (void *)((char *)(_dg) + \
484 sizeof(struct vmci_datagram))
485#define VMCI_DG_HEADERSIZE sizeof(struct vmci_datagram)
486#define VMCI_DG_SIZE(_dg) (VMCI_DG_HEADERSIZE + (size_t)(_dg)->payload_size)
487#define VMCI_DG_SIZE_ALIGNED(_dg) ((VMCI_DG_SIZE(_dg) + 7) & (~((size_t) 0x7)))
488#define VMCI_MAX_DATAGRAM_QUEUE_SIZE (VMCI_MAX_DG_SIZE * 2)
489
490struct vmci_event_payload_qp {
491 struct vmci_handle handle; /* queue_pair handle. */
492 u32 peer_id; /* Context id of attaching/detaching VM. */
493 u32 _pad;
494};
495
496/* Flags for VMCI queue_pair API. */
497enum {
498 /* Fail alloc if QP not created by peer. */
499 VMCI_QPFLAG_ATTACH_ONLY = 1 << 0,
500
501 /* Only allow attaches from local context. */
502 VMCI_QPFLAG_LOCAL = 1 << 1,
503
504 /* Host won't block when guest is quiesced. */
505 VMCI_QPFLAG_NONBLOCK = 1 << 2,
506
507 /* Pin data pages in ESX. Used with NONBLOCK */
508 VMCI_QPFLAG_PINNED = 1 << 3,
509
510 /* Update the following flag when adding new flags. */
511 VMCI_QP_ALL_FLAGS = (VMCI_QPFLAG_ATTACH_ONLY | VMCI_QPFLAG_LOCAL |
512 VMCI_QPFLAG_NONBLOCK | VMCI_QPFLAG_PINNED),
513
514 /* Convenience flags */
515 VMCI_QP_ASYMM = (VMCI_QPFLAG_NONBLOCK | VMCI_QPFLAG_PINNED),
516 VMCI_QP_ASYMM_PEER = (VMCI_QPFLAG_ATTACH_ONLY | VMCI_QP_ASYMM),
517};
518
519/*
520 * We allow at least 1024 more event datagrams from the hypervisor past the
521 * normally allowed datagrams pending for a given context. We define this
522 * limit on event datagrams from the hypervisor to guard against DoS attack
523 * from a malicious VM which could repeatedly attach to and detach from a queue
524 * pair, causing events to be queued at the destination VM. However, the rate
525 * at which such events can be generated is small since it requires a VM exit
526 * and handling of queue pair attach/detach call at the hypervisor. Event
527 * datagrams may be queued up at the destination VM if it has interrupts
528 * disabled or if it is not draining events for some other reason. 1024
529 * datagrams is a grossly conservative estimate of the time for which
530 * interrupts may be disabled in the destination VM, but at the same time does
531 * not exacerbate the memory pressure problem on the host by much (size of each
532 * event datagram is small).
533 */
534#define VMCI_MAX_DATAGRAM_AND_EVENT_QUEUE_SIZE \
535 (VMCI_MAX_DATAGRAM_QUEUE_SIZE + \
536 1024 * (sizeof(struct vmci_datagram) + \
537 sizeof(struct vmci_event_data_max)))
538
539/*
540 * Struct used for querying, via VMCI_RESOURCES_QUERY, the availability of
541 * hypervisor resources. Struct size is 16 bytes. All fields in struct are
542 * aligned to their natural alignment.
543 */
544struct vmci_resource_query_hdr {
545 struct vmci_datagram hdr;
546 u32 num_resources;
547 u32 _padding;
548};
549
550/*
551 * Convenience struct for negotiating vectors. Must match layout of
552 * VMCIResourceQueryHdr minus the struct vmci_datagram header.
553 */
554struct vmci_resource_query_msg {
555 u32 num_resources;
556 u32 _padding;
557 u32 resources[1];
558};
559
560/*
561 * The maximum number of resources that can be queried using
562 * VMCI_RESOURCE_QUERY is 31, as the result is encoded in the lower 31
563 * bits of a positive return value. Negative values are reserved for
564 * errors.
565 */
566#define VMCI_RESOURCE_QUERY_MAX_NUM 31
567
568/* Maximum size for the VMCI_RESOURCE_QUERY request. */
569#define VMCI_RESOURCE_QUERY_MAX_SIZE \
570 (sizeof(struct vmci_resource_query_hdr) + \
571 sizeof(u32) * VMCI_RESOURCE_QUERY_MAX_NUM)
572
573/*
574 * Struct used for setting the notification bitmap. All fields in
575 * struct are aligned to their natural alignment.
576 */
577struct vmci_notify_bm_set_msg {
578 struct vmci_datagram hdr;
579 u32 bitmap_ppn;
580 u32 _pad;
581};
582
583/*
584 * Struct used for linking a doorbell handle with an index in the
585 * notify bitmap. All fields in struct are aligned to their natural
586 * alignment.
587 */
588struct vmci_doorbell_link_msg {
589 struct vmci_datagram hdr;
590 struct vmci_handle handle;
591 u64 notify_idx;
592};
593
594/*
595 * Struct used for unlinking a doorbell handle from an index in the
596 * notify bitmap. All fields in struct are aligned to their natural
597 * alignment.
598 */
599struct vmci_doorbell_unlink_msg {
600 struct vmci_datagram hdr;
601 struct vmci_handle handle;
602};
603
604/*
605 * Struct used for generating a notification on a doorbell handle. All
606 * fields in struct are aligned to their natural alignment.
607 */
608struct vmci_doorbell_notify_msg {
609 struct vmci_datagram hdr;
610 struct vmci_handle handle;
611};
612
613/*
614 * This struct is used to contain data for events. Size of this struct is a
615 * multiple of 8 bytes, and all fields are aligned to their natural alignment.
616 */
617struct vmci_event_data {
618 u32 event; /* 4 bytes. */
619 u32 _pad;
620 /* Event payload is put here. */
621};
622
623/*
624 * Define the different VMCI_EVENT payload data types here. All structs must
625 * be a multiple of 8 bytes, and fields must be aligned to their natural
626 * alignment.
627 */
628struct vmci_event_payld_ctx {
629 u32 context_id; /* 4 bytes. */
630 u32 _pad;
631};
632
633struct vmci_event_payld_qp {
634 struct vmci_handle handle; /* queue_pair handle. */
635 u32 peer_id; /* Context id of attaching/detaching VM. */
636 u32 _pad;
637};
638
639/*
640 * We define the following struct to get the size of the maximum event
641 * data the hypervisor may send to the guest. If adding a new event
642 * payload type above, add it to the following struct too (inside the
643 * union).
644 */
645struct vmci_event_data_max {
646 struct vmci_event_data event_data;
647 union {
648 struct vmci_event_payld_ctx context_payload;
649 struct vmci_event_payld_qp qp_payload;
650 } ev_data_payload;
651};
652
653/*
654 * Struct used for VMCI_EVENT_SUBSCRIBE/UNSUBSCRIBE and
655 * VMCI_EVENT_HANDLER messages. Struct size is 32 bytes. All fields
656 * in struct are aligned to their natural alignment.
657 */
658struct vmci_event_msg {
659 struct vmci_datagram hdr;
660
661 /* Has event type and payload. */
662 struct vmci_event_data event_data;
663
664 /* Payload gets put here. */
665};
666
667/* Event with context payload. */
668struct vmci_event_ctx {
669 struct vmci_event_msg msg;
670 struct vmci_event_payld_ctx payload;
671};
672
673/* Event with QP payload. */
674struct vmci_event_qp {
675 struct vmci_event_msg msg;
676 struct vmci_event_payld_qp payload;
677};
678
679/*
680 * Structs used for queue_pair alloc and detach messages. We align fields of
681 * these structs to 64bit boundaries.
682 */
683struct vmci_qp_alloc_msg {
684 struct vmci_datagram hdr;
685 struct vmci_handle handle;
686 u32 peer;
687 u32 flags;
688 u64 produce_size;
689 u64 consume_size;
690 u64 num_ppns;
691
692 /* List of PPNs placed here. */
693};
694
695struct vmci_qp_detach_msg {
696 struct vmci_datagram hdr;
697 struct vmci_handle handle;
698};
699
700/* VMCI Doorbell API. */
701#define VMCI_FLAG_DELAYED_CB 0x01
702
703typedef void (*vmci_callback) (void *client_data);
704
705/*
706 * struct vmci_qp - A vmw_vmci queue pair handle.
707 *
708 * This structure is used as a handle to a queue pair created by
709 * VMCI. It is intentionally left opaque to clients.
710 */
711struct vmci_qp;
712
713/* Callback needed for correctly waiting on events. */
714typedef int (*vmci_datagram_recv_cb) (void *client_data,
715 struct vmci_datagram *msg);
716
717/* VMCI Event API. */
718typedef void (*vmci_event_cb) (u32 sub_id, const struct vmci_event_data *ed,
719 void *client_data);
720
721/*
722 * We use the following inline function to access the payload data
723 * associated with an event data.
724 */
725static inline const void *
726vmci_event_data_const_payload(const struct vmci_event_data *ev_data)
727{
728 return (const char *)ev_data + sizeof(*ev_data);
729}
730
731static inline void *vmci_event_data_payload(struct vmci_event_data *ev_data)
732{
733 return (void *)vmci_event_data_const_payload(ev_data);
734}
735
736/*
737 * Helper to add a given offset to a head or tail pointer. Wraps the
738 * value of the pointer around the max size of the queue.
739 */
740static inline void vmci_qp_add_pointer(atomic64_t *var,
741 size_t add,
742 u64 size)
743{
744 u64 new_val = atomic64_read(var);
745
746 if (new_val >= size - add)
747 new_val -= size;
748
749 new_val += add;
750
751 atomic64_set(var, new_val);
752}
753
754/*
755 * Helper routine to get the Producer Tail from the supplied queue.
756 */
757static inline u64
758vmci_q_header_producer_tail(const struct vmci_queue_header *q_header)
759{
760 struct vmci_queue_header *qh = (struct vmci_queue_header *)q_header;
761 return atomic64_read(&qh->producer_tail);
762}
763
764/*
765 * Helper routine to get the Consumer Head from the supplied queue.
766 */
767static inline u64
768vmci_q_header_consumer_head(const struct vmci_queue_header *q_header)
769{
770 struct vmci_queue_header *qh = (struct vmci_queue_header *)q_header;
771 return atomic64_read(&qh->consumer_head);
772}
773
774/*
775 * Helper routine to increment the Producer Tail. Fundamentally,
776 * vmci_qp_add_pointer() is used to manipulate the tail itself.
777 */
778static inline void
779vmci_q_header_add_producer_tail(struct vmci_queue_header *q_header,
780 size_t add,
781 u64 queue_size)
782{
783 vmci_qp_add_pointer(&q_header->producer_tail, add, queue_size);
784}
785
786/*
787 * Helper routine to increment the Consumer Head. Fundamentally,
788 * vmci_qp_add_pointer() is used to manipulate the head itself.
789 */
790static inline void
791vmci_q_header_add_consumer_head(struct vmci_queue_header *q_header,
792 size_t add,
793 u64 queue_size)
794{
795 vmci_qp_add_pointer(&q_header->consumer_head, add, queue_size);
796}
797
798/*
799 * Helper routine for getting the head and the tail pointer for a queue.
800 * Both the VMCIQueues are needed to get both the pointers for one queue.
801 */
802static inline void
803vmci_q_header_get_pointers(const struct vmci_queue_header *produce_q_header,
804 const struct vmci_queue_header *consume_q_header,
805 u64 *producer_tail,
806 u64 *consumer_head)
807{
808 if (producer_tail)
809 *producer_tail = vmci_q_header_producer_tail(produce_q_header);
810
811 if (consumer_head)
812 *consumer_head = vmci_q_header_consumer_head(consume_q_header);
813}
814
815static inline void vmci_q_header_init(struct vmci_queue_header *q_header,
816 const struct vmci_handle handle)
817{
818 q_header->handle = handle;
819 atomic64_set(&q_header->producer_tail, 0);
820 atomic64_set(&q_header->consumer_head, 0);
821}
822
823/*
824 * Finds available free space in a produce queue to enqueue more
825 * data or reports an error if queue pair corruption is detected.
826 */
827static s64
828vmci_q_header_free_space(const struct vmci_queue_header *produce_q_header,
829 const struct vmci_queue_header *consume_q_header,
830 const u64 produce_q_size)
831{
832 u64 tail;
833 u64 head;
834 u64 free_space;
835
836 tail = vmci_q_header_producer_tail(produce_q_header);
837 head = vmci_q_header_consumer_head(consume_q_header);
838
839 if (tail >= produce_q_size || head >= produce_q_size)
840 return VMCI_ERROR_INVALID_SIZE;
841
842 /*
843 * Deduct 1 to avoid tail becoming equal to head which causes
844 * ambiguity. If head and tail are equal it means that the
845 * queue is empty.
846 */
847 if (tail >= head)
848 free_space = produce_q_size - (tail - head) - 1;
849 else
850 free_space = head - tail - 1;
851
852 return free_space;
853}
854
855/*
856 * vmci_q_header_free_space() does all the heavy lifting of
857 * determing the number of free bytes in a Queue. This routine,
858 * then subtracts that size from the full size of the Queue so
859 * the caller knows how many bytes are ready to be dequeued.
860 * Results:
861 * On success, available data size in bytes (up to MAX_INT64).
862 * On failure, appropriate error code.
863 */
864static inline s64
865vmci_q_header_buf_ready(const struct vmci_queue_header *consume_q_header,
866 const struct vmci_queue_header *produce_q_header,
867 const u64 consume_q_size)
868{
869 s64 free_space;
870
871 free_space = vmci_q_header_free_space(consume_q_header,
872 produce_q_header, consume_q_size);
873 if (free_space < VMCI_SUCCESS)
874 return free_space;
875
876 return consume_q_size - free_space - 1;
877}
878
879
880#endif /* _VMW_VMCI_DEF_H_ */
diff --git a/include/linux/vtime.h b/include/linux/vtime.h
index ae30ab58431a..71a5782d8c59 100644
--- a/include/linux/vtime.h
+++ b/include/linux/vtime.h
@@ -6,15 +6,46 @@ struct task_struct;
6#ifdef CONFIG_VIRT_CPU_ACCOUNTING 6#ifdef CONFIG_VIRT_CPU_ACCOUNTING
7extern void vtime_task_switch(struct task_struct *prev); 7extern void vtime_task_switch(struct task_struct *prev);
8extern void vtime_account_system(struct task_struct *tsk); 8extern void vtime_account_system(struct task_struct *tsk);
9extern void vtime_account_system_irqsafe(struct task_struct *tsk);
10extern void vtime_account_idle(struct task_struct *tsk); 9extern void vtime_account_idle(struct task_struct *tsk);
11extern void vtime_account_user(struct task_struct *tsk); 10extern void vtime_account_user(struct task_struct *tsk);
12extern void vtime_account(struct task_struct *tsk); 11extern void vtime_account_irq_enter(struct task_struct *tsk);
13#else 12
13#ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE
14static inline bool vtime_accounting_enabled(void) { return true; }
15#endif
16
17#else /* !CONFIG_VIRT_CPU_ACCOUNTING */
18
14static inline void vtime_task_switch(struct task_struct *prev) { } 19static inline void vtime_task_switch(struct task_struct *prev) { }
15static inline void vtime_account_system(struct task_struct *tsk) { } 20static inline void vtime_account_system(struct task_struct *tsk) { }
16static inline void vtime_account_system_irqsafe(struct task_struct *tsk) { } 21static inline void vtime_account_user(struct task_struct *tsk) { }
17static inline void vtime_account(struct task_struct *tsk) { } 22static inline void vtime_account_irq_enter(struct task_struct *tsk) { }
23static inline bool vtime_accounting_enabled(void) { return false; }
24#endif
25
26#ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN
27extern void arch_vtime_task_switch(struct task_struct *tsk);
28extern void vtime_account_irq_exit(struct task_struct *tsk);
29extern bool vtime_accounting_enabled(void);
30extern void vtime_user_enter(struct task_struct *tsk);
31static inline void vtime_user_exit(struct task_struct *tsk)
32{
33 vtime_account_user(tsk);
34}
35extern void vtime_guest_enter(struct task_struct *tsk);
36extern void vtime_guest_exit(struct task_struct *tsk);
37extern void vtime_init_idle(struct task_struct *tsk);
38#else
39static inline void vtime_account_irq_exit(struct task_struct *tsk)
40{
41 /* On hard|softirq exit we always account to hard|softirq cputime */
42 vtime_account_system(tsk);
43}
44static inline void vtime_user_enter(struct task_struct *tsk) { }
45static inline void vtime_user_exit(struct task_struct *tsk) { }
46static inline void vtime_guest_enter(struct task_struct *tsk) { }
47static inline void vtime_guest_exit(struct task_struct *tsk) { }
48static inline void vtime_init_idle(struct task_struct *tsk) { }
18#endif 49#endif
19 50
20#ifdef CONFIG_IRQ_TIME_ACCOUNTING 51#ifdef CONFIG_IRQ_TIME_ACCOUNTING
@@ -23,25 +54,15 @@ extern void irqtime_account_irq(struct task_struct *tsk);
23static inline void irqtime_account_irq(struct task_struct *tsk) { } 54static inline void irqtime_account_irq(struct task_struct *tsk) { }
24#endif 55#endif
25 56
26static inline void vtime_account_irq_enter(struct task_struct *tsk) 57static inline void account_irq_enter_time(struct task_struct *tsk)
27{ 58{
28 /* 59 vtime_account_irq_enter(tsk);
29 * Hardirq can interrupt idle task anytime. So we need vtime_account()
30 * that performs the idle check in CONFIG_VIRT_CPU_ACCOUNTING.
31 * Softirq can also interrupt idle task directly if it calls
32 * local_bh_enable(). Such case probably don't exist but we never know.
33 * Ksoftirqd is not concerned because idle time is flushed on context
34 * switch. Softirqs in the end of hardirqs are also not a problem because
35 * the idle time is flushed on hardirq time already.
36 */
37 vtime_account(tsk);
38 irqtime_account_irq(tsk); 60 irqtime_account_irq(tsk);
39} 61}
40 62
41static inline void vtime_account_irq_exit(struct task_struct *tsk) 63static inline void account_irq_exit_time(struct task_struct *tsk)
42{ 64{
43 /* On hard|softirq exit we always account to hard|softirq cputime */ 65 vtime_account_irq_exit(tsk);
44 vtime_account_system(tsk);
45 irqtime_account_irq(tsk); 66 irqtime_account_irq(tsk);
46} 67}
47 68
diff --git a/include/linux/wanrouter.h b/include/linux/wanrouter.h
index cec4b4159767..8198a63cf459 100644
--- a/include/linux/wanrouter.h
+++ b/include/linux/wanrouter.h
@@ -1,129 +1,10 @@
1/***************************************************************************** 1/*
2* wanrouter.h Definitions for the WAN Multiprotocol Router Module. 2 * wanrouter.h Legacy declarations kept around until X25 is removed
3* This module provides API and common services for WAN Link 3 */
4* Drivers and is completely hardware-independent. 4
5*
6* Author: Nenad Corbic <ncorbic@sangoma.com>
7* Gideon Hack
8* Additions: Arnaldo Melo
9*
10* Copyright: (c) 1995-2000 Sangoma Technologies Inc.
11*
12* This program is free software; you can redistribute it and/or
13* modify it under the terms of the GNU General Public License
14* as published by the Free Software Foundation; either version
15* 2 of the License, or (at your option) any later version.
16* ============================================================================
17* Jul 21, 2000 Nenad Corbic Added WAN_FT1_READY State
18* Feb 24, 2000 Nenad Corbic Added support for socket based x25api
19* Jan 28, 2000 Nenad Corbic Added support for the ASYNC protocol.
20* Oct 04, 1999 Nenad Corbic Updated for 2.1.0 release
21* Jun 02, 1999 Gideon Hack Added support for the S514 adapter.
22* May 23, 1999 Arnaldo Melo Added local_addr to wanif_conf_t
23* WAN_DISCONNECTING state added
24* Jul 20, 1998 David Fong Added Inverse ARP options to 'wanif_conf_t'
25* Jun 12, 1998 David Fong Added Cisco HDLC support.
26* Dec 16, 1997 Jaspreet Singh Moved 'enable_IPX' and 'network_number' to
27* 'wanif_conf_t'
28* Dec 05, 1997 Jaspreet Singh Added 'pap', 'chap' to 'wanif_conf_t'
29* Added 'authenticator' to 'wan_ppp_conf_t'
30* Nov 06, 1997 Jaspreet Singh Changed Router Driver version to 1.1 from 1.0
31* Oct 20, 1997 Jaspreet Singh Added 'cir','bc','be' and 'mc' to 'wanif_conf_t'
32* Added 'enable_IPX' and 'network_number' to
33* 'wan_device_t'. Also added defines for
34* UDP PACKET TYPE, Interrupt test, critical values
35* for RACE conditions.
36* Oct 05, 1997 Jaspreet Singh Added 'dlci_num' and 'dlci[100]' to
37* 'wan_fr_conf_t' to configure a list of dlci(s)
38* for a NODE
39* Jul 07, 1997 Jaspreet Singh Added 'ttl' to 'wandev_conf_t' & 'wan_device_t'
40* May 29, 1997 Jaspreet Singh Added 'tx_int_enabled' to 'wan_device_t'
41* May 21, 1997 Jaspreet Singh Added 'udp_port' to 'wan_device_t'
42* Apr 25, 1997 Farhan Thawar Added 'udp_port' to 'wandev_conf_t'
43* Jan 16, 1997 Gene Kozin router_devlist made public
44* Jan 02, 1997 Gene Kozin Initial version (based on wanpipe.h).
45*****************************************************************************/
46#ifndef _ROUTER_H 5#ifndef _ROUTER_H
47#define _ROUTER_H 6#define _ROUTER_H
48 7
49#include <uapi/linux/wanrouter.h> 8#include <uapi/linux/wanrouter.h>
50 9
51/****** Kernel Interface ****************************************************/
52
53#include <linux/fs.h> /* support for device drivers */
54#include <linux/proc_fs.h> /* proc filesystem pragmatics */
55#include <linux/netdevice.h> /* support for network drivers */
56#include <linux/spinlock.h> /* Support for SMP Locking */
57
58/*----------------------------------------------------------------------------
59 * WAN device data space.
60 */
61struct wan_device {
62 unsigned magic; /* magic number */
63 char* name; /* -> WAN device name (ASCIIZ) */
64 void* private; /* -> driver private data */
65 unsigned config_id; /* Configuration ID */
66 /****** hardware configuration ******/
67 unsigned ioport; /* adapter I/O port base #1 */
68 char S514_cpu_no[1]; /* PCI CPU Number */
69 unsigned char S514_slot_no; /* PCI Slot Number */
70 unsigned long maddr; /* dual-port memory address */
71 unsigned msize; /* dual-port memory size */
72 int irq; /* interrupt request level */
73 int dma; /* DMA request level */
74 unsigned bps; /* data transfer rate */
75 unsigned mtu; /* max physical transmit unit size */
76 unsigned udp_port; /* UDP port for management */
77 unsigned char ttl; /* Time To Live for UDP security */
78 unsigned enable_tx_int; /* Transmit Interrupt enabled or not */
79 char interface; /* RS-232/V.35, etc. */
80 char clocking; /* external/internal */
81 char line_coding; /* NRZ/NRZI/FM0/FM1, etc. */
82 char station; /* DTE/DCE, primary/secondary, etc. */
83 char connection; /* permanent/switched/on-demand */
84 char signalling; /* Signalling RS232 or V35 */
85 char read_mode; /* read mode: Polling or interrupt */
86 char new_if_cnt; /* Number of interfaces per wanpipe */
87 char del_if_cnt; /* Number of times del_if() gets called */
88 unsigned char piggyback; /* Piggibacking a port */
89 unsigned hw_opt[4]; /* other hardware options */
90 /****** status and statistics *******/
91 char state; /* device state */
92 char api_status; /* device api status */
93 struct net_device_stats stats; /* interface statistics */
94 unsigned reserved[16]; /* reserved for future use */
95 unsigned long critical; /* critical section flag */
96 spinlock_t lock; /* Support for SMP Locking */
97
98 /****** device management methods ***/
99 int (*setup) (struct wan_device *wandev, wandev_conf_t *conf);
100 int (*shutdown) (struct wan_device *wandev);
101 int (*update) (struct wan_device *wandev);
102 int (*ioctl) (struct wan_device *wandev, unsigned cmd,
103 unsigned long arg);
104 int (*new_if)(struct wan_device *wandev, struct net_device *dev,
105 wanif_conf_t *conf);
106 int (*del_if)(struct wan_device *wandev, struct net_device *dev);
107 /****** maintained by the router ****/
108 struct wan_device* next; /* -> next device */
109 struct net_device* dev; /* list of network interfaces */
110 unsigned ndev; /* number of interfaces */
111 struct proc_dir_entry *dent; /* proc filesystem entry */
112};
113
114/* Public functions available for device drivers */
115extern int register_wan_device(struct wan_device *wandev);
116extern int unregister_wan_device(char *name);
117
118/* Proc interface functions. These must not be called by the drivers! */
119extern int wanrouter_proc_init(void);
120extern void wanrouter_proc_cleanup(void);
121extern int wanrouter_proc_add(struct wan_device *wandev);
122extern int wanrouter_proc_delete(struct wan_device *wandev);
123extern long wanrouter_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
124
125/* Public Data */
126/* list of registered devices */
127extern struct wan_device *wanrouter_router_devlist;
128
129#endif /* _ROUTER_H */ 10#endif /* _ROUTER_H */
diff --git a/include/linux/wl12xx.h b/include/linux/wl12xx.h
index 0d6373195d32..a54fe82e704b 100644
--- a/include/linux/wl12xx.h
+++ b/include/linux/wl12xx.h
@@ -24,6 +24,8 @@
24#ifndef _LINUX_WL12XX_H 24#ifndef _LINUX_WL12XX_H
25#define _LINUX_WL12XX_H 25#define _LINUX_WL12XX_H
26 26
27#include <linux/err.h>
28
27/* Reference clock values */ 29/* Reference clock values */
28enum { 30enum {
29 WL12XX_REFCLOCK_19 = 0, /* 19.2 MHz */ 31 WL12XX_REFCLOCK_19 = 0, /* 19.2 MHz */
@@ -55,17 +57,17 @@ struct wl12xx_platform_data {
55 int board_tcxo_clock; 57 int board_tcxo_clock;
56 unsigned long platform_quirks; 58 unsigned long platform_quirks;
57 bool pwr_in_suspend; 59 bool pwr_in_suspend;
58
59 struct wl1271_if_operations *ops;
60}; 60};
61 61
62/* Platform does not support level trigger interrupts */ 62/* Platform does not support level trigger interrupts */
63#define WL12XX_PLATFORM_QUIRK_EDGE_IRQ BIT(0) 63#define WL12XX_PLATFORM_QUIRK_EDGE_IRQ BIT(0)
64 64
65#ifdef CONFIG_WL12XX_PLATFORM_DATA 65#ifdef CONFIG_WILINK_PLATFORM_DATA
66 66
67int wl12xx_set_platform_data(const struct wl12xx_platform_data *data); 67int wl12xx_set_platform_data(const struct wl12xx_platform_data *data);
68 68
69struct wl12xx_platform_data *wl12xx_get_platform_data(void);
70
69#else 71#else
70 72
71static inline 73static inline
@@ -74,8 +76,12 @@ int wl12xx_set_platform_data(const struct wl12xx_platform_data *data)
74 return -ENOSYS; 76 return -ENOSYS;
75} 77}
76 78
77#endif 79static inline
80struct wl12xx_platform_data *wl12xx_get_platform_data(void)
81{
82 return ERR_PTR(-ENODATA);
83}
78 84
79struct wl12xx_platform_data *wl12xx_get_platform_data(void); 85#endif
80 86
81#endif 87#endif
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index 2b58905d3504..8afab27cdbc2 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -27,7 +27,7 @@ void delayed_work_timer_fn(unsigned long __data);
27enum { 27enum {
28 WORK_STRUCT_PENDING_BIT = 0, /* work item is pending execution */ 28 WORK_STRUCT_PENDING_BIT = 0, /* work item is pending execution */
29 WORK_STRUCT_DELAYED_BIT = 1, /* work item is delayed */ 29 WORK_STRUCT_DELAYED_BIT = 1, /* work item is delayed */
30 WORK_STRUCT_CWQ_BIT = 2, /* data points to cwq */ 30 WORK_STRUCT_PWQ_BIT = 2, /* data points to pwq */
31 WORK_STRUCT_LINKED_BIT = 3, /* next work is linked to this one */ 31 WORK_STRUCT_LINKED_BIT = 3, /* next work is linked to this one */
32#ifdef CONFIG_DEBUG_OBJECTS_WORK 32#ifdef CONFIG_DEBUG_OBJECTS_WORK
33 WORK_STRUCT_STATIC_BIT = 4, /* static initializer (debugobjects) */ 33 WORK_STRUCT_STATIC_BIT = 4, /* static initializer (debugobjects) */
@@ -40,7 +40,7 @@ enum {
40 40
41 WORK_STRUCT_PENDING = 1 << WORK_STRUCT_PENDING_BIT, 41 WORK_STRUCT_PENDING = 1 << WORK_STRUCT_PENDING_BIT,
42 WORK_STRUCT_DELAYED = 1 << WORK_STRUCT_DELAYED_BIT, 42 WORK_STRUCT_DELAYED = 1 << WORK_STRUCT_DELAYED_BIT,
43 WORK_STRUCT_CWQ = 1 << WORK_STRUCT_CWQ_BIT, 43 WORK_STRUCT_PWQ = 1 << WORK_STRUCT_PWQ_BIT,
44 WORK_STRUCT_LINKED = 1 << WORK_STRUCT_LINKED_BIT, 44 WORK_STRUCT_LINKED = 1 << WORK_STRUCT_LINKED_BIT,
45#ifdef CONFIG_DEBUG_OBJECTS_WORK 45#ifdef CONFIG_DEBUG_OBJECTS_WORK
46 WORK_STRUCT_STATIC = 1 << WORK_STRUCT_STATIC_BIT, 46 WORK_STRUCT_STATIC = 1 << WORK_STRUCT_STATIC_BIT,
@@ -57,29 +57,36 @@ enum {
57 57
58 /* special cpu IDs */ 58 /* special cpu IDs */
59 WORK_CPU_UNBOUND = NR_CPUS, 59 WORK_CPU_UNBOUND = NR_CPUS,
60 WORK_CPU_NONE = NR_CPUS + 1, 60 WORK_CPU_END = NR_CPUS + 1,
61 WORK_CPU_LAST = WORK_CPU_NONE,
62 61
63 /* 62 /*
64 * Reserve 7 bits off of cwq pointer w/ debugobjects turned 63 * Reserve 7 bits off of pwq pointer w/ debugobjects turned off.
65 * off. This makes cwqs aligned to 256 bytes and allows 15 64 * This makes pwqs aligned to 256 bytes and allows 15 workqueue
66 * workqueue flush colors. 65 * flush colors.
67 */ 66 */
68 WORK_STRUCT_FLAG_BITS = WORK_STRUCT_COLOR_SHIFT + 67 WORK_STRUCT_FLAG_BITS = WORK_STRUCT_COLOR_SHIFT +
69 WORK_STRUCT_COLOR_BITS, 68 WORK_STRUCT_COLOR_BITS,
70 69
71 /* data contains off-queue information when !WORK_STRUCT_CWQ */ 70 /* data contains off-queue information when !WORK_STRUCT_PWQ */
72 WORK_OFFQ_FLAG_BASE = WORK_STRUCT_FLAG_BITS, 71 WORK_OFFQ_FLAG_BASE = WORK_STRUCT_FLAG_BITS,
73 72
74 WORK_OFFQ_CANCELING = (1 << WORK_OFFQ_FLAG_BASE), 73 WORK_OFFQ_CANCELING = (1 << WORK_OFFQ_FLAG_BASE),
75 74
75 /*
76 * When a work item is off queue, its high bits point to the last
77 * pool it was on. Cap at 31 bits and use the highest number to
78 * indicate that no pool is associated.
79 */
76 WORK_OFFQ_FLAG_BITS = 1, 80 WORK_OFFQ_FLAG_BITS = 1,
77 WORK_OFFQ_CPU_SHIFT = WORK_OFFQ_FLAG_BASE + WORK_OFFQ_FLAG_BITS, 81 WORK_OFFQ_POOL_SHIFT = WORK_OFFQ_FLAG_BASE + WORK_OFFQ_FLAG_BITS,
82 WORK_OFFQ_LEFT = BITS_PER_LONG - WORK_OFFQ_POOL_SHIFT,
83 WORK_OFFQ_POOL_BITS = WORK_OFFQ_LEFT <= 31 ? WORK_OFFQ_LEFT : 31,
84 WORK_OFFQ_POOL_NONE = (1LU << WORK_OFFQ_POOL_BITS) - 1,
78 85
79 /* convenience constants */ 86 /* convenience constants */
80 WORK_STRUCT_FLAG_MASK = (1UL << WORK_STRUCT_FLAG_BITS) - 1, 87 WORK_STRUCT_FLAG_MASK = (1UL << WORK_STRUCT_FLAG_BITS) - 1,
81 WORK_STRUCT_WQ_DATA_MASK = ~WORK_STRUCT_FLAG_MASK, 88 WORK_STRUCT_WQ_DATA_MASK = ~WORK_STRUCT_FLAG_MASK,
82 WORK_STRUCT_NO_CPU = (unsigned long)WORK_CPU_NONE << WORK_OFFQ_CPU_SHIFT, 89 WORK_STRUCT_NO_POOL = (unsigned long)WORK_OFFQ_POOL_NONE << WORK_OFFQ_POOL_SHIFT,
83 90
84 /* bit mask for work_busy() return values */ 91 /* bit mask for work_busy() return values */
85 WORK_BUSY_PENDING = 1 << 0, 92 WORK_BUSY_PENDING = 1 << 0,
@@ -95,13 +102,16 @@ struct work_struct {
95#endif 102#endif
96}; 103};
97 104
98#define WORK_DATA_INIT() ATOMIC_LONG_INIT(WORK_STRUCT_NO_CPU) 105#define WORK_DATA_INIT() ATOMIC_LONG_INIT(WORK_STRUCT_NO_POOL)
99#define WORK_DATA_STATIC_INIT() \ 106#define WORK_DATA_STATIC_INIT() \
100 ATOMIC_LONG_INIT(WORK_STRUCT_NO_CPU | WORK_STRUCT_STATIC) 107 ATOMIC_LONG_INIT(WORK_STRUCT_NO_POOL | WORK_STRUCT_STATIC)
101 108
102struct delayed_work { 109struct delayed_work {
103 struct work_struct work; 110 struct work_struct work;
104 struct timer_list timer; 111 struct timer_list timer;
112
113 /* target workqueue and CPU ->timer uses to queue ->work */
114 struct workqueue_struct *wq;
105 int cpu; 115 int cpu;
106}; 116};
107 117
@@ -426,7 +436,6 @@ extern bool cancel_delayed_work_sync(struct delayed_work *dwork);
426extern void workqueue_set_max_active(struct workqueue_struct *wq, 436extern void workqueue_set_max_active(struct workqueue_struct *wq,
427 int max_active); 437 int max_active);
428extern bool workqueue_congested(unsigned int cpu, struct workqueue_struct *wq); 438extern bool workqueue_congested(unsigned int cpu, struct workqueue_struct *wq);
429extern unsigned int work_cpu(struct work_struct *work);
430extern unsigned int work_busy(struct work_struct *work); 439extern unsigned int work_busy(struct work_struct *work);
431 440
432/* 441/*
diff --git a/include/net/act_api.h b/include/net/act_api.h
index c739531e1564..06ef7e926a66 100644
--- a/include/net/act_api.h
+++ b/include/net/act_api.h
@@ -35,21 +35,6 @@ struct tcf_common {
35#define tcf_lock common.tcfc_lock 35#define tcf_lock common.tcfc_lock
36#define tcf_rcu common.tcfc_rcu 36#define tcf_rcu common.tcfc_rcu
37 37
38struct tcf_police {
39 struct tcf_common common;
40 int tcfp_result;
41 u32 tcfp_ewma_rate;
42 u32 tcfp_burst;
43 u32 tcfp_mtu;
44 u32 tcfp_toks;
45 u32 tcfp_ptoks;
46 psched_time_t tcfp_t_c;
47 struct qdisc_rate_table *tcfp_R_tab;
48 struct qdisc_rate_table *tcfp_P_tab;
49};
50#define to_police(pc) \
51 container_of(pc, struct tcf_police, common)
52
53struct tcf_hashinfo { 38struct tcf_hashinfo {
54 struct tcf_common **htab; 39 struct tcf_common **htab;
55 unsigned int hmask; 40 unsigned int hmask;
@@ -91,7 +76,9 @@ struct tc_action_ops {
91 int (*dump)(struct sk_buff *, struct tc_action *, int, int); 76 int (*dump)(struct sk_buff *, struct tc_action *, int, int);
92 int (*cleanup)(struct tc_action *, int bind); 77 int (*cleanup)(struct tc_action *, int bind);
93 int (*lookup)(struct tc_action *, u32); 78 int (*lookup)(struct tc_action *, u32);
94 int (*init)(struct nlattr *, struct nlattr *, struct tc_action *, int , int); 79 int (*init)(struct net *net, struct nlattr *nla,
80 struct nlattr *est, struct tc_action *act, int ovr,
81 int bind);
95 int (*walk)(struct sk_buff *, struct netlink_callback *, int, struct tc_action *); 82 int (*walk)(struct sk_buff *, struct netlink_callback *, int, struct tc_action *);
96}; 83};
97 84
@@ -116,8 +103,12 @@ extern int tcf_register_action(struct tc_action_ops *a);
116extern int tcf_unregister_action(struct tc_action_ops *a); 103extern int tcf_unregister_action(struct tc_action_ops *a);
117extern void tcf_action_destroy(struct tc_action *a, int bind); 104extern void tcf_action_destroy(struct tc_action *a, int bind);
118extern int tcf_action_exec(struct sk_buff *skb, const struct tc_action *a, struct tcf_result *res); 105extern int tcf_action_exec(struct sk_buff *skb, const struct tc_action *a, struct tcf_result *res);
119extern struct tc_action *tcf_action_init(struct nlattr *nla, struct nlattr *est, char *n, int ovr, int bind); 106extern struct tc_action *tcf_action_init(struct net *net, struct nlattr *nla,
120extern struct tc_action *tcf_action_init_1(struct nlattr *nla, struct nlattr *est, char *n, int ovr, int bind); 107 struct nlattr *est, char *n, int ovr,
108 int bind);
109extern struct tc_action *tcf_action_init_1(struct net *net, struct nlattr *nla,
110 struct nlattr *est, char *n, int ovr,
111 int bind);
121extern int tcf_action_dump(struct sk_buff *skb, struct tc_action *a, int, int); 112extern int tcf_action_dump(struct sk_buff *skb, struct tc_action *a, int, int);
122extern int tcf_action_dump_old(struct sk_buff *skb, struct tc_action *a, int, int); 113extern int tcf_action_dump_old(struct sk_buff *skb, struct tc_action *a, int, int);
123extern int tcf_action_dump_1(struct sk_buff *skb, struct tc_action *a, int, int); 114extern int tcf_action_dump_1(struct sk_buff *skb, struct tc_action *a, int, int);
diff --git a/include/net/addrconf.h b/include/net/addrconf.h
index df4ef9453384..40be2a0d8ae1 100644
--- a/include/net/addrconf.h
+++ b/include/net/addrconf.h
@@ -15,6 +15,10 @@
15 15
16#define IPV6_MAX_ADDRESSES 16 16#define IPV6_MAX_ADDRESSES 16
17 17
18#define ADDRCONF_TIMER_FUZZ_MINUS (HZ > 50 ? HZ / 50 : 1)
19#define ADDRCONF_TIMER_FUZZ (HZ / 4)
20#define ADDRCONF_TIMER_FUZZ_MAX (HZ)
21
18#include <linux/in.h> 22#include <linux/in.h>
19#include <linux/in6.h> 23#include <linux/in6.h>
20 24
@@ -150,7 +154,31 @@ extern void addrconf_dad_failure(struct inet6_ifaddr *ifp);
150extern bool ipv6_chk_mcast_addr(struct net_device *dev, 154extern bool ipv6_chk_mcast_addr(struct net_device *dev,
151 const struct in6_addr *group, 155 const struct in6_addr *group,
152 const struct in6_addr *src_addr); 156 const struct in6_addr *src_addr);
153extern bool ipv6_is_mld(struct sk_buff *skb, int nexthdr); 157
158/*
159 * identify MLD packets for MLD filter exceptions
160 */
161static inline bool ipv6_is_mld(struct sk_buff *skb, int nexthdr, int offset)
162{
163 struct icmp6hdr *hdr;
164
165 if (nexthdr != IPPROTO_ICMPV6 ||
166 !pskb_network_may_pull(skb, offset + sizeof(struct icmp6hdr)))
167 return false;
168
169 hdr = (struct icmp6hdr *)(skb_network_header(skb) + offset);
170
171 switch (hdr->icmp6_type) {
172 case ICMPV6_MGM_QUERY:
173 case ICMPV6_MGM_REPORT:
174 case ICMPV6_MGM_REDUCTION:
175 case ICMPV6_MLD2_REPORT:
176 return true;
177 default:
178 break;
179 }
180 return false;
181}
154 182
155extern void addrconf_prefix_rcv(struct net_device *dev, 183extern void addrconf_prefix_rcv(struct net_device *dev,
156 u8 *opt, int len, bool sllao); 184 u8 *opt, int len, bool sllao);
@@ -257,30 +285,55 @@ static inline void addrconf_addr_solict_mult(const struct in6_addr *addr,
257 htonl(0xFF000000) | addr->s6_addr32[3]); 285 htonl(0xFF000000) | addr->s6_addr32[3]);
258} 286}
259 287
260static inline int ipv6_addr_is_multicast(const struct in6_addr *addr) 288static inline bool ipv6_addr_is_multicast(const struct in6_addr *addr)
261{ 289{
262 return (addr->s6_addr32[0] & htonl(0xFF000000)) == htonl(0xFF000000); 290 return (addr->s6_addr32[0] & htonl(0xFF000000)) == htonl(0xFF000000);
263} 291}
264 292
265static inline int ipv6_addr_is_ll_all_nodes(const struct in6_addr *addr) 293static inline bool ipv6_addr_is_ll_all_nodes(const struct in6_addr *addr)
266{ 294{
295#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64
296 __u64 *p = (__u64 *)addr;
297 return ((p[0] ^ cpu_to_be64(0xff02000000000000UL)) | (p[1] ^ cpu_to_be64(1))) == 0UL;
298#else
267 return ((addr->s6_addr32[0] ^ htonl(0xff020000)) | 299 return ((addr->s6_addr32[0] ^ htonl(0xff020000)) |
268 addr->s6_addr32[1] | addr->s6_addr32[2] | 300 addr->s6_addr32[1] | addr->s6_addr32[2] |
269 (addr->s6_addr32[3] ^ htonl(0x00000001))) == 0; 301 (addr->s6_addr32[3] ^ htonl(0x00000001))) == 0;
302#endif
270} 303}
271 304
272static inline int ipv6_addr_is_ll_all_routers(const struct in6_addr *addr) 305static inline bool ipv6_addr_is_ll_all_routers(const struct in6_addr *addr)
273{ 306{
307#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64
308 __u64 *p = (__u64 *)addr;
309 return ((p[0] ^ cpu_to_be64(0xff02000000000000UL)) | (p[1] ^ cpu_to_be64(2))) == 0UL;
310#else
274 return ((addr->s6_addr32[0] ^ htonl(0xff020000)) | 311 return ((addr->s6_addr32[0] ^ htonl(0xff020000)) |
275 addr->s6_addr32[1] | addr->s6_addr32[2] | 312 addr->s6_addr32[1] | addr->s6_addr32[2] |
276 (addr->s6_addr32[3] ^ htonl(0x00000002))) == 0; 313 (addr->s6_addr32[3] ^ htonl(0x00000002))) == 0;
314#endif
277} 315}
278 316
279static inline int ipv6_addr_is_isatap(const struct in6_addr *addr) 317static inline bool ipv6_addr_is_isatap(const struct in6_addr *addr)
280{ 318{
281 return (addr->s6_addr32[2] | htonl(0x02000000)) == htonl(0x02005EFE); 319 return (addr->s6_addr32[2] | htonl(0x02000000)) == htonl(0x02005EFE);
282} 320}
283 321
322static inline bool ipv6_addr_is_solict_mult(const struct in6_addr *addr)
323{
324#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64
325 __u64 *p = (__u64 *)addr;
326 return ((p[0] ^ cpu_to_be64(0xff02000000000000UL)) |
327 ((p[1] ^ cpu_to_be64(0x00000001ff000000UL)) &
328 cpu_to_be64(0xffffffffff000000UL))) == 0UL;
329#else
330 return ((addr->s6_addr32[0] ^ htonl(0xff020000)) |
331 addr->s6_addr32[1] |
332 (addr->s6_addr32[2] ^ htonl(0x00000001)) |
333 (addr->s6_addr[12] ^ 0xff)) == 0;
334#endif
335}
336
284#ifdef CONFIG_PROC_FS 337#ifdef CONFIG_PROC_FS
285extern int if6_proc_init(void); 338extern int if6_proc_init(void);
286extern void if6_proc_exit(void); 339extern void if6_proc_exit(void);
diff --git a/include/net/bluetooth/a2mp.h b/include/net/bluetooth/a2mp.h
index 42f21766c538..487b54c1308f 100644
--- a/include/net/bluetooth/a2mp.h
+++ b/include/net/bluetooth/a2mp.h
@@ -23,6 +23,7 @@ enum amp_mgr_state {
23 READ_LOC_AMP_INFO, 23 READ_LOC_AMP_INFO,
24 READ_LOC_AMP_ASSOC, 24 READ_LOC_AMP_ASSOC,
25 READ_LOC_AMP_ASSOC_FINAL, 25 READ_LOC_AMP_ASSOC_FINAL,
26 WRITE_REMOTE_AMP_ASSOC,
26}; 27};
27 28
28struct amp_mgr { 29struct amp_mgr {
@@ -33,7 +34,7 @@ struct amp_mgr {
33 struct kref kref; 34 struct kref kref;
34 __u8 ident; 35 __u8 ident;
35 __u8 handle; 36 __u8 handle;
36 enum amp_mgr_state state; 37 unsigned long state;
37 unsigned long flags; 38 unsigned long flags;
38 39
39 struct list_head amp_ctrls; 40 struct list_head amp_ctrls;
@@ -144,5 +145,6 @@ void a2mp_discover_amp(struct l2cap_chan *chan);
144void a2mp_send_getinfo_rsp(struct hci_dev *hdev); 145void a2mp_send_getinfo_rsp(struct hci_dev *hdev);
145void a2mp_send_getampassoc_rsp(struct hci_dev *hdev, u8 status); 146void a2mp_send_getampassoc_rsp(struct hci_dev *hdev, u8 status);
146void a2mp_send_create_phy_link_req(struct hci_dev *hdev, u8 status); 147void a2mp_send_create_phy_link_req(struct hci_dev *hdev, u8 status);
148void a2mp_send_create_phy_link_rsp(struct hci_dev *hdev, u8 status);
147 149
148#endif /* __A2MP_H */ 150#endif /* __A2MP_H */
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
index 2554b3f5222a..9531beee09b5 100644
--- a/include/net/bluetooth/bluetooth.h
+++ b/include/net/bluetooth/bluetooth.h
@@ -166,6 +166,29 @@ typedef struct {
166#define BDADDR_LE_PUBLIC 0x01 166#define BDADDR_LE_PUBLIC 0x01
167#define BDADDR_LE_RANDOM 0x02 167#define BDADDR_LE_RANDOM 0x02
168 168
169static inline bool bdaddr_type_is_valid(__u8 type)
170{
171 switch (type) {
172 case BDADDR_BREDR:
173 case BDADDR_LE_PUBLIC:
174 case BDADDR_LE_RANDOM:
175 return true;
176 }
177
178 return false;
179}
180
181static inline bool bdaddr_type_is_le(__u8 type)
182{
183 switch (type) {
184 case BDADDR_LE_PUBLIC:
185 case BDADDR_LE_RANDOM:
186 return true;
187 }
188
189 return false;
190}
191
169#define BDADDR_ANY (&(bdaddr_t) {{0, 0, 0, 0, 0, 0} }) 192#define BDADDR_ANY (&(bdaddr_t) {{0, 0, 0, 0, 0, 0} })
170#define BDADDR_LOCAL (&(bdaddr_t) {{0, 0, 0, 0xff, 0xff, 0xff} }) 193#define BDADDR_LOCAL (&(bdaddr_t) {{0, 0, 0, 0xff, 0xff, 0xff} })
171 194
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index 45eee08157bb..7f12c25f1fca 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -943,6 +943,12 @@ struct hci_rp_le_read_buffer_size {
943 __u8 le_max_pkt; 943 __u8 le_max_pkt;
944} __packed; 944} __packed;
945 945
946#define HCI_OP_LE_READ_LOCAL_FEATURES 0x2003
947struct hci_rp_le_read_local_features {
948 __u8 status;
949 __u8 features[8];
950} __packed;
951
946#define HCI_OP_LE_READ_ADV_TX_POWER 0x2007 952#define HCI_OP_LE_READ_ADV_TX_POWER 0x2007
947struct hci_rp_le_read_adv_tx_power { 953struct hci_rp_le_read_adv_tx_power {
948 __u8 status; 954 __u8 status;
@@ -995,6 +1001,12 @@ struct hci_cp_le_create_conn {
995 1001
996#define HCI_OP_LE_CREATE_CONN_CANCEL 0x200e 1002#define HCI_OP_LE_CREATE_CONN_CANCEL 0x200e
997 1003
1004#define HCI_OP_LE_READ_WHITE_LIST_SIZE 0x200f
1005struct hci_rp_le_read_white_list_size {
1006 __u8 status;
1007 __u8 size;
1008} __packed;
1009
998#define HCI_OP_LE_CONN_UPDATE 0x2013 1010#define HCI_OP_LE_CONN_UPDATE 0x2013
999struct hci_cp_le_conn_update { 1011struct hci_cp_le_conn_update {
1000 __le16 handle; 1012 __le16 handle;
@@ -1033,6 +1045,12 @@ struct hci_rp_le_ltk_neg_reply {
1033 __le16 handle; 1045 __le16 handle;
1034} __packed; 1046} __packed;
1035 1047
1048#define HCI_OP_LE_READ_SUPPORTED_STATES 0x201c
1049struct hci_rp_le_read_supported_states {
1050 __u8 status;
1051 __u8 le_states[8];
1052} __packed;
1053
1036/* ---- HCI Events ---- */ 1054/* ---- HCI Events ---- */
1037#define HCI_EV_INQUIRY_COMPLETE 0x01 1055#define HCI_EV_INQUIRY_COMPLETE 0x01
1038 1056
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 014a2eaa5389..90cf75afcb02 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -86,6 +86,7 @@ struct bdaddr_list {
86struct bt_uuid { 86struct bt_uuid {
87 struct list_head list; 87 struct list_head list;
88 u8 uuid[16]; 88 u8 uuid[16];
89 u8 size;
89 u8 svc_hint; 90 u8 svc_hint;
90}; 91};
91 92
@@ -152,6 +153,9 @@ struct hci_dev {
152 __u8 minor_class; 153 __u8 minor_class;
153 __u8 features[8]; 154 __u8 features[8];
154 __u8 host_features[8]; 155 __u8 host_features[8];
156 __u8 le_features[8];
157 __u8 le_white_list_size;
158 __u8 le_states[8];
155 __u8 commands[64]; 159 __u8 commands[64];
156 __u8 hci_ver; 160 __u8 hci_ver;
157 __u16 hci_rev; 161 __u16 hci_rev;
@@ -216,6 +220,7 @@ struct hci_dev {
216 unsigned long le_last_tx; 220 unsigned long le_last_tx;
217 221
218 struct workqueue_struct *workqueue; 222 struct workqueue_struct *workqueue;
223 struct workqueue_struct *req_workqueue;
219 224
220 struct work_struct power_on; 225 struct work_struct power_on;
221 struct delayed_work power_off; 226 struct delayed_work power_off;
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index 7588ef44ebaf..cdd33021f831 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -496,7 +496,6 @@ struct l2cap_chan {
496 __u16 frames_sent; 496 __u16 frames_sent;
497 __u16 unacked_frames; 497 __u16 unacked_frames;
498 __u8 retry_count; 498 __u8 retry_count;
499 __u16 srej_queue_next;
500 __u16 sdu_len; 499 __u16 sdu_len;
501 struct sk_buff *sdu; 500 struct sk_buff *sdu;
502 struct sk_buff *sdu_last_frag; 501 struct sk_buff *sdu_last_frag;
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 8e6a6b73b9c9..d581c6de5d64 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -19,6 +19,7 @@
19#include <linux/nl80211.h> 19#include <linux/nl80211.h>
20#include <linux/if_ether.h> 20#include <linux/if_ether.h>
21#include <linux/ieee80211.h> 21#include <linux/ieee80211.h>
22#include <linux/net.h>
22#include <net/regulatory.h> 23#include <net/regulatory.h>
23 24
24/** 25/**
@@ -99,6 +100,16 @@ enum ieee80211_band {
99 * @IEEE80211_CHAN_NO_HT40MINUS: extension channel below this channel 100 * @IEEE80211_CHAN_NO_HT40MINUS: extension channel below this channel
100 * is not permitted. 101 * is not permitted.
101 * @IEEE80211_CHAN_NO_OFDM: OFDM is not allowed on this channel. 102 * @IEEE80211_CHAN_NO_OFDM: OFDM is not allowed on this channel.
103 * @IEEE80211_CHAN_NO_80MHZ: If the driver supports 80 MHz on the band,
104 * this flag indicates that an 80 MHz channel cannot use this
105 * channel as the control or any of the secondary channels.
106 * This may be due to the driver or due to regulatory bandwidth
107 * restrictions.
108 * @IEEE80211_CHAN_NO_160MHZ: If the driver supports 160 MHz on the band,
109 * this flag indicates that an 160 MHz channel cannot use this
110 * channel as the control or any of the secondary channels.
111 * This may be due to the driver or due to regulatory bandwidth
112 * restrictions.
102 */ 113 */
103enum ieee80211_channel_flags { 114enum ieee80211_channel_flags {
104 IEEE80211_CHAN_DISABLED = 1<<0, 115 IEEE80211_CHAN_DISABLED = 1<<0,
@@ -108,11 +119,16 @@ enum ieee80211_channel_flags {
108 IEEE80211_CHAN_NO_HT40PLUS = 1<<4, 119 IEEE80211_CHAN_NO_HT40PLUS = 1<<4,
109 IEEE80211_CHAN_NO_HT40MINUS = 1<<5, 120 IEEE80211_CHAN_NO_HT40MINUS = 1<<5,
110 IEEE80211_CHAN_NO_OFDM = 1<<6, 121 IEEE80211_CHAN_NO_OFDM = 1<<6,
122 IEEE80211_CHAN_NO_80MHZ = 1<<7,
123 IEEE80211_CHAN_NO_160MHZ = 1<<8,
111}; 124};
112 125
113#define IEEE80211_CHAN_NO_HT40 \ 126#define IEEE80211_CHAN_NO_HT40 \
114 (IEEE80211_CHAN_NO_HT40PLUS | IEEE80211_CHAN_NO_HT40MINUS) 127 (IEEE80211_CHAN_NO_HT40PLUS | IEEE80211_CHAN_NO_HT40MINUS)
115 128
129#define IEEE80211_DFS_MIN_CAC_TIME_MS 60000
130#define IEEE80211_DFS_MIN_NOP_TIME_MS (30 * 60 * 1000)
131
116/** 132/**
117 * struct ieee80211_channel - channel definition 133 * struct ieee80211_channel - channel definition
118 * 134 *
@@ -133,6 +149,9 @@ enum ieee80211_channel_flags {
133 * to enable this, this is useful only on 5 GHz band. 149 * to enable this, this is useful only on 5 GHz band.
134 * @orig_mag: internal use 150 * @orig_mag: internal use
135 * @orig_mpwr: internal use 151 * @orig_mpwr: internal use
152 * @dfs_state: current state of this channel. Only relevant if radar is required
153 * on this channel.
154 * @dfs_state_entered: timestamp (jiffies) when the dfs state was entered.
136 */ 155 */
137struct ieee80211_channel { 156struct ieee80211_channel {
138 enum ieee80211_band band; 157 enum ieee80211_band band;
@@ -145,6 +164,8 @@ struct ieee80211_channel {
145 bool beacon_found; 164 bool beacon_found;
146 u32 orig_flags; 165 u32 orig_flags;
147 int orig_mag, orig_mpwr; 166 int orig_mag, orig_mpwr;
167 enum nl80211_dfs_state dfs_state;
168 unsigned long dfs_state_entered;
148}; 169};
149 170
150/** 171/**
@@ -281,9 +302,13 @@ struct ieee80211_supported_band {
281/** 302/**
282 * struct vif_params - describes virtual interface parameters 303 * struct vif_params - describes virtual interface parameters
283 * @use_4addr: use 4-address frames 304 * @use_4addr: use 4-address frames
305 * @macaddr: address to use for this virtual interface. This will only
306 * be used for non-netdevice interfaces. If this parameter is set
307 * to zero address the driver may determine the address as needed.
284 */ 308 */
285struct vif_params { 309struct vif_params {
286 int use_4addr; 310 int use_4addr;
311 u8 macaddr[ETH_ALEN];
287}; 312};
288 313
289/** 314/**
@@ -326,7 +351,7 @@ struct cfg80211_chan_def {
326 * cfg80211_get_chandef_type - return old channel type from chandef 351 * cfg80211_get_chandef_type - return old channel type from chandef
327 * @chandef: the channel definition 352 * @chandef: the channel definition
328 * 353 *
329 * Returns the old channel type (NOHT, HT20, HT40+/-) from a given 354 * Return: The old channel type (NOHT, HT20, HT40+/-) from a given
330 * chandef, which must have a bandwidth allowing this conversion. 355 * chandef, which must have a bandwidth allowing this conversion.
331 */ 356 */
332static inline enum nl80211_channel_type 357static inline enum nl80211_channel_type
@@ -364,7 +389,7 @@ void cfg80211_chandef_create(struct cfg80211_chan_def *chandef,
364 * @chandef1: first channel definition 389 * @chandef1: first channel definition
365 * @chandef2: second channel definition 390 * @chandef2: second channel definition
366 * 391 *
367 * Returns %true if the channels defined by the channel definitions are 392 * Return: %true if the channels defined by the channel definitions are
368 * identical, %false otherwise. 393 * identical, %false otherwise.
369 */ 394 */
370static inline bool 395static inline bool
@@ -382,7 +407,7 @@ cfg80211_chandef_identical(const struct cfg80211_chan_def *chandef1,
382 * @chandef1: first channel definition 407 * @chandef1: first channel definition
383 * @chandef2: second channel definition 408 * @chandef2: second channel definition
384 * 409 *
385 * Returns %NULL if the given channel definitions are incompatible, 410 * Return: %NULL if the given channel definitions are incompatible,
386 * chandef1 or chandef2 otherwise. 411 * chandef1 or chandef2 otherwise.
387 */ 412 */
388const struct cfg80211_chan_def * 413const struct cfg80211_chan_def *
@@ -392,6 +417,7 @@ cfg80211_chandef_compatible(const struct cfg80211_chan_def *chandef1,
392/** 417/**
393 * cfg80211_chandef_valid - check if a channel definition is valid 418 * cfg80211_chandef_valid - check if a channel definition is valid
394 * @chandef: the channel definition to check 419 * @chandef: the channel definition to check
420 * Return: %true if the channel definition is valid. %false otherwise.
395 */ 421 */
396bool cfg80211_chandef_valid(const struct cfg80211_chan_def *chandef); 422bool cfg80211_chandef_valid(const struct cfg80211_chan_def *chandef);
397 423
@@ -399,7 +425,8 @@ bool cfg80211_chandef_valid(const struct cfg80211_chan_def *chandef);
399 * cfg80211_chandef_usable - check if secondary channels can be used 425 * cfg80211_chandef_usable - check if secondary channels can be used
400 * @wiphy: the wiphy to validate against 426 * @wiphy: the wiphy to validate against
401 * @chandef: the channel definition to check 427 * @chandef: the channel definition to check
402 * @prohibited_flags: the regulatory chanenl flags that must not be set 428 * @prohibited_flags: the regulatory channel flags that must not be set
429 * Return: %true if secondary channels are usable. %false otherwise.
403 */ 430 */
404bool cfg80211_chandef_usable(struct wiphy *wiphy, 431bool cfg80211_chandef_usable(struct wiphy *wiphy,
405 const struct cfg80211_chan_def *chandef, 432 const struct cfg80211_chan_def *chandef,
@@ -521,6 +548,26 @@ struct cfg80211_beacon_data {
521 size_t probe_resp_len; 548 size_t probe_resp_len;
522}; 549};
523 550
551struct mac_address {
552 u8 addr[ETH_ALEN];
553};
554
555/**
556 * struct cfg80211_acl_data - Access control list data
557 *
558 * @acl_policy: ACL policy to be applied on the station's
559 * entry specified by mac_addr
560 * @n_acl_entries: Number of MAC address entries passed
561 * @mac_addrs: List of MAC addresses of stations to be used for ACL
562 */
563struct cfg80211_acl_data {
564 enum nl80211_acl_policy acl_policy;
565 int n_acl_entries;
566
567 /* Keep it last */
568 struct mac_address mac_addrs[];
569};
570
524/** 571/**
525 * struct cfg80211_ap_settings - AP configuration 572 * struct cfg80211_ap_settings - AP configuration
526 * 573 *
@@ -540,6 +587,9 @@ struct cfg80211_beacon_data {
540 * @inactivity_timeout: time in seconds to determine station's inactivity. 587 * @inactivity_timeout: time in seconds to determine station's inactivity.
541 * @p2p_ctwindow: P2P CT Window 588 * @p2p_ctwindow: P2P CT Window
542 * @p2p_opp_ps: P2P opportunistic PS 589 * @p2p_opp_ps: P2P opportunistic PS
590 * @acl: ACL configuration used by the drivers which has support for
591 * MAC address based access control
592 * @radar_required: set if radar detection is required
543 */ 593 */
544struct cfg80211_ap_settings { 594struct cfg80211_ap_settings {
545 struct cfg80211_chan_def chandef; 595 struct cfg80211_chan_def chandef;
@@ -556,6 +606,8 @@ struct cfg80211_ap_settings {
556 int inactivity_timeout; 606 int inactivity_timeout;
557 u8 p2p_ctwindow; 607 u8 p2p_ctwindow;
558 bool p2p_opp_ps; 608 bool p2p_opp_ps;
609 const struct cfg80211_acl_data *acl;
610 bool radar_required;
559}; 611};
560 612
561/** 613/**
@@ -574,12 +626,14 @@ enum plink_actions {
574/** 626/**
575 * enum station_parameters_apply_mask - station parameter values to apply 627 * enum station_parameters_apply_mask - station parameter values to apply
576 * @STATION_PARAM_APPLY_UAPSD: apply new uAPSD parameters (uapsd_queues, max_sp) 628 * @STATION_PARAM_APPLY_UAPSD: apply new uAPSD parameters (uapsd_queues, max_sp)
629 * @STATION_PARAM_APPLY_CAPABILITY: apply new capability
577 * 630 *
578 * Not all station parameters have in-band "no change" signalling, 631 * Not all station parameters have in-band "no change" signalling,
579 * for those that don't these flags will are used. 632 * for those that don't these flags will are used.
580 */ 633 */
581enum station_parameters_apply_mask { 634enum station_parameters_apply_mask {
582 STATION_PARAM_APPLY_UAPSD = BIT(0), 635 STATION_PARAM_APPLY_UAPSD = BIT(0),
636 STATION_PARAM_APPLY_CAPABILITY = BIT(1),
583}; 637};
584 638
585/** 639/**
@@ -608,6 +662,11 @@ enum station_parameters_apply_mask {
608 * @sta_modify_mask: bitmap indicating which parameters changed 662 * @sta_modify_mask: bitmap indicating which parameters changed
609 * (for those that don't have a natural "no change" value), 663 * (for those that don't have a natural "no change" value),
610 * see &enum station_parameters_apply_mask 664 * see &enum station_parameters_apply_mask
665 * @local_pm: local link-specific mesh power save mode (no change when set
666 * to unknown)
667 * @capability: station capability
668 * @ext_capab: extended capabilities of the station
669 * @ext_capab_len: number of extended capabilities
611 */ 670 */
612struct station_parameters { 671struct station_parameters {
613 u8 *supported_rates; 672 u8 *supported_rates;
@@ -623,6 +682,10 @@ struct station_parameters {
623 struct ieee80211_vht_cap *vht_capa; 682 struct ieee80211_vht_cap *vht_capa;
624 u8 uapsd_queues; 683 u8 uapsd_queues;
625 u8 max_sp; 684 u8 max_sp;
685 enum nl80211_mesh_power_mode local_pm;
686 u16 capability;
687 u8 *ext_capab;
688 u8 ext_capab_len;
626}; 689};
627 690
628/** 691/**
@@ -634,14 +697,16 @@ struct station_parameters {
634 * @STATION_INFO_INACTIVE_TIME: @inactive_time filled 697 * @STATION_INFO_INACTIVE_TIME: @inactive_time filled
635 * @STATION_INFO_RX_BYTES: @rx_bytes filled 698 * @STATION_INFO_RX_BYTES: @rx_bytes filled
636 * @STATION_INFO_TX_BYTES: @tx_bytes filled 699 * @STATION_INFO_TX_BYTES: @tx_bytes filled
700 * @STATION_INFO_RX_BYTES64: @rx_bytes filled with 64-bit value
701 * @STATION_INFO_TX_BYTES64: @tx_bytes filled with 64-bit value
637 * @STATION_INFO_LLID: @llid filled 702 * @STATION_INFO_LLID: @llid filled
638 * @STATION_INFO_PLID: @plid filled 703 * @STATION_INFO_PLID: @plid filled
639 * @STATION_INFO_PLINK_STATE: @plink_state filled 704 * @STATION_INFO_PLINK_STATE: @plink_state filled
640 * @STATION_INFO_SIGNAL: @signal filled 705 * @STATION_INFO_SIGNAL: @signal filled
641 * @STATION_INFO_TX_BITRATE: @txrate fields are filled 706 * @STATION_INFO_TX_BITRATE: @txrate fields are filled
642 * (tx_bitrate, tx_bitrate_flags and tx_bitrate_mcs) 707 * (tx_bitrate, tx_bitrate_flags and tx_bitrate_mcs)
643 * @STATION_INFO_RX_PACKETS: @rx_packets filled 708 * @STATION_INFO_RX_PACKETS: @rx_packets filled with 32-bit value
644 * @STATION_INFO_TX_PACKETS: @tx_packets filled 709 * @STATION_INFO_TX_PACKETS: @tx_packets filled with 32-bit value
645 * @STATION_INFO_TX_RETRIES: @tx_retries filled 710 * @STATION_INFO_TX_RETRIES: @tx_retries filled
646 * @STATION_INFO_TX_FAILED: @tx_failed filled 711 * @STATION_INFO_TX_FAILED: @tx_failed filled
647 * @STATION_INFO_RX_DROP_MISC: @rx_dropped_misc filled 712 * @STATION_INFO_RX_DROP_MISC: @rx_dropped_misc filled
@@ -653,6 +718,9 @@ struct station_parameters {
653 * @STATION_INFO_STA_FLAGS: @sta_flags filled 718 * @STATION_INFO_STA_FLAGS: @sta_flags filled
654 * @STATION_INFO_BEACON_LOSS_COUNT: @beacon_loss_count filled 719 * @STATION_INFO_BEACON_LOSS_COUNT: @beacon_loss_count filled
655 * @STATION_INFO_T_OFFSET: @t_offset filled 720 * @STATION_INFO_T_OFFSET: @t_offset filled
721 * @STATION_INFO_LOCAL_PM: @local_pm filled
722 * @STATION_INFO_PEER_PM: @peer_pm filled
723 * @STATION_INFO_NONPEER_PM: @nonpeer_pm filled
656 */ 724 */
657enum station_info_flags { 725enum station_info_flags {
658 STATION_INFO_INACTIVE_TIME = 1<<0, 726 STATION_INFO_INACTIVE_TIME = 1<<0,
@@ -676,6 +744,11 @@ enum station_info_flags {
676 STATION_INFO_STA_FLAGS = 1<<18, 744 STATION_INFO_STA_FLAGS = 1<<18,
677 STATION_INFO_BEACON_LOSS_COUNT = 1<<19, 745 STATION_INFO_BEACON_LOSS_COUNT = 1<<19,
678 STATION_INFO_T_OFFSET = 1<<20, 746 STATION_INFO_T_OFFSET = 1<<20,
747 STATION_INFO_LOCAL_PM = 1<<21,
748 STATION_INFO_PEER_PM = 1<<22,
749 STATION_INFO_NONPEER_PM = 1<<23,
750 STATION_INFO_RX_BYTES64 = 1<<24,
751 STATION_INFO_TX_BYTES64 = 1<<25,
679}; 752};
680 753
681/** 754/**
@@ -789,13 +862,16 @@ struct sta_bss_parameters {
789 * @sta_flags: station flags mask & values 862 * @sta_flags: station flags mask & values
790 * @beacon_loss_count: Number of times beacon loss event has triggered. 863 * @beacon_loss_count: Number of times beacon loss event has triggered.
791 * @t_offset: Time offset of the station relative to this host. 864 * @t_offset: Time offset of the station relative to this host.
865 * @local_pm: local mesh STA power save mode
866 * @peer_pm: peer mesh STA power save mode
867 * @nonpeer_pm: non-peer mesh STA power save mode
792 */ 868 */
793struct station_info { 869struct station_info {
794 u32 filled; 870 u32 filled;
795 u32 connected_time; 871 u32 connected_time;
796 u32 inactive_time; 872 u32 inactive_time;
797 u32 rx_bytes; 873 u64 rx_bytes;
798 u32 tx_bytes; 874 u64 tx_bytes;
799 u16 llid; 875 u16 llid;
800 u16 plid; 876 u16 plid;
801 u8 plink_state; 877 u8 plink_state;
@@ -818,6 +894,9 @@ struct station_info {
818 894
819 u32 beacon_loss_count; 895 u32 beacon_loss_count;
820 s64 t_offset; 896 s64 t_offset;
897 enum nl80211_mesh_power_mode local_pm;
898 enum nl80211_mesh_power_mode peer_pm;
899 enum nl80211_mesh_power_mode nonpeer_pm;
821 900
822 /* 901 /*
823 * Note: Add a new enum station_info_flags value for each new field and 902 * Note: Add a new enum station_info_flags value for each new field and
@@ -993,6 +1072,10 @@ struct bss_parameters {
993 * @dot11MeshHWMPconfirmationInterval: The minimum interval of time (in TUs) 1072 * @dot11MeshHWMPconfirmationInterval: The minimum interval of time (in TUs)
994 * during which a mesh STA can send only one Action frame containing 1073 * during which a mesh STA can send only one Action frame containing
995 * a PREQ element for root path confirmation. 1074 * a PREQ element for root path confirmation.
1075 * @power_mode: The default mesh power save mode which will be the initial
1076 * setting for new peer links.
1077 * @dot11MeshAwakeWindowDuration: The duration in TUs the STA will remain awake
1078 * after transmitting its beacon.
996 */ 1079 */
997struct mesh_config { 1080struct mesh_config {
998 u16 dot11MeshRetryTimeout; 1081 u16 dot11MeshRetryTimeout;
@@ -1020,6 +1103,8 @@ struct mesh_config {
1020 u32 dot11MeshHWMPactivePathToRootTimeout; 1103 u32 dot11MeshHWMPactivePathToRootTimeout;
1021 u16 dot11MeshHWMProotInterval; 1104 u16 dot11MeshHWMProotInterval;
1022 u16 dot11MeshHWMPconfirmationInterval; 1105 u16 dot11MeshHWMPconfirmationInterval;
1106 enum nl80211_mesh_power_mode power_mode;
1107 u16 dot11MeshAwakeWindowDuration;
1023}; 1108};
1024 1109
1025/** 1110/**
@@ -1034,6 +1119,8 @@ struct mesh_config {
1034 * @ie_len: length of vendor information elements 1119 * @ie_len: length of vendor information elements
1035 * @is_authenticated: this mesh requires authentication 1120 * @is_authenticated: this mesh requires authentication
1036 * @is_secure: this mesh uses security 1121 * @is_secure: this mesh uses security
1122 * @dtim_period: DTIM period to use
1123 * @beacon_interval: beacon interval to use
1037 * @mcast_rate: multicat rate for Mesh Node [6Mbps is the default for 802.11a] 1124 * @mcast_rate: multicat rate for Mesh Node [6Mbps is the default for 802.11a]
1038 * 1125 *
1039 * These parameters are fixed when the mesh is created. 1126 * These parameters are fixed when the mesh is created.
@@ -1049,6 +1136,8 @@ struct mesh_setup {
1049 u8 ie_len; 1136 u8 ie_len;
1050 bool is_authenticated; 1137 bool is_authenticated;
1051 bool is_secure; 1138 bool is_secure;
1139 u8 dtim_period;
1140 u16 beacon_interval;
1052 int mcast_rate[IEEE80211_NUM_BANDS]; 1141 int mcast_rate[IEEE80211_NUM_BANDS];
1053}; 1142};
1054 1143
@@ -1168,6 +1257,7 @@ struct cfg80211_match_set {
1168 * @n_match_sets: number of match sets 1257 * @n_match_sets: number of match sets
1169 * @wiphy: the wiphy this was for 1258 * @wiphy: the wiphy this was for
1170 * @dev: the interface 1259 * @dev: the interface
1260 * @scan_start: start time of the scheduled scan
1171 * @channels: channels to scan 1261 * @channels: channels to scan
1172 * @rssi_thold: don't report scan results below this threshold (in s32 dBm) 1262 * @rssi_thold: don't report scan results below this threshold (in s32 dBm)
1173 */ 1263 */
@@ -1207,11 +1297,13 @@ enum cfg80211_signal_type {
1207 1297
1208/** 1298/**
1209 * struct cfg80211_bss_ie_data - BSS entry IE data 1299 * struct cfg80211_bss_ie_data - BSS entry IE data
1300 * @tsf: TSF contained in the frame that carried these IEs
1210 * @rcu_head: internal use, for freeing 1301 * @rcu_head: internal use, for freeing
1211 * @len: length of the IEs 1302 * @len: length of the IEs
1212 * @data: IE data 1303 * @data: IE data
1213 */ 1304 */
1214struct cfg80211_bss_ies { 1305struct cfg80211_bss_ies {
1306 u64 tsf;
1215 struct rcu_head rcu_head; 1307 struct rcu_head rcu_head;
1216 int len; 1308 int len;
1217 u8 data[]; 1309 u8 data[];
@@ -1225,29 +1317,32 @@ struct cfg80211_bss_ies {
1225 * 1317 *
1226 * @channel: channel this BSS is on 1318 * @channel: channel this BSS is on
1227 * @bssid: BSSID of the BSS 1319 * @bssid: BSSID of the BSS
1228 * @tsf: timestamp of last received update
1229 * @beacon_interval: the beacon interval as from the frame 1320 * @beacon_interval: the beacon interval as from the frame
1230 * @capability: the capability field in host byte order 1321 * @capability: the capability field in host byte order
1231 * @ies: the information elements (Note that there 1322 * @ies: the information elements (Note that there is no guarantee that these
1232 * is no guarantee that these are well-formed!); this is a pointer to 1323 * are well-formed!); this is a pointer to either the beacon_ies or
1233 * either the beacon_ies or proberesp_ies depending on whether Probe 1324 * proberesp_ies depending on whether Probe Response frame has been
1234 * Response frame has been received 1325 * received. It is always non-%NULL.
1235 * @beacon_ies: the information elements from the last Beacon frame 1326 * @beacon_ies: the information elements from the last Beacon frame
1327 * (implementation note: if @hidden_beacon_bss is set this struct doesn't
1328 * own the beacon_ies, but they're just pointers to the ones from the
1329 * @hidden_beacon_bss struct)
1236 * @proberesp_ies: the information elements from the last Probe Response frame 1330 * @proberesp_ies: the information elements from the last Probe Response frame
1331 * @hidden_beacon_bss: in case this BSS struct represents a probe response from
1332 * a BSS that hides the SSID in its beacon, this points to the BSS struct
1333 * that holds the beacon data. @beacon_ies is still valid, of course, and
1334 * points to the same data as hidden_beacon_bss->beacon_ies in that case.
1237 * @signal: signal strength value (type depends on the wiphy's signal_type) 1335 * @signal: signal strength value (type depends on the wiphy's signal_type)
1238 * @free_priv: function pointer to free private data
1239 * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes 1336 * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes
1240 */ 1337 */
1241struct cfg80211_bss { 1338struct cfg80211_bss {
1242 u64 tsf;
1243
1244 struct ieee80211_channel *channel; 1339 struct ieee80211_channel *channel;
1245 1340
1246 const struct cfg80211_bss_ies __rcu *ies; 1341 const struct cfg80211_bss_ies __rcu *ies;
1247 const struct cfg80211_bss_ies __rcu *beacon_ies; 1342 const struct cfg80211_bss_ies __rcu *beacon_ies;
1248 const struct cfg80211_bss_ies __rcu *proberesp_ies; 1343 const struct cfg80211_bss_ies __rcu *proberesp_ies;
1249 1344
1250 void (*free_priv)(struct cfg80211_bss *bss); 1345 struct cfg80211_bss *hidden_beacon_bss;
1251 1346
1252 s32 signal; 1347 s32 signal;
1253 1348
@@ -1256,7 +1351,7 @@ struct cfg80211_bss {
1256 1351
1257 u8 bssid[ETH_ALEN]; 1352 u8 bssid[ETH_ALEN];
1258 1353
1259 u8 priv[0] __attribute__((__aligned__(sizeof(void *)))); 1354 u8 priv[0] __aligned(sizeof(void *));
1260}; 1355};
1261 1356
1262/** 1357/**
@@ -1266,7 +1361,7 @@ struct cfg80211_bss {
1266 * 1361 *
1267 * Note that the return value is an RCU-protected pointer, so 1362 * Note that the return value is an RCU-protected pointer, so
1268 * rcu_read_lock() must be held when calling this function. 1363 * rcu_read_lock() must be held when calling this function.
1269 * Returns %NULL if not found. 1364 * Return: %NULL if not found.
1270 */ 1365 */
1271const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 ie); 1366const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 ie);
1272 1367
@@ -1349,6 +1444,8 @@ struct cfg80211_assoc_request {
1349 * @ie: Extra IEs to add to Deauthentication frame or %NULL 1444 * @ie: Extra IEs to add to Deauthentication frame or %NULL
1350 * @ie_len: Length of ie buffer in octets 1445 * @ie_len: Length of ie buffer in octets
1351 * @reason_code: The reason code for the deauthentication 1446 * @reason_code: The reason code for the deauthentication
1447 * @local_state_change: if set, change local state only and
1448 * do not set a deauth frame
1352 */ 1449 */
1353struct cfg80211_deauth_request { 1450struct cfg80211_deauth_request {
1354 const u8 *bssid; 1451 const u8 *bssid;
@@ -1434,6 +1531,7 @@ struct cfg80211_ibss_params {
1434 * @ie: IEs for association request 1531 * @ie: IEs for association request
1435 * @ie_len: Length of assoc_ie in octets 1532 * @ie_len: Length of assoc_ie in octets
1436 * @privacy: indicates whether privacy-enabled APs should be used 1533 * @privacy: indicates whether privacy-enabled APs should be used
1534 * @mfp: indicate whether management frame protection is used
1437 * @crypto: crypto settings 1535 * @crypto: crypto settings
1438 * @key_len: length of WEP key for shared key authentication 1536 * @key_len: length of WEP key for shared key authentication
1439 * @key_idx: index of WEP key for shared key authentication 1537 * @key_idx: index of WEP key for shared key authentication
@@ -1454,6 +1552,7 @@ struct cfg80211_connect_params {
1454 u8 *ie; 1552 u8 *ie;
1455 size_t ie_len; 1553 size_t ie_len;
1456 bool privacy; 1554 bool privacy;
1555 enum nl80211_mfp mfp;
1457 struct cfg80211_crypto_settings crypto; 1556 struct cfg80211_crypto_settings crypto;
1458 const u8 *key; 1557 const u8 *key;
1459 u8 key_len, key_idx; 1558 u8 key_len, key_idx;
@@ -1508,6 +1607,7 @@ struct cfg80211_pmksa {
1508 * one bit per byte, in same format as nl80211 1607 * one bit per byte, in same format as nl80211
1509 * @pattern: bytes to match where bitmask is 1 1608 * @pattern: bytes to match where bitmask is 1
1510 * @pattern_len: length of pattern (in bytes) 1609 * @pattern_len: length of pattern (in bytes)
1610 * @pkt_offset: packet offset (in bytes)
1511 * 1611 *
1512 * Internal note: @mask and @pattern are allocated in one chunk of 1612 * Internal note: @mask and @pattern are allocated in one chunk of
1513 * memory, free @mask only! 1613 * memory, free @mask only!
@@ -1515,6 +1615,42 @@ struct cfg80211_pmksa {
1515struct cfg80211_wowlan_trig_pkt_pattern { 1615struct cfg80211_wowlan_trig_pkt_pattern {
1516 u8 *mask, *pattern; 1616 u8 *mask, *pattern;
1517 int pattern_len; 1617 int pattern_len;
1618 int pkt_offset;
1619};
1620
1621/**
1622 * struct cfg80211_wowlan_tcp - TCP connection parameters
1623 *
1624 * @sock: (internal) socket for source port allocation
1625 * @src: source IP address
1626 * @dst: destination IP address
1627 * @dst_mac: destination MAC address
1628 * @src_port: source port
1629 * @dst_port: destination port
1630 * @payload_len: data payload length
1631 * @payload: data payload buffer
1632 * @payload_seq: payload sequence stamping configuration
1633 * @data_interval: interval at which to send data packets
1634 * @wake_len: wakeup payload match length
1635 * @wake_data: wakeup payload match data
1636 * @wake_mask: wakeup payload match mask
1637 * @tokens_size: length of the tokens buffer
1638 * @payload_tok: payload token usage configuration
1639 */
1640struct cfg80211_wowlan_tcp {
1641 struct socket *sock;
1642 __be32 src, dst;
1643 u16 src_port, dst_port;
1644 u8 dst_mac[ETH_ALEN];
1645 int payload_len;
1646 const u8 *payload;
1647 struct nl80211_wowlan_tcp_data_seq payload_seq;
1648 u32 data_interval;
1649 u32 wake_len;
1650 const u8 *wake_data, *wake_mask;
1651 u32 tokens_size;
1652 /* must be last, variable member */
1653 struct nl80211_wowlan_tcp_data_token payload_tok;
1518}; 1654};
1519 1655
1520/** 1656/**
@@ -1531,16 +1667,49 @@ struct cfg80211_wowlan_trig_pkt_pattern {
1531 * @eap_identity_req: wake up on EAP identity request packet 1667 * @eap_identity_req: wake up on EAP identity request packet
1532 * @four_way_handshake: wake up on 4-way handshake 1668 * @four_way_handshake: wake up on 4-way handshake
1533 * @rfkill_release: wake up when rfkill is released 1669 * @rfkill_release: wake up when rfkill is released
1670 * @tcp: TCP connection establishment/wakeup parameters, see nl80211.h.
1671 * NULL if not configured.
1534 */ 1672 */
1535struct cfg80211_wowlan { 1673struct cfg80211_wowlan {
1536 bool any, disconnect, magic_pkt, gtk_rekey_failure, 1674 bool any, disconnect, magic_pkt, gtk_rekey_failure,
1537 eap_identity_req, four_way_handshake, 1675 eap_identity_req, four_way_handshake,
1538 rfkill_release; 1676 rfkill_release;
1539 struct cfg80211_wowlan_trig_pkt_pattern *patterns; 1677 struct cfg80211_wowlan_trig_pkt_pattern *patterns;
1678 struct cfg80211_wowlan_tcp *tcp;
1540 int n_patterns; 1679 int n_patterns;
1541}; 1680};
1542 1681
1543/** 1682/**
1683 * struct cfg80211_wowlan_wakeup - wakeup report
1684 * @disconnect: woke up by getting disconnected
1685 * @magic_pkt: woke up by receiving magic packet
1686 * @gtk_rekey_failure: woke up by GTK rekey failure
1687 * @eap_identity_req: woke up by EAP identity request packet
1688 * @four_way_handshake: woke up by 4-way handshake
1689 * @rfkill_release: woke up by rfkill being released
1690 * @pattern_idx: pattern that caused wakeup, -1 if not due to pattern
1691 * @packet_present_len: copied wakeup packet data
1692 * @packet_len: original wakeup packet length
1693 * @packet: The packet causing the wakeup, if any.
1694 * @packet_80211: For pattern match, magic packet and other data
1695 * frame triggers an 802.3 frame should be reported, for
1696 * disconnect due to deauth 802.11 frame. This indicates which
1697 * it is.
1698 * @tcp_match: TCP wakeup packet received
1699 * @tcp_connlost: TCP connection lost or failed to establish
1700 * @tcp_nomoretokens: TCP data ran out of tokens
1701 */
1702struct cfg80211_wowlan_wakeup {
1703 bool disconnect, magic_pkt, gtk_rekey_failure,
1704 eap_identity_req, four_way_handshake,
1705 rfkill_release, packet_80211,
1706 tcp_match, tcp_connlost, tcp_nomoretokens;
1707 s32 pattern_idx;
1708 u32 packet_present_len, packet_len;
1709 const void *packet;
1710};
1711
1712/**
1544 * struct cfg80211_gtk_rekey_data - rekey data 1713 * struct cfg80211_gtk_rekey_data - rekey data
1545 * @kek: key encryption key 1714 * @kek: key encryption key
1546 * @kck: key confirmation key 1715 * @kck: key confirmation key
@@ -1763,6 +1932,15 @@ struct cfg80211_gtk_rekey_data {
1763 * 1932 *
1764 * @start_p2p_device: Start the given P2P device. 1933 * @start_p2p_device: Start the given P2P device.
1765 * @stop_p2p_device: Stop the given P2P device. 1934 * @stop_p2p_device: Stop the given P2P device.
1935 *
1936 * @set_mac_acl: Sets MAC address control list in AP and P2P GO mode.
1937 * Parameters include ACL policy, an array of MAC address of stations
1938 * and the number of MAC addresses. If there is already a list in driver
1939 * this new list replaces the existing one. Driver has to clear its ACL
1940 * when number of MAC addresses entries is passed as 0. Drivers which
1941 * advertise the support for MAC based ACL have to implement this callback.
1942 *
1943 * @start_radar_detection: Start radar detection in the driver.
1766 */ 1944 */
1767struct cfg80211_ops { 1945struct cfg80211_ops {
1768 int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow); 1946 int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
@@ -1983,6 +2161,13 @@ struct cfg80211_ops {
1983 struct wireless_dev *wdev); 2161 struct wireless_dev *wdev);
1984 void (*stop_p2p_device)(struct wiphy *wiphy, 2162 void (*stop_p2p_device)(struct wiphy *wiphy,
1985 struct wireless_dev *wdev); 2163 struct wireless_dev *wdev);
2164
2165 int (*set_mac_acl)(struct wiphy *wiphy, struct net_device *dev,
2166 const struct cfg80211_acl_data *params);
2167
2168 int (*start_radar_detection)(struct wiphy *wiphy,
2169 struct net_device *dev,
2170 struct cfg80211_chan_def *chandef);
1986}; 2171};
1987 2172
1988/* 2173/*
@@ -2092,6 +2277,7 @@ struct ieee80211_iface_limit {
2092 * @beacon_int_infra_match: In this combination, the beacon intervals 2277 * @beacon_int_infra_match: In this combination, the beacon intervals
2093 * between infrastructure and AP types must match. This is required 2278 * between infrastructure and AP types must match. This is required
2094 * only in special cases. 2279 * only in special cases.
2280 * @radar_detect_widths: bitmap of channel widths supported for radar detection
2095 * 2281 *
2096 * These examples can be expressed as follows: 2282 * These examples can be expressed as follows:
2097 * 2283 *
@@ -2144,10 +2330,7 @@ struct ieee80211_iface_combination {
2144 u16 max_interfaces; 2330 u16 max_interfaces;
2145 u8 n_limits; 2331 u8 n_limits;
2146 bool beacon_int_infra_match; 2332 bool beacon_int_infra_match;
2147}; 2333 u8 radar_detect_widths;
2148
2149struct mac_address {
2150 u8 addr[ETH_ALEN];
2151}; 2334};
2152 2335
2153struct ieee80211_txrx_stypes { 2336struct ieee80211_txrx_stypes {
@@ -2181,6 +2364,14 @@ enum wiphy_wowlan_support_flags {
2181 WIPHY_WOWLAN_RFKILL_RELEASE = BIT(7), 2364 WIPHY_WOWLAN_RFKILL_RELEASE = BIT(7),
2182}; 2365};
2183 2366
2367struct wiphy_wowlan_tcp_support {
2368 const struct nl80211_wowlan_tcp_data_token_feature *tok;
2369 u32 data_payload_max;
2370 u32 data_interval_max;
2371 u32 wake_payload_max;
2372 bool seq;
2373};
2374
2184/** 2375/**
2185 * struct wiphy_wowlan_support - WoWLAN support data 2376 * struct wiphy_wowlan_support - WoWLAN support data
2186 * @flags: see &enum wiphy_wowlan_support_flags 2377 * @flags: see &enum wiphy_wowlan_support_flags
@@ -2188,12 +2379,16 @@ enum wiphy_wowlan_support_flags {
2188 * (see nl80211.h for the pattern definition) 2379 * (see nl80211.h for the pattern definition)
2189 * @pattern_max_len: maximum length of each pattern 2380 * @pattern_max_len: maximum length of each pattern
2190 * @pattern_min_len: minimum length of each pattern 2381 * @pattern_min_len: minimum length of each pattern
2382 * @max_pkt_offset: maximum Rx packet offset
2383 * @tcp: TCP wakeup support information
2191 */ 2384 */
2192struct wiphy_wowlan_support { 2385struct wiphy_wowlan_support {
2193 u32 flags; 2386 u32 flags;
2194 int n_patterns; 2387 int n_patterns;
2195 int pattern_max_len; 2388 int pattern_max_len;
2196 int pattern_min_len; 2389 int pattern_min_len;
2390 int max_pkt_offset;
2391 const struct wiphy_wowlan_tcp_support *tcp;
2197}; 2392};
2198 2393
2199/** 2394/**
@@ -2290,6 +2485,17 @@ struct wiphy_wowlan_support {
2290 * @ap_sme_capa: AP SME capabilities, flags from &enum nl80211_ap_sme_features. 2485 * @ap_sme_capa: AP SME capabilities, flags from &enum nl80211_ap_sme_features.
2291 * @ht_capa_mod_mask: Specify what ht_cap values can be over-ridden. 2486 * @ht_capa_mod_mask: Specify what ht_cap values can be over-ridden.
2292 * If null, then none can be over-ridden. 2487 * If null, then none can be over-ridden.
2488 *
2489 * @max_acl_mac_addrs: Maximum number of MAC addresses that the device
2490 * supports for ACL.
2491 *
2492 * @extended_capabilities: extended capabilities supported by the driver,
2493 * additional capabilities might be supported by userspace; these are
2494 * the 802.11 extended capabilities ("Extended Capabilities element")
2495 * and are in the same format as in the information element. See
2496 * 802.11-2012 8.4.2.29 for the defined fields.
2497 * @extended_capabilities_mask: mask of the valid values
2498 * @extended_capabilities_len: length of the extended capabilities
2293 */ 2499 */
2294struct wiphy { 2500struct wiphy {
2295 /* assign these fields before you register the wiphy */ 2501 /* assign these fields before you register the wiphy */
@@ -2311,6 +2517,8 @@ struct wiphy {
2311 /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */ 2517 /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */
2312 u16 interface_modes; 2518 u16 interface_modes;
2313 2519
2520 u16 max_acl_mac_addrs;
2521
2314 u32 flags, features; 2522 u32 flags, features;
2315 2523
2316 u32 ap_sme_capa; 2524 u32 ap_sme_capa;
@@ -2333,7 +2541,7 @@ struct wiphy {
2333 u32 rts_threshold; 2541 u32 rts_threshold;
2334 u8 coverage_class; 2542 u8 coverage_class;
2335 2543
2336 char fw_version[ETHTOOL_BUSINFO_LEN]; 2544 char fw_version[ETHTOOL_FWVERS_LEN];
2337 u32 hw_version; 2545 u32 hw_version;
2338 2546
2339#ifdef CONFIG_PM 2547#ifdef CONFIG_PM
@@ -2354,6 +2562,9 @@ struct wiphy {
2354 */ 2562 */
2355 u32 probe_resp_offload; 2563 u32 probe_resp_offload;
2356 2564
2565 const u8 *extended_capabilities, *extended_capabilities_mask;
2566 u8 extended_capabilities_len;
2567
2357 /* If multiple wiphys are registered and you're handed e.g. 2568 /* If multiple wiphys are registered and you're handed e.g.
2358 * a regular netdev with assigned ieee80211_ptr, you won't 2569 * a regular netdev with assigned ieee80211_ptr, you won't
2359 * know whether it points to a wiphy your driver has registered 2570 * know whether it points to a wiphy your driver has registered
@@ -2364,12 +2575,12 @@ struct wiphy {
2364 struct ieee80211_supported_band *bands[IEEE80211_NUM_BANDS]; 2575 struct ieee80211_supported_band *bands[IEEE80211_NUM_BANDS];
2365 2576
2366 /* Lets us get back the wiphy on the callback */ 2577 /* Lets us get back the wiphy on the callback */
2367 int (*reg_notifier)(struct wiphy *wiphy, 2578 void (*reg_notifier)(struct wiphy *wiphy,
2368 struct regulatory_request *request); 2579 struct regulatory_request *request);
2369 2580
2370 /* fields below are read-only, assigned by cfg80211 */ 2581 /* fields below are read-only, assigned by cfg80211 */
2371 2582
2372 const struct ieee80211_regdomain *regd; 2583 const struct ieee80211_regdomain __rcu *regd;
2373 2584
2374 /* the item in /sys/class/ieee80211/ points to this, 2585 /* the item in /sys/class/ieee80211/ points to this,
2375 * you need use set_wiphy_dev() (see below) */ 2586 * you need use set_wiphy_dev() (see below) */
@@ -2392,7 +2603,7 @@ struct wiphy {
2392 const struct iw_handler_def *wext; 2603 const struct iw_handler_def *wext;
2393#endif 2604#endif
2394 2605
2395 char priv[0] __attribute__((__aligned__(NETDEV_ALIGN))); 2606 char priv[0] __aligned(NETDEV_ALIGN);
2396}; 2607};
2397 2608
2398static inline struct net *wiphy_net(struct wiphy *wiphy) 2609static inline struct net *wiphy_net(struct wiphy *wiphy)
@@ -2409,6 +2620,7 @@ static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net)
2409 * wiphy_priv - return priv from wiphy 2620 * wiphy_priv - return priv from wiphy
2410 * 2621 *
2411 * @wiphy: the wiphy whose priv pointer to return 2622 * @wiphy: the wiphy whose priv pointer to return
2623 * Return: The priv of @wiphy.
2412 */ 2624 */
2413static inline void *wiphy_priv(struct wiphy *wiphy) 2625static inline void *wiphy_priv(struct wiphy *wiphy)
2414{ 2626{
@@ -2420,6 +2632,7 @@ static inline void *wiphy_priv(struct wiphy *wiphy)
2420 * priv_to_wiphy - return the wiphy containing the priv 2632 * priv_to_wiphy - return the wiphy containing the priv
2421 * 2633 *
2422 * @priv: a pointer previously returned by wiphy_priv 2634 * @priv: a pointer previously returned by wiphy_priv
2635 * Return: The wiphy of @priv.
2423 */ 2636 */
2424static inline struct wiphy *priv_to_wiphy(void *priv) 2637static inline struct wiphy *priv_to_wiphy(void *priv)
2425{ 2638{
@@ -2442,6 +2655,7 @@ static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev)
2442 * wiphy_dev - get wiphy dev pointer 2655 * wiphy_dev - get wiphy dev pointer
2443 * 2656 *
2444 * @wiphy: The wiphy whose device struct to look up 2657 * @wiphy: The wiphy whose device struct to look up
2658 * Return: The dev of @wiphy.
2445 */ 2659 */
2446static inline struct device *wiphy_dev(struct wiphy *wiphy) 2660static inline struct device *wiphy_dev(struct wiphy *wiphy)
2447{ 2661{
@@ -2452,6 +2666,7 @@ static inline struct device *wiphy_dev(struct wiphy *wiphy)
2452 * wiphy_name - get wiphy name 2666 * wiphy_name - get wiphy name
2453 * 2667 *
2454 * @wiphy: The wiphy whose name to return 2668 * @wiphy: The wiphy whose name to return
2669 * Return: The name of @wiphy.
2455 */ 2670 */
2456static inline const char *wiphy_name(const struct wiphy *wiphy) 2671static inline const char *wiphy_name(const struct wiphy *wiphy)
2457{ 2672{
@@ -2467,8 +2682,8 @@ static inline const char *wiphy_name(const struct wiphy *wiphy)
2467 * Create a new wiphy and associate the given operations with it. 2682 * Create a new wiphy and associate the given operations with it.
2468 * @sizeof_priv bytes are allocated for private use. 2683 * @sizeof_priv bytes are allocated for private use.
2469 * 2684 *
2470 * The returned pointer must be assigned to each netdev's 2685 * Return: A pointer to the new wiphy. This pointer must be
2471 * ieee80211_ptr for proper operation. 2686 * assigned to each netdev's ieee80211_ptr for proper operation.
2472 */ 2687 */
2473struct wiphy *wiphy_new(const struct cfg80211_ops *ops, int sizeof_priv); 2688struct wiphy *wiphy_new(const struct cfg80211_ops *ops, int sizeof_priv);
2474 2689
@@ -2477,7 +2692,7 @@ struct wiphy *wiphy_new(const struct cfg80211_ops *ops, int sizeof_priv);
2477 * 2692 *
2478 * @wiphy: The wiphy to register. 2693 * @wiphy: The wiphy to register.
2479 * 2694 *
2480 * Returns a non-negative wiphy index or a negative error code. 2695 * Return: A non-negative wiphy index or a negative error code.
2481 */ 2696 */
2482extern int wiphy_register(struct wiphy *wiphy); 2697extern int wiphy_register(struct wiphy *wiphy);
2483 2698
@@ -2529,7 +2744,6 @@ struct cfg80211_cached_keys;
2529 * the user-set AP, monitor and WDS channel 2744 * the user-set AP, monitor and WDS channel
2530 * @preset_chan: (private) Used by the internal configuration code to 2745 * @preset_chan: (private) Used by the internal configuration code to
2531 * track the channel to be used for AP later 2746 * track the channel to be used for AP later
2532 * @preset_chantype: (private) the corresponding channel type
2533 * @bssid: (private) Used by the internal configuration code 2747 * @bssid: (private) Used by the internal configuration code
2534 * @ssid: (private) Used by the internal configuration code 2748 * @ssid: (private) Used by the internal configuration code
2535 * @ssid_len: (private) Used by the internal configuration code 2749 * @ssid_len: (private) Used by the internal configuration code
@@ -2548,6 +2762,8 @@ struct cfg80211_cached_keys;
2548 * beacons, 0 when not valid 2762 * beacons, 0 when not valid
2549 * @address: The address for this device, valid only if @netdev is %NULL 2763 * @address: The address for this device, valid only if @netdev is %NULL
2550 * @p2p_started: true if this is a P2P Device that has been started 2764 * @p2p_started: true if this is a P2P Device that has been started
2765 * @cac_started: true if DFS channel availability check has been started
2766 * @cac_start_time: timestamp (jiffies) when the dfs state was entered.
2551 */ 2767 */
2552struct wireless_dev { 2768struct wireless_dev {
2553 struct wiphy *wiphy; 2769 struct wiphy *wiphy;
@@ -2599,6 +2815,9 @@ struct wireless_dev {
2599 2815
2600 u32 ap_unexpected_nlportid; 2816 u32 ap_unexpected_nlportid;
2601 2817
2818 bool cac_started;
2819 unsigned long cac_start_time;
2820
2602#ifdef CONFIG_CFG80211_WEXT 2821#ifdef CONFIG_CFG80211_WEXT
2603 /* wext data */ 2822 /* wext data */
2604 struct { 2823 struct {
@@ -2626,6 +2845,7 @@ static inline u8 *wdev_address(struct wireless_dev *wdev)
2626 * wdev_priv - return wiphy priv from wireless_dev 2845 * wdev_priv - return wiphy priv from wireless_dev
2627 * 2846 *
2628 * @wdev: The wireless device whose wiphy's priv pointer to return 2847 * @wdev: The wireless device whose wiphy's priv pointer to return
2848 * Return: The wiphy priv of @wdev.
2629 */ 2849 */
2630static inline void *wdev_priv(struct wireless_dev *wdev) 2850static inline void *wdev_priv(struct wireless_dev *wdev)
2631{ 2851{
@@ -2643,12 +2863,14 @@ static inline void *wdev_priv(struct wireless_dev *wdev)
2643 * ieee80211_channel_to_frequency - convert channel number to frequency 2863 * ieee80211_channel_to_frequency - convert channel number to frequency
2644 * @chan: channel number 2864 * @chan: channel number
2645 * @band: band, necessary due to channel number overlap 2865 * @band: band, necessary due to channel number overlap
2866 * Return: The corresponding frequency (in MHz), or 0 if the conversion failed.
2646 */ 2867 */
2647extern int ieee80211_channel_to_frequency(int chan, enum ieee80211_band band); 2868extern int ieee80211_channel_to_frequency(int chan, enum ieee80211_band band);
2648 2869
2649/** 2870/**
2650 * ieee80211_frequency_to_channel - convert frequency to channel number 2871 * ieee80211_frequency_to_channel - convert frequency to channel number
2651 * @freq: center frequency 2872 * @freq: center frequency
2873 * Return: The corresponding channel, or 0 if the conversion failed.
2652 */ 2874 */
2653extern int ieee80211_frequency_to_channel(int freq); 2875extern int ieee80211_frequency_to_channel(int freq);
2654 2876
@@ -2665,6 +2887,7 @@ extern struct ieee80211_channel *__ieee80211_get_channel(struct wiphy *wiphy,
2665 * ieee80211_get_channel - get channel struct from wiphy for specified frequency 2887 * ieee80211_get_channel - get channel struct from wiphy for specified frequency
2666 * @wiphy: the struct wiphy to get the channel for 2888 * @wiphy: the struct wiphy to get the channel for
2667 * @freq: the center frequency of the channel 2889 * @freq: the center frequency of the channel
2890 * Return: The channel struct from @wiphy at @freq.
2668 */ 2891 */
2669static inline struct ieee80211_channel * 2892static inline struct ieee80211_channel *
2670ieee80211_get_channel(struct wiphy *wiphy, int freq) 2893ieee80211_get_channel(struct wiphy *wiphy, int freq)
@@ -2679,10 +2902,10 @@ ieee80211_get_channel(struct wiphy *wiphy, int freq)
2679 * @basic_rates: bitmap of basic rates 2902 * @basic_rates: bitmap of basic rates
2680 * @bitrate: the bitrate for which to find the basic rate 2903 * @bitrate: the bitrate for which to find the basic rate
2681 * 2904 *
2682 * This function returns the basic rate corresponding to a given 2905 * Return: The basic rate corresponding to a given bitrate, that
2683 * bitrate, that is the next lower bitrate contained in the basic 2906 * is the next lower bitrate contained in the basic rate map,
2684 * rate map, which is, for this function, given as a bitmap of 2907 * which is, for this function, given as a bitmap of indices of
2685 * indices of rates in the band's bitrate table. 2908 * rates in the band's bitrate table.
2686 */ 2909 */
2687struct ieee80211_rate * 2910struct ieee80211_rate *
2688ieee80211_get_response_rate(struct ieee80211_supported_band *sband, 2911ieee80211_get_response_rate(struct ieee80211_supported_band *sband,
@@ -2775,18 +2998,21 @@ extern const unsigned char bridge_tunnel_header[6];
2775/** 2998/**
2776 * ieee80211_get_hdrlen_from_skb - get header length from data 2999 * ieee80211_get_hdrlen_from_skb - get header length from data
2777 * 3000 *
3001 * @skb: the frame
3002 *
2778 * Given an skb with a raw 802.11 header at the data pointer this function 3003 * Given an skb with a raw 802.11 header at the data pointer this function
2779 * returns the 802.11 header length in bytes (not including encryption 3004 * returns the 802.11 header length.
2780 * headers). If the data in the sk_buff is too short to contain a valid 802.11
2781 * header the function returns 0.
2782 * 3005 *
2783 * @skb: the frame 3006 * Return: The 802.11 header length in bytes (not including encryption
3007 * headers). Or 0 if the data in the sk_buff is too short to contain a valid
3008 * 802.11 header.
2784 */ 3009 */
2785unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb); 3010unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb);
2786 3011
2787/** 3012/**
2788 * ieee80211_hdrlen - get header length in bytes from frame control 3013 * ieee80211_hdrlen - get header length in bytes from frame control
2789 * @fc: frame control field in little-endian format 3014 * @fc: frame control field in little-endian format
3015 * Return: The header length in bytes.
2790 */ 3016 */
2791unsigned int __attribute_const__ ieee80211_hdrlen(__le16 fc); 3017unsigned int __attribute_const__ ieee80211_hdrlen(__le16 fc);
2792 3018
@@ -2794,7 +3020,7 @@ unsigned int __attribute_const__ ieee80211_hdrlen(__le16 fc);
2794 * ieee80211_get_mesh_hdrlen - get mesh extension header length 3020 * ieee80211_get_mesh_hdrlen - get mesh extension header length
2795 * @meshhdr: the mesh extension header, only the flags field 3021 * @meshhdr: the mesh extension header, only the flags field
2796 * (first byte) will be accessed 3022 * (first byte) will be accessed
2797 * Returns the length of the extension header, which is always at 3023 * Return: The length of the extension header, which is always at
2798 * least 6 bytes and at most 18 if address 5 and 6 are present. 3024 * least 6 bytes and at most 18 if address 5 and 6 are present.
2799 */ 3025 */
2800unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr); 3026unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr);
@@ -2812,6 +3038,7 @@ unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr);
2812 * @skb: the 802.11 data frame 3038 * @skb: the 802.11 data frame
2813 * @addr: the device MAC address 3039 * @addr: the device MAC address
2814 * @iftype: the virtual interface type 3040 * @iftype: the virtual interface type
3041 * Return: 0 on success. Non-zero on error.
2815 */ 3042 */
2816int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr, 3043int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr,
2817 enum nl80211_iftype iftype); 3044 enum nl80211_iftype iftype);
@@ -2823,6 +3050,7 @@ int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr,
2823 * @iftype: the virtual interface type 3050 * @iftype: the virtual interface type
2824 * @bssid: the network bssid (used only for iftype STATION and ADHOC) 3051 * @bssid: the network bssid (used only for iftype STATION and ADHOC)
2825 * @qos: build 802.11 QoS data frame 3052 * @qos: build 802.11 QoS data frame
3053 * Return: 0 on success, or a negative error code.
2826 */ 3054 */
2827int ieee80211_data_from_8023(struct sk_buff *skb, const u8 *addr, 3055int ieee80211_data_from_8023(struct sk_buff *skb, const u8 *addr,
2828 enum nl80211_iftype iftype, u8 *bssid, bool qos); 3056 enum nl80211_iftype iftype, u8 *bssid, bool qos);
@@ -2850,6 +3078,7 @@ void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list,
2850/** 3078/**
2851 * cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame 3079 * cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame
2852 * @skb: the data frame 3080 * @skb: the data frame
3081 * Return: The 802.1p/1d tag.
2853 */ 3082 */
2854unsigned int cfg80211_classify8021d(struct sk_buff *skb); 3083unsigned int cfg80211_classify8021d(struct sk_buff *skb);
2855 3084
@@ -2860,12 +3089,13 @@ unsigned int cfg80211_classify8021d(struct sk_buff *skb);
2860 * @ies: data consisting of IEs 3089 * @ies: data consisting of IEs
2861 * @len: length of data 3090 * @len: length of data
2862 * 3091 *
2863 * This function will return %NULL if the element ID could 3092 * Return: %NULL if the element ID could not be found or if
2864 * not be found or if the element is invalid (claims to be 3093 * the element is invalid (claims to be longer than the given
2865 * longer than the given data), or a pointer to the first byte 3094 * data), or a pointer to the first byte of the requested
2866 * of the requested element, that is the byte containing the 3095 * element, that is the byte containing the element ID.
2867 * element ID. There are no checks on the element length 3096 *
2868 * other than having to fit into the given data. 3097 * Note: There are no checks on the element length other than
3098 * having to fit into the given data.
2869 */ 3099 */
2870const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len); 3100const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len);
2871 3101
@@ -2877,12 +3107,13 @@ const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len);
2877 * @ies: data consisting of IEs 3107 * @ies: data consisting of IEs
2878 * @len: length of data 3108 * @len: length of data
2879 * 3109 *
2880 * This function will return %NULL if the vendor specific element ID 3110 * Return: %NULL if the vendor specific element ID could not be found or if the
2881 * could not be found or if the element is invalid (claims to be 3111 * element is invalid (claims to be longer than the given data), or a pointer to
2882 * longer than the given data), or a pointer to the first byte 3112 * the first byte of the requested element, that is the byte containing the
2883 * of the requested element, that is the byte containing the 3113 * element ID.
2884 * element ID. There are no checks on the element length 3114 *
2885 * other than having to fit into the given data. 3115 * Note: There are no checks on the element length other than having to fit into
3116 * the given data.
2886 */ 3117 */
2887const u8 *cfg80211_find_vendor_ie(unsigned int oui, u8 oui_type, 3118const u8 *cfg80211_find_vendor_ie(unsigned int oui, u8 oui_type,
2888 const u8 *ies, int len); 3119 const u8 *ies, int len);
@@ -2915,6 +3146,8 @@ const u8 *cfg80211_find_vendor_ie(unsigned int oui, u8 oui_type,
2915 * 3146 *
2916 * Drivers should check the return value, its possible you can get 3147 * Drivers should check the return value, its possible you can get
2917 * an -ENOMEM. 3148 * an -ENOMEM.
3149 *
3150 * Return: 0 on success. -ENOMEM.
2918 */ 3151 */
2919extern int regulatory_hint(struct wiphy *wiphy, const char *alpha2); 3152extern int regulatory_hint(struct wiphy *wiphy, const char *alpha2);
2920 3153
@@ -2938,28 +3171,22 @@ extern void wiphy_apply_custom_regulatory(
2938 * freq_reg_info - get regulatory information for the given frequency 3171 * freq_reg_info - get regulatory information for the given frequency
2939 * @wiphy: the wiphy for which we want to process this rule for 3172 * @wiphy: the wiphy for which we want to process this rule for
2940 * @center_freq: Frequency in KHz for which we want regulatory information for 3173 * @center_freq: Frequency in KHz for which we want regulatory information for
2941 * @desired_bw_khz: the desired max bandwidth you want to use per
2942 * channel. Note that this is still 20 MHz if you want to use HT40
2943 * as HT40 makes use of two channels for its 40 MHz width bandwidth.
2944 * If set to 0 we'll assume you want the standard 20 MHz.
2945 * @reg_rule: the regulatory rule which we have for this frequency
2946 * 3174 *
2947 * Use this function to get the regulatory rule for a specific frequency on 3175 * Use this function to get the regulatory rule for a specific frequency on
2948 * a given wireless device. If the device has a specific regulatory domain 3176 * a given wireless device. If the device has a specific regulatory domain
2949 * it wants to follow we respect that unless a country IE has been received 3177 * it wants to follow we respect that unless a country IE has been received
2950 * and processed already. 3178 * and processed already.
2951 * 3179 *
2952 * Returns 0 if it was able to find a valid regulatory rule which does 3180 * Return: A valid pointer, or, when an error occurs, for example if no rule
2953 * apply to the given center_freq otherwise it returns non-zero. It will 3181 * can be found, the return value is encoded using ERR_PTR(). Use IS_ERR() to
2954 * also return -ERANGE if we determine the given center_freq does not even have 3182 * check and PTR_ERR() to obtain the numeric return value. The numeric return
2955 * a regulatory rule for a frequency range in the center_freq's band. See 3183 * value will be -ERANGE if we determine the given center_freq does not even
2956 * freq_in_rule_band() for our current definition of a band -- this is purely 3184 * have a regulatory rule for a frequency range in the center_freq's band.
2957 * subjective and right now its 802.11 specific. 3185 * See freq_in_rule_band() for our current definition of a band -- this is
3186 * purely subjective and right now it's 802.11 specific.
2958 */ 3187 */
2959extern int freq_reg_info(struct wiphy *wiphy, 3188const struct ieee80211_reg_rule *freq_reg_info(struct wiphy *wiphy,
2960 u32 center_freq, 3189 u32 center_freq);
2961 u32 desired_bw_khz,
2962 const struct ieee80211_reg_rule **reg_rule);
2963 3190
2964/* 3191/*
2965 * callbacks for asynchronous cfg80211 methods, notification 3192 * callbacks for asynchronous cfg80211 methods, notification
@@ -3006,7 +3233,8 @@ void cfg80211_sched_scan_stopped(struct wiphy *wiphy);
3006 * This informs cfg80211 that BSS information was found and 3233 * This informs cfg80211 that BSS information was found and
3007 * the BSS should be updated/added. 3234 * the BSS should be updated/added.
3008 * 3235 *
3009 * NOTE: Returns a referenced struct, must be released with cfg80211_put_bss()! 3236 * Return: A referenced struct, must be released with cfg80211_put_bss()!
3237 * Or %NULL on error.
3010 */ 3238 */
3011struct cfg80211_bss * __must_check 3239struct cfg80211_bss * __must_check
3012cfg80211_inform_bss_frame(struct wiphy *wiphy, 3240cfg80211_inform_bss_frame(struct wiphy *wiphy,
@@ -3031,7 +3259,8 @@ cfg80211_inform_bss_frame(struct wiphy *wiphy,
3031 * This informs cfg80211 that BSS information was found and 3259 * This informs cfg80211 that BSS information was found and
3032 * the BSS should be updated/added. 3260 * the BSS should be updated/added.
3033 * 3261 *
3034 * NOTE: Returns a referenced struct, must be released with cfg80211_put_bss()! 3262 * Return: A referenced struct, must be released with cfg80211_put_bss()!
3263 * Or %NULL on error.
3035 */ 3264 */
3036struct cfg80211_bss * __must_check 3265struct cfg80211_bss * __must_check
3037cfg80211_inform_bss(struct wiphy *wiphy, 3266cfg80211_inform_bss(struct wiphy *wiphy,
@@ -3054,25 +3283,23 @@ cfg80211_get_ibss(struct wiphy *wiphy,
3054 WLAN_CAPABILITY_IBSS, WLAN_CAPABILITY_IBSS); 3283 WLAN_CAPABILITY_IBSS, WLAN_CAPABILITY_IBSS);
3055} 3284}
3056 3285
3057struct cfg80211_bss *cfg80211_get_mesh(struct wiphy *wiphy,
3058 struct ieee80211_channel *channel,
3059 const u8 *meshid, size_t meshidlen,
3060 const u8 *meshcfg);
3061/** 3286/**
3062 * cfg80211_ref_bss - reference BSS struct 3287 * cfg80211_ref_bss - reference BSS struct
3288 * @wiphy: the wiphy this BSS struct belongs to
3063 * @bss: the BSS struct to reference 3289 * @bss: the BSS struct to reference
3064 * 3290 *
3065 * Increments the refcount of the given BSS struct. 3291 * Increments the refcount of the given BSS struct.
3066 */ 3292 */
3067void cfg80211_ref_bss(struct cfg80211_bss *bss); 3293void cfg80211_ref_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
3068 3294
3069/** 3295/**
3070 * cfg80211_put_bss - unref BSS struct 3296 * cfg80211_put_bss - unref BSS struct
3297 * @wiphy: the wiphy this BSS struct belongs to
3071 * @bss: the BSS struct 3298 * @bss: the BSS struct
3072 * 3299 *
3073 * Decrements the refcount of the given BSS struct. 3300 * Decrements the refcount of the given BSS struct.
3074 */ 3301 */
3075void cfg80211_put_bss(struct cfg80211_bss *bss); 3302void cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
3076 3303
3077/** 3304/**
3078 * cfg80211_unlink_bss - unlink BSS from internal data structures 3305 * cfg80211_unlink_bss - unlink BSS from internal data structures
@@ -3308,16 +3535,18 @@ void wiphy_rfkill_stop_polling(struct wiphy *wiphy);
3308 * the testmode command. Since it is intended for a reply, calling 3535 * the testmode command. Since it is intended for a reply, calling
3309 * it outside of the @testmode_cmd operation is invalid. 3536 * it outside of the @testmode_cmd operation is invalid.
3310 * 3537 *
3311 * The returned skb (or %NULL if any errors happen) is pre-filled 3538 * The returned skb is pre-filled with the wiphy index and set up in
3312 * with the wiphy index and set up in a way that any data that is 3539 * a way that any data that is put into the skb (with skb_put(),
3313 * put into the skb (with skb_put(), nla_put() or similar) will end 3540 * nla_put() or similar) will end up being within the
3314 * up being within the %NL80211_ATTR_TESTDATA attribute, so all that 3541 * %NL80211_ATTR_TESTDATA attribute, so all that needs to be done
3315 * needs to be done with the skb is adding data for the corresponding 3542 * with the skb is adding data for the corresponding userspace tool
3316 * userspace tool which can then read that data out of the testdata 3543 * which can then read that data out of the testdata attribute. You
3317 * attribute. You must not modify the skb in any other way. 3544 * must not modify the skb in any other way.
3318 * 3545 *
3319 * When done, call cfg80211_testmode_reply() with the skb and return 3546 * When done, call cfg80211_testmode_reply() with the skb and return
3320 * its error code as the result of the @testmode_cmd operation. 3547 * its error code as the result of the @testmode_cmd operation.
3548 *
3549 * Return: An allocated and pre-filled skb. %NULL if any errors happen.
3321 */ 3550 */
3322struct sk_buff *cfg80211_testmode_alloc_reply_skb(struct wiphy *wiphy, 3551struct sk_buff *cfg80211_testmode_alloc_reply_skb(struct wiphy *wiphy,
3323 int approxlen); 3552 int approxlen);
@@ -3327,11 +3556,12 @@ struct sk_buff *cfg80211_testmode_alloc_reply_skb(struct wiphy *wiphy,
3327 * @skb: The skb, must have been allocated with 3556 * @skb: The skb, must have been allocated with
3328 * cfg80211_testmode_alloc_reply_skb() 3557 * cfg80211_testmode_alloc_reply_skb()
3329 * 3558 *
3330 * Returns an error code or 0 on success, since calling this 3559 * Since calling this function will usually be the last thing
3331 * function will usually be the last thing before returning 3560 * before returning from the @testmode_cmd you should return
3332 * from the @testmode_cmd you should return the error code. 3561 * the error code. Note that this function consumes the skb
3333 * Note that this function consumes the skb regardless of the 3562 * regardless of the return value.
3334 * return value. 3563 *
3564 * Return: An error code or 0 on success.
3335 */ 3565 */
3336int cfg80211_testmode_reply(struct sk_buff *skb); 3566int cfg80211_testmode_reply(struct sk_buff *skb);
3337 3567
@@ -3345,14 +3575,16 @@ int cfg80211_testmode_reply(struct sk_buff *skb);
3345 * This function allocates and pre-fills an skb for an event on the 3575 * This function allocates and pre-fills an skb for an event on the
3346 * testmode multicast group. 3576 * testmode multicast group.
3347 * 3577 *
3348 * The returned skb (or %NULL if any errors happen) is set up in the 3578 * The returned skb is set up in the same way as with
3349 * same way as with cfg80211_testmode_alloc_reply_skb() but prepared 3579 * cfg80211_testmode_alloc_reply_skb() but prepared for an event. As
3350 * for an event. As there, you should simply add data to it that will 3580 * there, you should simply add data to it that will then end up in the
3351 * then end up in the %NL80211_ATTR_TESTDATA attribute. Again, you must 3581 * %NL80211_ATTR_TESTDATA attribute. Again, you must not modify the skb
3352 * not modify the skb in any other way. 3582 * in any other way.
3353 * 3583 *
3354 * When done filling the skb, call cfg80211_testmode_event() with the 3584 * When done filling the skb, call cfg80211_testmode_event() with the
3355 * skb to send the event. 3585 * skb to send the event.
3586 *
3587 * Return: An allocated and pre-filled skb. %NULL if any errors happen.
3356 */ 3588 */
3357struct sk_buff *cfg80211_testmode_alloc_event_skb(struct wiphy *wiphy, 3589struct sk_buff *cfg80211_testmode_alloc_event_skb(struct wiphy *wiphy,
3358 int approxlen, gfp_t gfp); 3590 int approxlen, gfp_t gfp);
@@ -3533,13 +3765,13 @@ void cfg80211_conn_failed(struct net_device *dev, const u8 *mac_addr,
3533 * @len: length of the frame data 3765 * @len: length of the frame data
3534 * @gfp: context flags 3766 * @gfp: context flags
3535 * 3767 *
3536 * Returns %true if a user space application has registered for this frame. 3768 * This function is called whenever an Action frame is received for a station
3769 * mode interface, but is not processed in kernel.
3770 *
3771 * Return: %true if a user space application has registered for this frame.
3537 * For action frames, that makes it responsible for rejecting unrecognized 3772 * For action frames, that makes it responsible for rejecting unrecognized
3538 * action frames; %false otherwise, in which case for action frames the 3773 * action frames; %false otherwise, in which case for action frames the
3539 * driver is responsible for rejecting the frame. 3774 * driver is responsible for rejecting the frame.
3540 *
3541 * This function is called whenever an Action frame is received for a station
3542 * mode interface, but is not processed in kernel.
3543 */ 3775 */
3544bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq, int sig_dbm, 3776bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq, int sig_dbm,
3545 const u8 *buf, size_t len, gfp_t gfp); 3777 const u8 *buf, size_t len, gfp_t gfp);
@@ -3575,6 +3807,31 @@ void cfg80211_cqm_rssi_notify(struct net_device *dev,
3575 gfp_t gfp); 3807 gfp_t gfp);
3576 3808
3577/** 3809/**
3810 * cfg80211_radar_event - radar detection event
3811 * @wiphy: the wiphy
3812 * @chandef: chandef for the current channel
3813 * @gfp: context flags
3814 *
3815 * This function is called when a radar is detected on the current chanenl.
3816 */
3817void cfg80211_radar_event(struct wiphy *wiphy,
3818 struct cfg80211_chan_def *chandef, gfp_t gfp);
3819
3820/**
3821 * cfg80211_cac_event - Channel availability check (CAC) event
3822 * @netdev: network device
3823 * @event: type of event
3824 * @gfp: context flags
3825 *
3826 * This function is called when a Channel availability check (CAC) is finished
3827 * or aborted. This must be called to notify the completion of a CAC process,
3828 * also by full-MAC drivers.
3829 */
3830void cfg80211_cac_event(struct net_device *netdev,
3831 enum nl80211_radar_event event, gfp_t gfp);
3832
3833
3834/**
3578 * cfg80211_cqm_pktloss_notify - notify userspace about packetloss to peer 3835 * cfg80211_cqm_pktloss_notify - notify userspace about packetloss to peer
3579 * @dev: network device 3836 * @dev: network device
3580 * @peer: peer's MAC address 3837 * @peer: peer's MAC address
@@ -3631,7 +3888,7 @@ void cfg80211_pmksa_candidate_notify(struct net_device *dev, int index,
3631 * This function is used in AP mode (only!) to inform userspace that 3888 * This function is used in AP mode (only!) to inform userspace that
3632 * a spurious class 3 frame was received, to be able to deauth the 3889 * a spurious class 3 frame was received, to be able to deauth the
3633 * sender. 3890 * sender.
3634 * Returns %true if the frame was passed to userspace (or this failed 3891 * Return: %true if the frame was passed to userspace (or this failed
3635 * for a reason other than not having a subscription.) 3892 * for a reason other than not having a subscription.)
3636 */ 3893 */
3637bool cfg80211_rx_spurious_frame(struct net_device *dev, 3894bool cfg80211_rx_spurious_frame(struct net_device *dev,
@@ -3647,7 +3904,7 @@ bool cfg80211_rx_spurious_frame(struct net_device *dev,
3647 * an associated station sent a 4addr frame but that wasn't expected. 3904 * an associated station sent a 4addr frame but that wasn't expected.
3648 * It is allowed and desirable to send this event only once for each 3905 * It is allowed and desirable to send this event only once for each
3649 * station to avoid event flooding. 3906 * station to avoid event flooding.
3650 * Returns %true if the frame was passed to userspace (or this failed 3907 * Return: %true if the frame was passed to userspace (or this failed
3651 * for a reason other than not having a subscription.) 3908 * for a reason other than not having a subscription.)
3652 */ 3909 */
3653bool cfg80211_rx_unexpected_4addr_frame(struct net_device *dev, 3910bool cfg80211_rx_unexpected_4addr_frame(struct net_device *dev,
@@ -3685,8 +3942,8 @@ void cfg80211_report_obss_beacon(struct wiphy *wiphy,
3685 * @wiphy: the wiphy 3942 * @wiphy: the wiphy
3686 * @chandef: the channel definition 3943 * @chandef: the channel definition
3687 * 3944 *
3688 * This function returns true if there is no secondary channel or the secondary 3945 * Return: %true if there is no secondary channel or the secondary channel(s)
3689 * channel(s) can be used for beaconing (i.e. is not a radar channel etc.) 3946 * can be used for beaconing (i.e. is not a radar channel etc.)
3690 */ 3947 */
3691bool cfg80211_reg_can_beacon(struct wiphy *wiphy, 3948bool cfg80211_reg_can_beacon(struct wiphy *wiphy,
3692 struct cfg80211_chan_def *chandef); 3949 struct cfg80211_chan_def *chandef);
@@ -3756,14 +4013,29 @@ void cfg80211_unregister_wdev(struct wireless_dev *wdev);
3756 * The function finds a given P2P attribute in the (vendor) IEs and 4013 * The function finds a given P2P attribute in the (vendor) IEs and
3757 * copies its contents to the given buffer. 4014 * copies its contents to the given buffer.
3758 * 4015 *
3759 * The return value is a negative error code (-%EILSEQ or -%ENOENT) if 4016 * Return: A negative error code (-%EILSEQ or -%ENOENT) if the data is
3760 * the data is malformed or the attribute can't be found (respectively), 4017 * malformed or the attribute can't be found (respectively), or the
3761 * or the length of the found attribute (which can be zero). 4018 * length of the found attribute (which can be zero).
3762 */ 4019 */
3763int cfg80211_get_p2p_attr(const u8 *ies, unsigned int len, 4020int cfg80211_get_p2p_attr(const u8 *ies, unsigned int len,
3764 enum ieee80211_p2p_attr_id attr, 4021 enum ieee80211_p2p_attr_id attr,
3765 u8 *buf, unsigned int bufsize); 4022 u8 *buf, unsigned int bufsize);
3766 4023
4024/**
4025 * cfg80211_report_wowlan_wakeup - report wakeup from WoWLAN
4026 * @wdev: the wireless device reporting the wakeup
4027 * @wakeup: the wakeup report
4028 * @gfp: allocation flags
4029 *
4030 * This function reports that the given device woke up. If it
4031 * caused the wakeup, report the reason(s), otherwise you may
4032 * pass %NULL as the @wakeup parameter to advertise that something
4033 * else caused the wakeup.
4034 */
4035void cfg80211_report_wowlan_wakeup(struct wireless_dev *wdev,
4036 struct cfg80211_wowlan_wakeup *wakeup,
4037 gfp_t gfp);
4038
3767/* Logging, debugging and troubleshooting/diagnostic helpers. */ 4039/* Logging, debugging and troubleshooting/diagnostic helpers. */
3768 4040
3769/* wiphy_printk helpers, similar to dev_printk */ 4041/* wiphy_printk helpers, similar to dev_printk */
diff --git a/include/net/dn_route.h b/include/net/dn_route.h
index 4f7d6a182381..2e9d317c82dc 100644
--- a/include/net/dn_route.h
+++ b/include/net/dn_route.h
@@ -16,7 +16,7 @@
16*******************************************************************************/ 16*******************************************************************************/
17 17
18extern struct sk_buff *dn_alloc_skb(struct sock *sk, int size, gfp_t pri); 18extern struct sk_buff *dn_alloc_skb(struct sock *sk, int size, gfp_t pri);
19extern int dn_route_output_sock(struct dst_entry **pprt, struct flowidn *, struct sock *sk, int flags); 19extern int dn_route_output_sock(struct dst_entry __rcu **pprt, struct flowidn *, struct sock *sk, int flags);
20extern int dn_cache_dump(struct sk_buff *skb, struct netlink_callback *cb); 20extern int dn_cache_dump(struct sk_buff *skb, struct netlink_callback *cb);
21extern void dn_rt_cache_flush(int delay); 21extern void dn_rt_cache_flush(int delay);
22 22
diff --git a/include/net/dsfield.h b/include/net/dsfield.h
index 8a8d4e06900d..e1ad903a8d6a 100644
--- a/include/net/dsfield.h
+++ b/include/net/dsfield.h
@@ -43,11 +43,9 @@ static inline void ipv4_change_dsfield(struct iphdr *iph,__u8 mask,
43static inline void ipv6_change_dsfield(struct ipv6hdr *ipv6h,__u8 mask, 43static inline void ipv6_change_dsfield(struct ipv6hdr *ipv6h,__u8 mask,
44 __u8 value) 44 __u8 value)
45{ 45{
46 __u16 tmp; 46 __be16 *p = (__force __be16 *)ipv6h;
47 47
48 tmp = ntohs(*(__be16 *) ipv6h); 48 *p = (*p & htons((((u16)mask << 4) | 0xf00f))) | htons((u16)value << 4);
49 tmp = (tmp & ((mask << 4) | 0xf00f)) | (value << 4);
50 *(__be16 *) ipv6h = htons(tmp);
51} 49}
52 50
53 51
diff --git a/include/net/dst.h b/include/net/dst.h
index 9a7881066fb3..853cda11e518 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -36,13 +36,9 @@ struct dst_entry {
36 struct net_device *dev; 36 struct net_device *dev;
37 struct dst_ops *ops; 37 struct dst_ops *ops;
38 unsigned long _metrics; 38 unsigned long _metrics;
39 union { 39 unsigned long expires;
40 unsigned long expires;
41 /* point to where the dst_entry copied from */
42 struct dst_entry *from;
43 };
44 struct dst_entry *path; 40 struct dst_entry *path;
45 void *__pad0; 41 struct dst_entry *from;
46#ifdef CONFIG_XFRM 42#ifdef CONFIG_XFRM
47 struct xfrm_state *xfrm; 43 struct xfrm_state *xfrm;
48#else 44#else
@@ -61,6 +57,7 @@ struct dst_entry {
61#define DST_NOPEER 0x0040 57#define DST_NOPEER 0x0040
62#define DST_FAKE_RTABLE 0x0080 58#define DST_FAKE_RTABLE 0x0080
63#define DST_XFRM_TUNNEL 0x0100 59#define DST_XFRM_TUNNEL 0x0100
60#define DST_XFRM_QUEUE 0x0200
64 61
65 unsigned short pending_confirm; 62 unsigned short pending_confirm;
66 63
diff --git a/include/net/gro_cells.h b/include/net/gro_cells.h
index e5062c955ea6..734d9b5f577a 100644
--- a/include/net/gro_cells.h
+++ b/include/net/gro_cells.h
@@ -73,8 +73,8 @@ static inline int gro_cells_init(struct gro_cells *gcells, struct net_device *de
73 int i; 73 int i;
74 74
75 gcells->gro_cells_mask = roundup_pow_of_two(netif_get_num_default_rss_queues()) - 1; 75 gcells->gro_cells_mask = roundup_pow_of_two(netif_get_num_default_rss_queues()) - 1;
76 gcells->cells = kcalloc(sizeof(struct gro_cell), 76 gcells->cells = kcalloc(gcells->gro_cells_mask + 1,
77 gcells->gro_cells_mask + 1, 77 sizeof(struct gro_cell),
78 GFP_KERNEL); 78 GFP_KERNEL);
79 if (!gcells->cells) 79 if (!gcells->cells)
80 return -ENOMEM; 80 return -ENOMEM;
diff --git a/include/net/inet6_hashtables.h b/include/net/inet6_hashtables.h
index 9e34c877a770..7ca75cbbf75e 100644
--- a/include/net/inet6_hashtables.h
+++ b/include/net/inet6_hashtables.h
@@ -71,6 +71,8 @@ extern struct sock *__inet6_lookup_established(struct net *net,
71 71
72extern struct sock *inet6_lookup_listener(struct net *net, 72extern struct sock *inet6_lookup_listener(struct net *net,
73 struct inet_hashinfo *hashinfo, 73 struct inet_hashinfo *hashinfo,
74 const struct in6_addr *saddr,
75 const __be16 sport,
74 const struct in6_addr *daddr, 76 const struct in6_addr *daddr,
75 const unsigned short hnum, 77 const unsigned short hnum,
76 const int dif); 78 const int dif);
@@ -88,7 +90,8 @@ static inline struct sock *__inet6_lookup(struct net *net,
88 if (sk) 90 if (sk)
89 return sk; 91 return sk;
90 92
91 return inet6_lookup_listener(net, hashinfo, daddr, hnum, dif); 93 return inet6_lookup_listener(net, hashinfo, saddr, sport,
94 daddr, hnum, dif);
92} 95}
93 96
94static inline struct sock *__inet6_lookup_skb(struct inet_hashinfo *hashinfo, 97static inline struct sock *__inet6_lookup_skb(struct inet_hashinfo *hashinfo,
diff --git a/include/net/inet_frag.h b/include/net/inet_frag.h
index 32786a044718..3f237db0a426 100644
--- a/include/net/inet_frag.h
+++ b/include/net/inet_frag.h
@@ -1,10 +1,17 @@
1#ifndef __NET_FRAG_H__ 1#ifndef __NET_FRAG_H__
2#define __NET_FRAG_H__ 2#define __NET_FRAG_H__
3 3
4#include <linux/percpu_counter.h>
5
4struct netns_frags { 6struct netns_frags {
5 int nqueues; 7 int nqueues;
6 atomic_t mem;
7 struct list_head lru_list; 8 struct list_head lru_list;
9 spinlock_t lru_lock;
10
11 /* The percpu_counter "mem" need to be cacheline aligned.
12 * mem.count must not share cacheline with other writers
13 */
14 struct percpu_counter mem ____cacheline_aligned_in_smp;
8 15
9 /* sysctls */ 16 /* sysctls */
10 int timeout; 17 int timeout;
@@ -13,12 +20,11 @@ struct netns_frags {
13}; 20};
14 21
15struct inet_frag_queue { 22struct inet_frag_queue {
16 struct hlist_node list;
17 struct netns_frags *net;
18 struct list_head lru_list; /* lru list member */
19 spinlock_t lock; 23 spinlock_t lock;
20 atomic_t refcnt;
21 struct timer_list timer; /* when will this queue expire? */ 24 struct timer_list timer; /* when will this queue expire? */
25 struct list_head lru_list; /* lru list member */
26 struct hlist_node list;
27 atomic_t refcnt;
22 struct sk_buff *fragments; /* list of received fragments */ 28 struct sk_buff *fragments; /* list of received fragments */
23 struct sk_buff *fragments_tail; 29 struct sk_buff *fragments_tail;
24 ktime_t stamp; 30 ktime_t stamp;
@@ -31,24 +37,29 @@ struct inet_frag_queue {
31#define INET_FRAG_LAST_IN 1 37#define INET_FRAG_LAST_IN 1
32 38
33 u16 max_size; 39 u16 max_size;
40
41 struct netns_frags *net;
34}; 42};
35 43
36#define INETFRAGS_HASHSZ 64 44#define INETFRAGS_HASHSZ 64
37 45
38struct inet_frags { 46struct inet_frags {
39 struct hlist_head hash[INETFRAGS_HASHSZ]; 47 struct hlist_head hash[INETFRAGS_HASHSZ];
40 rwlock_t lock; 48 /* This rwlock is a global lock (seperate per IPv4, IPv6 and
41 u32 rnd; 49 * netfilter). Important to keep this on a seperate cacheline.
42 int qsize; 50 */
51 rwlock_t lock ____cacheline_aligned_in_smp;
43 int secret_interval; 52 int secret_interval;
44 struct timer_list secret_timer; 53 struct timer_list secret_timer;
54 u32 rnd;
55 int qsize;
45 56
46 unsigned int (*hashfn)(struct inet_frag_queue *); 57 unsigned int (*hashfn)(struct inet_frag_queue *);
58 bool (*match)(struct inet_frag_queue *q, void *arg);
47 void (*constructor)(struct inet_frag_queue *q, 59 void (*constructor)(struct inet_frag_queue *q,
48 void *arg); 60 void *arg);
49 void (*destructor)(struct inet_frag_queue *); 61 void (*destructor)(struct inet_frag_queue *);
50 void (*skb_free)(struct sk_buff *); 62 void (*skb_free)(struct sk_buff *);
51 bool (*match)(struct inet_frag_queue *q, void *arg);
52 void (*frag_expire)(unsigned long data); 63 void (*frag_expire)(unsigned long data);
53}; 64};
54 65
@@ -72,4 +83,59 @@ static inline void inet_frag_put(struct inet_frag_queue *q, struct inet_frags *f
72 inet_frag_destroy(q, f, NULL); 83 inet_frag_destroy(q, f, NULL);
73} 84}
74 85
86/* Memory Tracking Functions. */
87
88/* The default percpu_counter batch size is not big enough to scale to
89 * fragmentation mem acct sizes.
90 * The mem size of a 64K fragment is approx:
91 * (44 fragments * 2944 truesize) + frag_queue struct(200) = 129736 bytes
92 */
93static unsigned int frag_percpu_counter_batch = 130000;
94
95static inline int frag_mem_limit(struct netns_frags *nf)
96{
97 return percpu_counter_read(&nf->mem);
98}
99
100static inline void sub_frag_mem_limit(struct inet_frag_queue *q, int i)
101{
102 __percpu_counter_add(&q->net->mem, -i, frag_percpu_counter_batch);
103}
104
105static inline void add_frag_mem_limit(struct inet_frag_queue *q, int i)
106{
107 __percpu_counter_add(&q->net->mem, i, frag_percpu_counter_batch);
108}
109
110static inline void init_frag_mem_limit(struct netns_frags *nf)
111{
112 percpu_counter_init(&nf->mem, 0);
113}
114
115static inline int sum_frag_mem_limit(struct netns_frags *nf)
116{
117 return percpu_counter_sum_positive(&nf->mem);
118}
119
120static inline void inet_frag_lru_move(struct inet_frag_queue *q)
121{
122 spin_lock(&q->net->lru_lock);
123 list_move_tail(&q->lru_list, &q->net->lru_list);
124 spin_unlock(&q->net->lru_lock);
125}
126
127static inline void inet_frag_lru_del(struct inet_frag_queue *q)
128{
129 spin_lock(&q->net->lru_lock);
130 list_del(&q->lru_list);
131 spin_unlock(&q->net->lru_lock);
132}
133
134static inline void inet_frag_lru_add(struct netns_frags *nf,
135 struct inet_frag_queue *q)
136{
137 spin_lock(&nf->lru_lock);
138 list_add_tail(&q->lru_list, &nf->lru_list);
139 spin_unlock(&nf->lru_lock);
140}
75#endif 141#endif
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h
index 67a8fa098e3a..7b2ae9d37076 100644
--- a/include/net/inet_hashtables.h
+++ b/include/net/inet_hashtables.h
@@ -81,7 +81,9 @@ struct inet_bind_bucket {
81 struct net *ib_net; 81 struct net *ib_net;
82#endif 82#endif
83 unsigned short port; 83 unsigned short port;
84 signed short fastreuse; 84 signed char fastreuse;
85 signed char fastreuseport;
86 kuid_t fastuid;
85 int num_owners; 87 int num_owners;
86 struct hlist_node node; 88 struct hlist_node node;
87 struct hlist_head owners; 89 struct hlist_head owners;
@@ -257,15 +259,19 @@ extern void inet_unhash(struct sock *sk);
257 259
258extern struct sock *__inet_lookup_listener(struct net *net, 260extern struct sock *__inet_lookup_listener(struct net *net,
259 struct inet_hashinfo *hashinfo, 261 struct inet_hashinfo *hashinfo,
262 const __be32 saddr,
263 const __be16 sport,
260 const __be32 daddr, 264 const __be32 daddr,
261 const unsigned short hnum, 265 const unsigned short hnum,
262 const int dif); 266 const int dif);
263 267
264static inline struct sock *inet_lookup_listener(struct net *net, 268static inline struct sock *inet_lookup_listener(struct net *net,
265 struct inet_hashinfo *hashinfo, 269 struct inet_hashinfo *hashinfo,
270 __be32 saddr, __be16 sport,
266 __be32 daddr, __be16 dport, int dif) 271 __be32 daddr, __be16 dport, int dif)
267{ 272{
268 return __inet_lookup_listener(net, hashinfo, daddr, ntohs(dport), dif); 273 return __inet_lookup_listener(net, hashinfo, saddr, sport,
274 daddr, ntohs(dport), dif);
269} 275}
270 276
271/* Socket demux engine toys. */ 277/* Socket demux engine toys. */
@@ -358,7 +364,8 @@ static inline struct sock *__inet_lookup(struct net *net,
358 struct sock *sk = __inet_lookup_established(net, hashinfo, 364 struct sock *sk = __inet_lookup_established(net, hashinfo,
359 saddr, sport, daddr, hnum, dif); 365 saddr, sport, daddr, hnum, dif);
360 366
361 return sk ? : __inet_lookup_listener(net, hashinfo, daddr, hnum, dif); 367 return sk ? : __inet_lookup_listener(net, hashinfo, saddr, sport,
368 daddr, hnum, dif);
362} 369}
363 370
364static inline struct sock *inet_lookup(struct net *net, 371static inline struct sock *inet_lookup(struct net *net,
diff --git a/include/net/ip.h b/include/net/ip.h
index 0707fb9551aa..a68f838a132c 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -143,6 +143,8 @@ static inline struct sk_buff *ip_finish_skb(struct sock *sk, struct flowi4 *fl4)
143extern int ip4_datagram_connect(struct sock *sk, 143extern int ip4_datagram_connect(struct sock *sk,
144 struct sockaddr *uaddr, int addr_len); 144 struct sockaddr *uaddr, int addr_len);
145 145
146extern void ip4_datagram_release_cb(struct sock *sk);
147
146struct ip_reply_arg { 148struct ip_reply_arg {
147 struct kvec iov[1]; 149 struct kvec iov[1];
148 int flags; 150 int flags;
diff --git a/include/net/ip6_checksum.h b/include/net/ip6_checksum.h
index 652d3d309357..7686e3f5033d 100644
--- a/include/net/ip6_checksum.h
+++ b/include/net/ip6_checksum.h
@@ -35,63 +35,10 @@
35#include <linux/ipv6.h> 35#include <linux/ipv6.h>
36 36
37#ifndef _HAVE_ARCH_IPV6_CSUM 37#ifndef _HAVE_ARCH_IPV6_CSUM
38 38__sum16 csum_ipv6_magic(const struct in6_addr *saddr,
39static __inline__ __sum16 csum_ipv6_magic(const struct in6_addr *saddr, 39 const struct in6_addr *daddr,
40 const struct in6_addr *daddr, 40 __u32 len, unsigned short proto,
41 __u32 len, unsigned short proto, 41 __wsum csum);
42 __wsum csum)
43{
44
45 int carry;
46 __u32 ulen;
47 __u32 uproto;
48 __u32 sum = (__force u32)csum;
49
50 sum += (__force u32)saddr->s6_addr32[0];
51 carry = (sum < (__force u32)saddr->s6_addr32[0]);
52 sum += carry;
53
54 sum += (__force u32)saddr->s6_addr32[1];
55 carry = (sum < (__force u32)saddr->s6_addr32[1]);
56 sum += carry;
57
58 sum += (__force u32)saddr->s6_addr32[2];
59 carry = (sum < (__force u32)saddr->s6_addr32[2]);
60 sum += carry;
61
62 sum += (__force u32)saddr->s6_addr32[3];
63 carry = (sum < (__force u32)saddr->s6_addr32[3]);
64 sum += carry;
65
66 sum += (__force u32)daddr->s6_addr32[0];
67 carry = (sum < (__force u32)daddr->s6_addr32[0]);
68 sum += carry;
69
70 sum += (__force u32)daddr->s6_addr32[1];
71 carry = (sum < (__force u32)daddr->s6_addr32[1]);
72 sum += carry;
73
74 sum += (__force u32)daddr->s6_addr32[2];
75 carry = (sum < (__force u32)daddr->s6_addr32[2]);
76 sum += carry;
77
78 sum += (__force u32)daddr->s6_addr32[3];
79 carry = (sum < (__force u32)daddr->s6_addr32[3]);
80 sum += carry;
81
82 ulen = (__force u32)htonl((__u32) len);
83 sum += ulen;
84 carry = (sum < ulen);
85 sum += carry;
86
87 uproto = (__force u32)htonl(proto);
88 sum += uproto;
89 carry = (sum < uproto);
90 sum += carry;
91
92 return csum_fold((__force __wsum)sum);
93}
94
95#endif 42#endif
96 43
97static __inline__ __sum16 tcp_v6_check(int len, 44static __inline__ __sum16 tcp_v6_check(int len,
@@ -126,4 +73,5 @@ static inline void tcp_v6_send_check(struct sock *sk, struct sk_buff *skb)
126 __tcp_v6_send_check(skb, &np->saddr, &np->daddr); 73 __tcp_v6_send_check(skb, &np->saddr, &np->daddr);
127} 74}
128 75
76int udp6_csum_init(struct sk_buff *skb, struct udphdr *uh, int proto);
129#endif 77#endif
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
index fdc48a94a063..2a601e7da1bf 100644
--- a/include/net/ip6_fib.h
+++ b/include/net/ip6_fib.h
@@ -89,8 +89,6 @@ struct fib6_table;
89struct rt6_info { 89struct rt6_info {
90 struct dst_entry dst; 90 struct dst_entry dst;
91 91
92 struct neighbour *n;
93
94 /* 92 /*
95 * Tail elements of dst_entry (__refcnt etc.) 93 * Tail elements of dst_entry (__refcnt etc.)
96 * and these elements (rarely used in hot path) are in 94 * and these elements (rarely used in hot path) are in
@@ -166,50 +164,35 @@ static inline struct inet6_dev *ip6_dst_idev(struct dst_entry *dst)
166 164
167static inline void rt6_clean_expires(struct rt6_info *rt) 165static inline void rt6_clean_expires(struct rt6_info *rt)
168{ 166{
169 if (!(rt->rt6i_flags & RTF_EXPIRES) && rt->dst.from)
170 dst_release(rt->dst.from);
171
172 rt->rt6i_flags &= ~RTF_EXPIRES; 167 rt->rt6i_flags &= ~RTF_EXPIRES;
173 rt->dst.from = NULL;
174} 168}
175 169
176static inline void rt6_set_expires(struct rt6_info *rt, unsigned long expires) 170static inline void rt6_set_expires(struct rt6_info *rt, unsigned long expires)
177{ 171{
178 if (!(rt->rt6i_flags & RTF_EXPIRES) && rt->dst.from)
179 dst_release(rt->dst.from);
180
181 rt->rt6i_flags |= RTF_EXPIRES;
182 rt->dst.expires = expires; 172 rt->dst.expires = expires;
173 rt->rt6i_flags |= RTF_EXPIRES;
183} 174}
184 175
185static inline void rt6_update_expires(struct rt6_info *rt, int timeout) 176static inline void rt6_update_expires(struct rt6_info *rt0, int timeout)
186{ 177{
187 if (!(rt->rt6i_flags & RTF_EXPIRES)) { 178 struct rt6_info *rt;
188 if (rt->dst.from) 179
189 dst_release(rt->dst.from); 180 for (rt = rt0; rt && !(rt->rt6i_flags & RTF_EXPIRES);
190 /* dst_set_expires relies on expires == 0 181 rt = (struct rt6_info *)rt->dst.from);
191 * if it has not been set previously. 182 if (rt && rt != rt0)
192 */ 183 rt0->dst.expires = rt->dst.expires;
193 rt->dst.expires = 0; 184
194 } 185 dst_set_expires(&rt0->dst, timeout);
195 186 rt0->rt6i_flags |= RTF_EXPIRES;
196 dst_set_expires(&rt->dst, timeout);
197 rt->rt6i_flags |= RTF_EXPIRES;
198} 187}
199 188
200static inline void rt6_set_from(struct rt6_info *rt, struct rt6_info *from) 189static inline void rt6_set_from(struct rt6_info *rt, struct rt6_info *from)
201{ 190{
202 struct dst_entry *new = (struct dst_entry *) from; 191 struct dst_entry *new = (struct dst_entry *) from;
203 192
204 if (!(rt->rt6i_flags & RTF_EXPIRES) && rt->dst.from) {
205 if (new == rt->dst.from)
206 return;
207 dst_release(rt->dst.from);
208 }
209
210 rt->rt6i_flags &= ~RTF_EXPIRES; 193 rt->rt6i_flags &= ~RTF_EXPIRES;
211 rt->dst.from = new;
212 dst_hold(new); 194 dst_hold(new);
195 rt->dst.from = new;
213} 196}
214 197
215static inline void ip6_rt_put(struct rt6_info *rt) 198static inline void ip6_rt_put(struct rt6_info *rt)
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
index 27d83183e615..260f83f16bcf 100644
--- a/include/net/ip6_route.h
+++ b/include/net/ip6_route.h
@@ -23,6 +23,7 @@ struct route_info {
23#include <net/sock.h> 23#include <net/sock.h>
24#include <linux/ip.h> 24#include <linux/ip.h>
25#include <linux/ipv6.h> 25#include <linux/ipv6.h>
26#include <linux/route.h>
26 27
27#define RT6_LOOKUP_F_IFACE 0x00000001 28#define RT6_LOOKUP_F_IFACE 0x00000001
28#define RT6_LOOKUP_F_REACHABLE 0x00000002 29#define RT6_LOOKUP_F_REACHABLE 0x00000002
@@ -102,7 +103,6 @@ extern struct rt6_info *rt6_lookup(struct net *net,
102 int oif, int flags); 103 int oif, int flags);
103 104
104extern struct dst_entry *icmp6_dst_alloc(struct net_device *dev, 105extern struct dst_entry *icmp6_dst_alloc(struct net_device *dev,
105 struct neighbour *neigh,
106 struct flowi6 *fl6); 106 struct flowi6 *fl6);
107extern int icmp6_dst_gc(void); 107extern int icmp6_dst_gc(void);
108 108
@@ -194,4 +194,11 @@ static inline int ip6_skb_dst_mtu(struct sk_buff *skb)
194 skb_dst(skb)->dev->mtu : dst_mtu(skb_dst(skb)); 194 skb_dst(skb)->dev->mtu : dst_mtu(skb_dst(skb));
195} 195}
196 196
197static inline struct in6_addr *rt6_nexthop(struct rt6_info *rt, struct in6_addr *dest)
198{
199 if (rt->rt6i_flags & RTF_GATEWAY)
200 return &rt->rt6i_gateway;
201 return dest;
202}
203
197#endif 204#endif
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 5af66b26ebdd..851d5412a299 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -222,6 +222,7 @@ struct ip6_flowlabel {
222 struct in6_addr dst; 222 struct in6_addr dst;
223 struct ipv6_txoptions *opt; 223 struct ipv6_txoptions *opt;
224 unsigned long linger; 224 unsigned long linger;
225 struct rcu_head rcu;
225 u8 share; 226 u8 share;
226 union { 227 union {
227 struct pid *pid; 228 struct pid *pid;
@@ -238,6 +239,7 @@ struct ip6_flowlabel {
238struct ipv6_fl_socklist { 239struct ipv6_fl_socklist {
239 struct ipv6_fl_socklist *next; 240 struct ipv6_fl_socklist *next;
240 struct ip6_flowlabel *fl; 241 struct ip6_flowlabel *fl;
242 struct rcu_head rcu;
241}; 243};
242 244
243extern struct ip6_flowlabel *fl6_sock_lookup(struct sock *sk, __be32 label); 245extern struct ip6_flowlabel *fl6_sock_lookup(struct sock *sk, __be32 label);
@@ -288,12 +290,12 @@ static inline int ip6_frag_nqueues(struct net *net)
288 290
289static inline int ip6_frag_mem(struct net *net) 291static inline int ip6_frag_mem(struct net *net)
290{ 292{
291 return atomic_read(&net->ipv6.frags.mem); 293 return sum_frag_mem_limit(&net->ipv6.frags);
292} 294}
293#endif 295#endif
294 296
295#define IPV6_FRAG_HIGH_THRESH (256 * 1024) /* 262144 */ 297#define IPV6_FRAG_HIGH_THRESH (4 * 1024*1024) /* 4194304 */
296#define IPV6_FRAG_LOW_THRESH (192 * 1024) /* 196608 */ 298#define IPV6_FRAG_LOW_THRESH (3 * 1024*1024) /* 3145728 */
297#define IPV6_FRAG_TIMEOUT (60 * HZ) /* 60 seconds */ 299#define IPV6_FRAG_TIMEOUT (60 * HZ) /* 60 seconds */
298 300
299extern int __ipv6_addr_type(const struct in6_addr *addr); 301extern int __ipv6_addr_type(const struct in6_addr *addr);
@@ -355,14 +357,32 @@ static inline void ipv6_addr_prefix(struct in6_addr *pfx,
355 pfx->s6_addr[o] = addr->s6_addr[o] & (0xff00 >> b); 357 pfx->s6_addr[o] = addr->s6_addr[o] & (0xff00 >> b);
356} 358}
357 359
360static inline void __ipv6_addr_set_half(__be32 *addr,
361 __be32 wh, __be32 wl)
362{
363#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64
364#if defined(__BIG_ENDIAN)
365 if (__builtin_constant_p(wh) && __builtin_constant_p(wl)) {
366 *(__force u64 *)addr = ((__force u64)(wh) << 32 | (__force u64)(wl));
367 return;
368 }
369#elif defined(__LITTLE_ENDIAN)
370 if (__builtin_constant_p(wl) && __builtin_constant_p(wh)) {
371 *(__force u64 *)addr = ((__force u64)(wl) << 32 | (__force u64)(wh));
372 return;
373 }
374#endif
375#endif
376 addr[0] = wh;
377 addr[1] = wl;
378}
379
358static inline void ipv6_addr_set(struct in6_addr *addr, 380static inline void ipv6_addr_set(struct in6_addr *addr,
359 __be32 w1, __be32 w2, 381 __be32 w1, __be32 w2,
360 __be32 w3, __be32 w4) 382 __be32 w3, __be32 w4)
361{ 383{
362 addr->s6_addr32[0] = w1; 384 __ipv6_addr_set_half(&addr->s6_addr32[0], w1, w2);
363 addr->s6_addr32[1] = w2; 385 __ipv6_addr_set_half(&addr->s6_addr32[2], w3, w4);
364 addr->s6_addr32[2] = w3;
365 addr->s6_addr32[3] = w4;
366} 386}
367 387
368static inline bool ipv6_addr_equal(const struct in6_addr *a1, 388static inline bool ipv6_addr_equal(const struct in6_addr *a1,
@@ -381,9 +401,37 @@ static inline bool ipv6_addr_equal(const struct in6_addr *a1,
381#endif 401#endif
382} 402}
383 403
384static inline bool __ipv6_prefix_equal(const __be32 *a1, const __be32 *a2, 404#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64
385 unsigned int prefixlen) 405static inline bool __ipv6_prefix_equal64_half(const __be64 *a1,
406 const __be64 *a2,
407 unsigned int len)
408{
409 if (len && ((*a1 ^ *a2) & cpu_to_be64((~0UL) << (64 - len))))
410 return false;
411 return true;
412}
413
414static inline bool ipv6_prefix_equal(const struct in6_addr *addr1,
415 const struct in6_addr *addr2,
416 unsigned int prefixlen)
417{
418 const __be64 *a1 = (const __be64 *)addr1;
419 const __be64 *a2 = (const __be64 *)addr2;
420
421 if (prefixlen >= 64) {
422 if (a1[0] ^ a2[0])
423 return false;
424 return __ipv6_prefix_equal64_half(a1 + 1, a2 + 1, prefixlen - 64);
425 }
426 return __ipv6_prefix_equal64_half(a1, a2, prefixlen);
427}
428#else
429static inline bool ipv6_prefix_equal(const struct in6_addr *addr1,
430 const struct in6_addr *addr2,
431 unsigned int prefixlen)
386{ 432{
433 const __be32 *a1 = addr1->s6_addr32;
434 const __be32 *a2 = addr2->s6_addr32;
387 unsigned int pdw, pbi; 435 unsigned int pdw, pbi;
388 436
389 /* check complete u32 in prefix */ 437 /* check complete u32 in prefix */
@@ -398,14 +446,7 @@ static inline bool __ipv6_prefix_equal(const __be32 *a1, const __be32 *a2,
398 446
399 return true; 447 return true;
400} 448}
401 449#endif
402static inline bool ipv6_prefix_equal(const struct in6_addr *a1,
403 const struct in6_addr *a2,
404 unsigned int prefixlen)
405{
406 return __ipv6_prefix_equal(a1->s6_addr32, a2->s6_addr32,
407 prefixlen);
408}
409 450
410struct inet_frag_queue; 451struct inet_frag_queue;
411 452
@@ -475,14 +516,25 @@ static inline u32 ipv6_addr_hash(const struct in6_addr *a)
475 516
476static inline bool ipv6_addr_loopback(const struct in6_addr *a) 517static inline bool ipv6_addr_loopback(const struct in6_addr *a)
477{ 518{
519#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64
520 const unsigned long *ul = (const unsigned long *)a;
521
522 return (ul[0] | (ul[1] ^ cpu_to_be64(1))) == 0UL;
523#else
478 return (a->s6_addr32[0] | a->s6_addr32[1] | 524 return (a->s6_addr32[0] | a->s6_addr32[1] |
479 a->s6_addr32[2] | (a->s6_addr32[3] ^ htonl(1))) == 0; 525 a->s6_addr32[2] | (a->s6_addr32[3] ^ htonl(1))) == 0;
526#endif
480} 527}
481 528
482static inline bool ipv6_addr_v4mapped(const struct in6_addr *a) 529static inline bool ipv6_addr_v4mapped(const struct in6_addr *a)
483{ 530{
484 return (a->s6_addr32[0] | a->s6_addr32[1] | 531 return (
485 (a->s6_addr32[2] ^ htonl(0x0000ffff))) == 0; 532#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64
533 *(__be64 *)a |
534#else
535 (a->s6_addr32[0] | a->s6_addr32[1]) |
536#endif
537 (a->s6_addr32[2] ^ htonl(0x0000ffff))) == 0UL;
486} 538}
487 539
488/* 540/*
@@ -507,7 +559,7 @@ static inline void ipv6_addr_set_v4mapped(const __be32 addr,
507 * find the first different bit between two addresses 559 * find the first different bit between two addresses
508 * length of address must be a multiple of 32bits 560 * length of address must be a multiple of 32bits
509 */ 561 */
510static inline int __ipv6_addr_diff(const void *token1, const void *token2, int addrlen) 562static inline int __ipv6_addr_diff32(const void *token1, const void *token2, int addrlen)
511{ 563{
512 const __be32 *a1 = token1, *a2 = token2; 564 const __be32 *a1 = token1, *a2 = token2;
513 int i; 565 int i;
@@ -539,6 +591,33 @@ static inline int __ipv6_addr_diff(const void *token1, const void *token2, int a
539 return addrlen << 5; 591 return addrlen << 5;
540} 592}
541 593
594#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64
595static inline int __ipv6_addr_diff64(const void *token1, const void *token2, int addrlen)
596{
597 const __be64 *a1 = token1, *a2 = token2;
598 int i;
599
600 addrlen >>= 3;
601
602 for (i = 0; i < addrlen; i++) {
603 __be64 xb = a1[i] ^ a2[i];
604 if (xb)
605 return i * 64 + 63 - __fls(be64_to_cpu(xb));
606 }
607
608 return addrlen << 6;
609}
610#endif
611
612static inline int __ipv6_addr_diff(const void *token1, const void *token2, int addrlen)
613{
614#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64
615 if (__builtin_constant_p(addrlen) && !(addrlen & 7))
616 return __ipv6_addr_diff64(token1, token2, addrlen);
617#endif
618 return __ipv6_addr_diff32(token1, token2, addrlen);
619}
620
542static inline int ipv6_addr_diff(const struct in6_addr *a1, const struct in6_addr *a2) 621static inline int ipv6_addr_diff(const struct in6_addr *a1, const struct in6_addr *a2)
543{ 622{
544 return __ipv6_addr_diff(a1, a2, sizeof(struct in6_addr)); 623 return __ipv6_addr_diff(a1, a2, sizeof(struct in6_addr));
@@ -547,6 +626,20 @@ static inline int ipv6_addr_diff(const struct in6_addr *a1, const struct in6_add
547extern void ipv6_select_ident(struct frag_hdr *fhdr, struct rt6_info *rt); 626extern void ipv6_select_ident(struct frag_hdr *fhdr, struct rt6_info *rt);
548 627
549/* 628/*
629 * Header manipulation
630 */
631static inline void ip6_flow_hdr(struct ipv6hdr *hdr, unsigned int tclass,
632 __be32 flowlabel)
633{
634 *(__be32 *)hdr = htonl(0x60000000 | (tclass << 20)) | flowlabel;
635}
636
637static inline __be32 ip6_flowinfo(const struct ipv6hdr *hdr)
638{
639 return *(__be32 *)hdr & IPV6_FLOWINFO_MASK;
640}
641
642/*
550 * Prototypes exported by ipv6 643 * Prototypes exported by ipv6
551 */ 644 */
552 645
@@ -570,13 +663,6 @@ extern int ip6_xmit(struct sock *sk,
570 struct ipv6_txoptions *opt, 663 struct ipv6_txoptions *opt,
571 int tclass); 664 int tclass);
572 665
573extern int ip6_nd_hdr(struct sock *sk,
574 struct sk_buff *skb,
575 struct net_device *dev,
576 const struct in6_addr *saddr,
577 const struct in6_addr *daddr,
578 int proto, int len);
579
580extern int ip6_find_1stfragopt(struct sk_buff *skb, u8 **nexthdr); 666extern int ip6_find_1stfragopt(struct sk_buff *skb, u8 **nexthdr);
581 667
582extern int ip6_append_data(struct sock *sk, 668extern int ip6_append_data(struct sock *sk,
diff --git a/include/net/irda/irlmp.h b/include/net/irda/irlmp.h
index 591f78631f13..f74109144d3f 100644
--- a/include/net/irda/irlmp.h
+++ b/include/net/irda/irlmp.h
@@ -278,7 +278,7 @@ static inline int irlmp_lap_tx_queue_full(struct lsap_cb *self)
278} 278}
279 279
280/* After doing a irlmp_dup(), this get one of the two socket back into 280/* After doing a irlmp_dup(), this get one of the two socket back into
281 * a state where it's waiting incomming connections. 281 * a state where it's waiting incoming connections.
282 * Note : this can be used *only* if the socket is not yet connected 282 * Note : this can be used *only* if the socket is not yet connected
283 * (i.e. NO irlmp_connect_response() done on this socket). 283 * (i.e. NO irlmp_connect_response() done on this socket).
284 * - Jean II */ 284 * - Jean II */
diff --git a/include/net/irda/irttp.h b/include/net/irda/irttp.h
index af4b87721d13..98682d4bae8f 100644
--- a/include/net/irda/irttp.h
+++ b/include/net/irda/irttp.h
@@ -185,7 +185,7 @@ static inline __u32 irttp_get_max_seg_size(struct tsap_cb *self)
185} 185}
186 186
187/* After doing a irttp_dup(), this get one of the two socket back into 187/* After doing a irttp_dup(), this get one of the two socket back into
188 * a state where it's waiting incomming connections. 188 * a state where it's waiting incoming connections.
189 * Note : this can be used *only* if the socket is not yet connected 189 * Note : this can be used *only* if the socket is not yet connected
190 * (i.e. NO irttp_connect_response() done on this socket). 190 * (i.e. NO irttp_connect_response() done on this socket).
191 * - Jean II */ 191 * - Jean II */
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index ee50c5eba50c..f7eba1300d82 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -147,10 +147,12 @@ struct ieee80211_low_level_stats {
147 * enum ieee80211_chanctx_change - change flag for channel context 147 * enum ieee80211_chanctx_change - change flag for channel context
148 * @IEEE80211_CHANCTX_CHANGE_WIDTH: The channel width changed 148 * @IEEE80211_CHANCTX_CHANGE_WIDTH: The channel width changed
149 * @IEEE80211_CHANCTX_CHANGE_RX_CHAINS: The number of RX chains changed 149 * @IEEE80211_CHANCTX_CHANGE_RX_CHAINS: The number of RX chains changed
150 * @IEEE80211_CHANCTX_CHANGE_RADAR: radar detection flag changed
150 */ 151 */
151enum ieee80211_chanctx_change { 152enum ieee80211_chanctx_change {
152 IEEE80211_CHANCTX_CHANGE_WIDTH = BIT(0), 153 IEEE80211_CHANCTX_CHANGE_WIDTH = BIT(0),
153 IEEE80211_CHANCTX_CHANGE_RX_CHAINS = BIT(1), 154 IEEE80211_CHANCTX_CHANGE_RX_CHAINS = BIT(1),
155 IEEE80211_CHANCTX_CHANGE_RADAR = BIT(2),
154}; 156};
155 157
156/** 158/**
@@ -165,6 +167,7 @@ enum ieee80211_chanctx_change {
165 * @rx_chains_dynamic: The number of RX chains that must be enabled 167 * @rx_chains_dynamic: The number of RX chains that must be enabled
166 * after RTS/CTS handshake to receive SMPS MIMO transmissions; 168 * after RTS/CTS handshake to receive SMPS MIMO transmissions;
167 * this will always be >= @rx_chains_static. 169 * this will always be >= @rx_chains_static.
170 * @radar_enabled: whether radar detection is enabled on this channel.
168 * @drv_priv: data area for driver use, will always be aligned to 171 * @drv_priv: data area for driver use, will always be aligned to
169 * sizeof(void *), size is determined in hw information. 172 * sizeof(void *), size is determined in hw information.
170 */ 173 */
@@ -173,7 +176,9 @@ struct ieee80211_chanctx_conf {
173 176
174 u8 rx_chains_static, rx_chains_dynamic; 177 u8 rx_chains_static, rx_chains_dynamic;
175 178
176 u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *)))); 179 bool radar_enabled;
180
181 u8 drv_priv[0] __aligned(sizeof(void *));
177}; 182};
178 183
179/** 184/**
@@ -208,6 +213,11 @@ struct ieee80211_chanctx_conf {
208 * @BSS_CHANGED_TXPOWER: TX power setting changed for this interface 213 * @BSS_CHANGED_TXPOWER: TX power setting changed for this interface
209 * @BSS_CHANGED_P2P_PS: P2P powersave settings (CTWindow, opportunistic PS) 214 * @BSS_CHANGED_P2P_PS: P2P powersave settings (CTWindow, opportunistic PS)
210 * changed (currently only in P2P client mode, GO mode will be later) 215 * changed (currently only in P2P client mode, GO mode will be later)
216 * @BSS_CHANGED_DTIM_PERIOD: the DTIM period value was changed (set when
217 * it becomes valid, managed mode only)
218 * @BSS_CHANGED_BANDWIDTH: The bandwidth used by this interface changed,
219 * note that this is only called when it changes after the channel
220 * context had been assigned.
211 */ 221 */
212enum ieee80211_bss_change { 222enum ieee80211_bss_change {
213 BSS_CHANGED_ASSOC = 1<<0, 223 BSS_CHANGED_ASSOC = 1<<0,
@@ -230,6 +240,8 @@ enum ieee80211_bss_change {
230 BSS_CHANGED_PS = 1<<17, 240 BSS_CHANGED_PS = 1<<17,
231 BSS_CHANGED_TXPOWER = 1<<18, 241 BSS_CHANGED_TXPOWER = 1<<18,
232 BSS_CHANGED_P2P_PS = 1<<19, 242 BSS_CHANGED_P2P_PS = 1<<19,
243 BSS_CHANGED_DTIM_PERIOD = 1<<20,
244 BSS_CHANGED_BANDWIDTH = 1<<21,
233 245
234 /* when adding here, make sure to change ieee80211_reconfig */ 246 /* when adding here, make sure to change ieee80211_reconfig */
235}; 247};
@@ -271,13 +283,19 @@ enum ieee80211_rssi_event {
271 * if the hardware cannot handle this it must set the 283 * if the hardware cannot handle this it must set the
272 * IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE hardware flag 284 * IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE hardware flag
273 * @dtim_period: num of beacons before the next DTIM, for beaconing, 285 * @dtim_period: num of beacons before the next DTIM, for beaconing,
274 * valid in station mode only while @assoc is true and if also 286 * valid in station mode only if after the driver was notified
275 * requested by %IEEE80211_HW_NEED_DTIM_PERIOD (cf. also hw conf 287 * with the %BSS_CHANGED_DTIM_PERIOD flag, will be non-zero then.
276 * @ps_dtim_period)
277 * @sync_tsf: last beacon's/probe response's TSF timestamp (could be old 288 * @sync_tsf: last beacon's/probe response's TSF timestamp (could be old
278 * as it may have been received during scanning long ago) 289 * as it may have been received during scanning long ago). If the
290 * HW flag %IEEE80211_HW_TIMING_BEACON_ONLY is set, then this can
291 * only come from a beacon, but might not become valid until after
292 * association when a beacon is received (which is notified with the
293 * %BSS_CHANGED_DTIM flag.)
279 * @sync_device_ts: the device timestamp corresponding to the sync_tsf, 294 * @sync_device_ts: the device timestamp corresponding to the sync_tsf,
280 * the driver/device can use this to calculate synchronisation 295 * the driver/device can use this to calculate synchronisation
296 * (see @sync_tsf)
297 * @sync_dtim_count: Only valid when %IEEE80211_HW_TIMING_BEACON_ONLY
298 * is requested, see @sync_tsf/@sync_device_ts.
281 * @beacon_int: beacon interval 299 * @beacon_int: beacon interval
282 * @assoc_capability: capabilities taken from assoc resp 300 * @assoc_capability: capabilities taken from assoc resp
283 * @basic_rates: bitmap of basic rates, each bit stands for an 301 * @basic_rates: bitmap of basic rates, each bit stands for an
@@ -297,11 +315,9 @@ enum ieee80211_rssi_event {
297 * may filter ARP queries targeted for other addresses than listed here. 315 * may filter ARP queries targeted for other addresses than listed here.
298 * The driver must allow ARP queries targeted for all address listed here 316 * The driver must allow ARP queries targeted for all address listed here
299 * to pass through. An empty list implies no ARP queries need to pass. 317 * to pass through. An empty list implies no ARP queries need to pass.
300 * @arp_addr_cnt: Number of addresses currently on the list. 318 * @arp_addr_cnt: Number of addresses currently on the list. Note that this
301 * @arp_filter_enabled: Enable ARP filtering - if enabled, the hardware may 319 * may be larger than %IEEE80211_BSS_ARP_ADDR_LIST_LEN (the arp_addr_list
302 * filter ARP queries based on the @arp_addr_list, if disabled, the 320 * array size), it's up to the driver what to do in that case.
303 * hardware must not perform any ARP filtering. Note, that the filter will
304 * be enabled also in promiscuous mode.
305 * @qos: This is a QoS-enabled BSS. 321 * @qos: This is a QoS-enabled BSS.
306 * @idle: This interface is idle. There's also a global idle flag in the 322 * @idle: This interface is idle. There's also a global idle flag in the
307 * hardware config which may be more appropriate depending on what 323 * hardware config which may be more appropriate depending on what
@@ -331,6 +347,7 @@ struct ieee80211_bss_conf {
331 u16 assoc_capability; 347 u16 assoc_capability;
332 u64 sync_tsf; 348 u64 sync_tsf;
333 u32 sync_device_ts; 349 u32 sync_device_ts;
350 u8 sync_dtim_count;
334 u32 basic_rates; 351 u32 basic_rates;
335 int mcast_rate[IEEE80211_NUM_BANDS]; 352 int mcast_rate[IEEE80211_NUM_BANDS];
336 u16 ht_operation_mode; 353 u16 ht_operation_mode;
@@ -338,8 +355,7 @@ struct ieee80211_bss_conf {
338 u32 cqm_rssi_hyst; 355 u32 cqm_rssi_hyst;
339 struct cfg80211_chan_def chandef; 356 struct cfg80211_chan_def chandef;
340 __be32 arp_addr_list[IEEE80211_BSS_ARP_ADDR_LIST_LEN]; 357 __be32 arp_addr_list[IEEE80211_BSS_ARP_ADDR_LIST_LEN];
341 u8 arp_addr_cnt; 358 int arp_addr_cnt;
342 bool arp_filter_enabled;
343 bool qos; 359 bool qos;
344 bool idle; 360 bool idle;
345 bool ps; 361 bool ps;
@@ -392,6 +408,9 @@ struct ieee80211_bss_conf {
392 * @IEEE80211_TX_CTL_RATE_CTRL_PROBE: internal to mac80211, can be 408 * @IEEE80211_TX_CTL_RATE_CTRL_PROBE: internal to mac80211, can be
393 * set by rate control algorithms to indicate probe rate, will 409 * set by rate control algorithms to indicate probe rate, will
394 * be cleared for fragmented frames (except on the last fragment) 410 * be cleared for fragmented frames (except on the last fragment)
411 * @IEEE80211_TX_INTFL_OFFCHAN_TX_OK: Internal to mac80211. Used to indicate
412 * that a frame can be transmitted while the queues are stopped for
413 * off-channel operation.
395 * @IEEE80211_TX_INTFL_NEED_TXPROCESSING: completely internal to mac80211, 414 * @IEEE80211_TX_INTFL_NEED_TXPROCESSING: completely internal to mac80211,
396 * used to indicate that a pending frame requires TX processing before 415 * used to indicate that a pending frame requires TX processing before
397 * it can be sent out. 416 * it can be sent out.
@@ -409,6 +428,9 @@ struct ieee80211_bss_conf {
409 * @IEEE80211_TX_INTFL_RETRANSMISSION: This frame is being retransmitted 428 * @IEEE80211_TX_INTFL_RETRANSMISSION: This frame is being retransmitted
410 * after TX status because the destination was asleep, it must not 429 * after TX status because the destination was asleep, it must not
411 * be modified again (no seqno assignment, crypto, etc.) 430 * be modified again (no seqno assignment, crypto, etc.)
431 * @IEEE80211_TX_INTFL_MLME_CONN_TX: This frame was transmitted by the MLME
432 * code for connection establishment, this indicates that its status
433 * should kick the MLME state machine.
412 * @IEEE80211_TX_INTFL_NL80211_FRAME_TX: Frame was requested through nl80211 434 * @IEEE80211_TX_INTFL_NL80211_FRAME_TX: Frame was requested through nl80211
413 * MLME command (internal to mac80211 to figure out whether to send TX 435 * MLME command (internal to mac80211 to figure out whether to send TX
414 * status to user space) 436 * status to user space)
@@ -454,13 +476,14 @@ enum mac80211_tx_control_flags {
454 IEEE80211_TX_STAT_AMPDU = BIT(10), 476 IEEE80211_TX_STAT_AMPDU = BIT(10),
455 IEEE80211_TX_STAT_AMPDU_NO_BACK = BIT(11), 477 IEEE80211_TX_STAT_AMPDU_NO_BACK = BIT(11),
456 IEEE80211_TX_CTL_RATE_CTRL_PROBE = BIT(12), 478 IEEE80211_TX_CTL_RATE_CTRL_PROBE = BIT(12),
479 IEEE80211_TX_INTFL_OFFCHAN_TX_OK = BIT(13),
457 IEEE80211_TX_INTFL_NEED_TXPROCESSING = BIT(14), 480 IEEE80211_TX_INTFL_NEED_TXPROCESSING = BIT(14),
458 IEEE80211_TX_INTFL_RETRIED = BIT(15), 481 IEEE80211_TX_INTFL_RETRIED = BIT(15),
459 IEEE80211_TX_INTFL_DONT_ENCRYPT = BIT(16), 482 IEEE80211_TX_INTFL_DONT_ENCRYPT = BIT(16),
460 IEEE80211_TX_CTL_NO_PS_BUFFER = BIT(17), 483 IEEE80211_TX_CTL_NO_PS_BUFFER = BIT(17),
461 IEEE80211_TX_CTL_MORE_FRAMES = BIT(18), 484 IEEE80211_TX_CTL_MORE_FRAMES = BIT(18),
462 IEEE80211_TX_INTFL_RETRANSMISSION = BIT(19), 485 IEEE80211_TX_INTFL_RETRANSMISSION = BIT(19),
463 /* hole at 20, use later */ 486 IEEE80211_TX_INTFL_MLME_CONN_TX = BIT(20),
464 IEEE80211_TX_INTFL_NL80211_FRAME_TX = BIT(21), 487 IEEE80211_TX_INTFL_NL80211_FRAME_TX = BIT(21),
465 IEEE80211_TX_CTL_LDPC = BIT(22), 488 IEEE80211_TX_CTL_LDPC = BIT(22),
466 IEEE80211_TX_CTL_STBC = BIT(23) | BIT(24), 489 IEEE80211_TX_CTL_STBC = BIT(23) | BIT(24),
@@ -953,6 +976,7 @@ enum ieee80211_smps_mode {
953 * 976 *
954 * @channel: the channel to tune to 977 * @channel: the channel to tune to
955 * @channel_type: the channel (HT) type 978 * @channel_type: the channel (HT) type
979 * @radar_enabled: whether radar detection is enabled
956 * 980 *
957 * @long_frame_max_tx_count: Maximum number of transmissions for a "long" frame 981 * @long_frame_max_tx_count: Maximum number of transmissions for a "long" frame
958 * (a frame not RTS protected), called "dot11LongRetryLimit" in 802.11, 982 * (a frame not RTS protected), called "dot11LongRetryLimit" in 802.11,
@@ -979,6 +1003,7 @@ struct ieee80211_conf {
979 1003
980 struct ieee80211_channel *channel; 1004 struct ieee80211_channel *channel;
981 enum nl80211_channel_type channel_type; 1005 enum nl80211_channel_type channel_type;
1006 bool radar_enabled;
982 enum ieee80211_smps_mode smps_mode; 1007 enum ieee80211_smps_mode smps_mode;
983}; 1008};
984 1009
@@ -1059,7 +1084,7 @@ struct ieee80211_vif {
1059 u32 driver_flags; 1084 u32 driver_flags;
1060 1085
1061 /* must be last */ 1086 /* must be last */
1062 u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *)))); 1087 u8 drv_priv[0] __aligned(sizeof(void *));
1063}; 1088};
1064 1089
1065static inline bool ieee80211_vif_is_mesh(struct ieee80211_vif *vif) 1090static inline bool ieee80211_vif_is_mesh(struct ieee80211_vif *vif)
@@ -1176,6 +1201,24 @@ enum ieee80211_sta_state {
1176}; 1201};
1177 1202
1178/** 1203/**
1204 * enum ieee80211_sta_rx_bandwidth - station RX bandwidth
1205 * @IEEE80211_STA_RX_BW_20: station can only receive 20 MHz
1206 * @IEEE80211_STA_RX_BW_40: station can receive up to 40 MHz
1207 * @IEEE80211_STA_RX_BW_80: station can receive up to 80 MHz
1208 * @IEEE80211_STA_RX_BW_160: station can receive up to 160 MHz
1209 * (including 80+80 MHz)
1210 *
1211 * Implementation note: 20 must be zero to be initialized
1212 * correctly, the values must be sorted.
1213 */
1214enum ieee80211_sta_rx_bandwidth {
1215 IEEE80211_STA_RX_BW_20 = 0,
1216 IEEE80211_STA_RX_BW_40,
1217 IEEE80211_STA_RX_BW_80,
1218 IEEE80211_STA_RX_BW_160,
1219};
1220
1221/**
1179 * struct ieee80211_sta - station table entry 1222 * struct ieee80211_sta - station table entry
1180 * 1223 *
1181 * A station table entry represents a station we are possibly 1224 * A station table entry represents a station we are possibly
@@ -1197,6 +1240,12 @@ enum ieee80211_sta_state {
1197 * @uapsd_queues: bitmap of queues configured for uapsd. Only valid 1240 * @uapsd_queues: bitmap of queues configured for uapsd. Only valid
1198 * if wme is supported. 1241 * if wme is supported.
1199 * @max_sp: max Service Period. Only valid if wme is supported. 1242 * @max_sp: max Service Period. Only valid if wme is supported.
1243 * @bandwidth: current bandwidth the station can receive with
1244 * @rx_nss: in HT/VHT, the maximum number of spatial streams the
1245 * station can receive at the moment, changed by operating mode
1246 * notifications and capabilities. The value is only valid after
1247 * the station moves to associated state.
1248 * @smps_mode: current SMPS mode (off, static or dynamic)
1200 */ 1249 */
1201struct ieee80211_sta { 1250struct ieee80211_sta {
1202 u32 supp_rates[IEEE80211_NUM_BANDS]; 1251 u32 supp_rates[IEEE80211_NUM_BANDS];
@@ -1207,9 +1256,12 @@ struct ieee80211_sta {
1207 bool wme; 1256 bool wme;
1208 u8 uapsd_queues; 1257 u8 uapsd_queues;
1209 u8 max_sp; 1258 u8 max_sp;
1259 u8 rx_nss;
1260 enum ieee80211_sta_rx_bandwidth bandwidth;
1261 enum ieee80211_smps_mode smps_mode;
1210 1262
1211 /* must be last */ 1263 /* must be last */
1212 u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *)))); 1264 u8 drv_priv[0] __aligned(sizeof(void *));
1213}; 1265};
1214 1266
1215/** 1267/**
@@ -1331,9 +1383,9 @@ struct ieee80211_tx_control {
1331 * When this flag is set, signaling beacon-loss will cause an immediate 1383 * When this flag is set, signaling beacon-loss will cause an immediate
1332 * change to disassociated state. 1384 * change to disassociated state.
1333 * 1385 *
1334 * @IEEE80211_HW_NEED_DTIM_PERIOD: 1386 * @IEEE80211_HW_NEED_DTIM_BEFORE_ASSOC:
1335 * This device needs to know the DTIM period for the BSS before 1387 * This device needs to get data from beacon before association (i.e.
1336 * associating. 1388 * dtim_period).
1337 * 1389 *
1338 * @IEEE80211_HW_SUPPORTS_PER_STA_GTK: The device's crypto engine supports 1390 * @IEEE80211_HW_SUPPORTS_PER_STA_GTK: The device's crypto engine supports
1339 * per-station GTKs as used by IBSS RSN or during fast transition. If 1391 * per-station GTKs as used by IBSS RSN or during fast transition. If
@@ -1353,10 +1405,6 @@ struct ieee80211_tx_control {
1353 * setup strictly in HW. mac80211 should not attempt to do this in 1405 * setup strictly in HW. mac80211 should not attempt to do this in
1354 * software. 1406 * software.
1355 * 1407 *
1356 * @IEEE80211_HW_SCAN_WHILE_IDLE: The device can do hw scan while
1357 * being idle (i.e. mac80211 doesn't have to go idle-off during the
1358 * the scan).
1359 *
1360 * @IEEE80211_HW_WANT_MONITOR_VIF: The driver would like to be informed of 1408 * @IEEE80211_HW_WANT_MONITOR_VIF: The driver would like to be informed of
1361 * a virtual monitor interface when monitor interfaces are the only 1409 * a virtual monitor interface when monitor interfaces are the only
1362 * active interfaces. 1410 * active interfaces.
@@ -1370,9 +1418,8 @@ struct ieee80211_tx_control {
1370 * P2P Interface. This will be honoured even if more than one interface 1418 * P2P Interface. This will be honoured even if more than one interface
1371 * is supported. 1419 * is supported.
1372 * 1420 *
1373 * @IEEE80211_HW_TEARDOWN_AGGR_ON_BAR_FAIL: On this hardware TX BA session 1421 * @IEEE80211_HW_TIMING_BEACON_ONLY: Use sync timing from beacon frames
1374 * should be tear down once BAR frame will not be acked. 1422 * only, to allow getting TBTT of a DTIM beacon.
1375 *
1376 */ 1423 */
1377enum ieee80211_hw_flags { 1424enum ieee80211_hw_flags {
1378 IEEE80211_HW_HAS_RATE_CONTROL = 1<<0, 1425 IEEE80211_HW_HAS_RATE_CONTROL = 1<<0,
@@ -1382,7 +1429,7 @@ enum ieee80211_hw_flags {
1382 IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE = 1<<4, 1429 IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE = 1<<4,
1383 IEEE80211_HW_SIGNAL_UNSPEC = 1<<5, 1430 IEEE80211_HW_SIGNAL_UNSPEC = 1<<5,
1384 IEEE80211_HW_SIGNAL_DBM = 1<<6, 1431 IEEE80211_HW_SIGNAL_DBM = 1<<6,
1385 IEEE80211_HW_NEED_DTIM_PERIOD = 1<<7, 1432 IEEE80211_HW_NEED_DTIM_BEFORE_ASSOC = 1<<7,
1386 IEEE80211_HW_SPECTRUM_MGMT = 1<<8, 1433 IEEE80211_HW_SPECTRUM_MGMT = 1<<8,
1387 IEEE80211_HW_AMPDU_AGGREGATION = 1<<9, 1434 IEEE80211_HW_AMPDU_AGGREGATION = 1<<9,
1388 IEEE80211_HW_SUPPORTS_PS = 1<<10, 1435 IEEE80211_HW_SUPPORTS_PS = 1<<10,
@@ -1399,9 +1446,8 @@ enum ieee80211_hw_flags {
1399 IEEE80211_HW_SUPPORTS_PER_STA_GTK = 1<<21, 1446 IEEE80211_HW_SUPPORTS_PER_STA_GTK = 1<<21,
1400 IEEE80211_HW_AP_LINK_PS = 1<<22, 1447 IEEE80211_HW_AP_LINK_PS = 1<<22,
1401 IEEE80211_HW_TX_AMPDU_SETUP_IN_HW = 1<<23, 1448 IEEE80211_HW_TX_AMPDU_SETUP_IN_HW = 1<<23,
1402 IEEE80211_HW_SCAN_WHILE_IDLE = 1<<24,
1403 IEEE80211_HW_P2P_DEV_ADDR_FOR_INTF = 1<<25, 1449 IEEE80211_HW_P2P_DEV_ADDR_FOR_INTF = 1<<25,
1404 IEEE80211_HW_TEARDOWN_AGGR_ON_BAR_FAIL = 1<<26, 1450 IEEE80211_HW_TIMING_BEACON_ONLY = 1<<26,
1405}; 1451};
1406 1452
1407/** 1453/**
@@ -1522,6 +1568,8 @@ struct ieee80211_hw {
1522 * structure can then access it via hw->priv. Note that mac802111 drivers should 1568 * structure can then access it via hw->priv. Note that mac802111 drivers should
1523 * not use wiphy_priv() to try to get their private driver structure as this 1569 * not use wiphy_priv() to try to get their private driver structure as this
1524 * is already used internally by mac80211. 1570 * is already used internally by mac80211.
1571 *
1572 * Return: The mac80211 driver hw struct of @wiphy.
1525 */ 1573 */
1526struct ieee80211_hw *wiphy_to_ieee80211_hw(struct wiphy *wiphy); 1574struct ieee80211_hw *wiphy_to_ieee80211_hw(struct wiphy *wiphy);
1527 1575
@@ -1628,6 +1676,10 @@ void ieee80211_free_txskb(struct ieee80211_hw *hw, struct sk_buff *skb);
1628 * rekeying), it will not include a valid phase 1 key. The valid phase 1 key is 1676 * rekeying), it will not include a valid phase 1 key. The valid phase 1 key is
1629 * provided by update_tkip_key only. The trigger that makes mac80211 call this 1677 * provided by update_tkip_key only. The trigger that makes mac80211 call this
1630 * handler is software decryption with wrap around of iv16. 1678 * handler is software decryption with wrap around of iv16.
1679 *
1680 * The set_default_unicast_key() call updates the default WEP key index
1681 * configured to the hardware for WEP encryption type. This is required
1682 * for devices that support offload of data packets (e.g. ARP responses).
1631 */ 1683 */
1632 1684
1633/** 1685/**
@@ -1680,15 +1732,6 @@ void ieee80211_free_txskb(struct ieee80211_hw *hw, struct sk_buff *skb);
1680 * dynamic PS feature in stack and will just keep %IEEE80211_CONF_PS 1732 * dynamic PS feature in stack and will just keep %IEEE80211_CONF_PS
1681 * enabled whenever user has enabled powersave. 1733 * enabled whenever user has enabled powersave.
1682 * 1734 *
1683 * Some hardware need to toggle a single shared antenna between WLAN and
1684 * Bluetooth to facilitate co-existence. These types of hardware set
1685 * limitations on the use of host controlled dynamic powersave whenever there
1686 * is simultaneous WLAN and Bluetooth traffic. For these types of hardware, the
1687 * driver may request temporarily going into full power save, in order to
1688 * enable toggling the antenna between BT and WLAN. If the driver requests
1689 * disabling dynamic powersave, the @dynamic_ps_timeout value will be
1690 * temporarily set to zero until the driver re-enables dynamic powersave.
1691 *
1692 * Driver informs U-APSD client support by enabling 1735 * Driver informs U-APSD client support by enabling
1693 * %IEEE80211_HW_SUPPORTS_UAPSD flag. The mode is configured through the 1736 * %IEEE80211_HW_SUPPORTS_UAPSD flag. The mode is configured through the
1694 * uapsd paramater in conf_tx() operation. Hardware needs to send the QoS 1737 * uapsd paramater in conf_tx() operation. Hardware needs to send the QoS
@@ -2033,17 +2076,29 @@ enum ieee80211_filter_flags {
2033 * calling ieee80211_start_tx_ba_cb_irqsafe, because the peer 2076 * calling ieee80211_start_tx_ba_cb_irqsafe, because the peer
2034 * might receive the addBA frame and send a delBA right away! 2077 * might receive the addBA frame and send a delBA right away!
2035 * 2078 *
2036 * @IEEE80211_AMPDU_RX_START: start Rx aggregation 2079 * @IEEE80211_AMPDU_RX_START: start RX aggregation
2037 * @IEEE80211_AMPDU_RX_STOP: stop Rx aggregation 2080 * @IEEE80211_AMPDU_RX_STOP: stop RX aggregation
2038 * @IEEE80211_AMPDU_TX_START: start Tx aggregation 2081 * @IEEE80211_AMPDU_TX_START: start TX aggregation
2039 * @IEEE80211_AMPDU_TX_STOP: stop Tx aggregation
2040 * @IEEE80211_AMPDU_TX_OPERATIONAL: TX aggregation has become operational 2082 * @IEEE80211_AMPDU_TX_OPERATIONAL: TX aggregation has become operational
2083 * @IEEE80211_AMPDU_TX_STOP_CONT: stop TX aggregation but continue transmitting
2084 * queued packets, now unaggregated. After all packets are transmitted the
2085 * driver has to call ieee80211_stop_tx_ba_cb_irqsafe().
2086 * @IEEE80211_AMPDU_TX_STOP_FLUSH: stop TX aggregation and flush all packets,
2087 * called when the station is removed. There's no need or reason to call
2088 * ieee80211_stop_tx_ba_cb_irqsafe() in this case as mac80211 assumes the
2089 * session is gone and removes the station.
2090 * @IEEE80211_AMPDU_TX_STOP_FLUSH_CONT: called when TX aggregation is stopped
2091 * but the driver hasn't called ieee80211_stop_tx_ba_cb_irqsafe() yet and
2092 * now the connection is dropped and the station will be removed. Drivers
2093 * should clean up and drop remaining packets when this is called.
2041 */ 2094 */
2042enum ieee80211_ampdu_mlme_action { 2095enum ieee80211_ampdu_mlme_action {
2043 IEEE80211_AMPDU_RX_START, 2096 IEEE80211_AMPDU_RX_START,
2044 IEEE80211_AMPDU_RX_STOP, 2097 IEEE80211_AMPDU_RX_STOP,
2045 IEEE80211_AMPDU_TX_START, 2098 IEEE80211_AMPDU_TX_START,
2046 IEEE80211_AMPDU_TX_STOP, 2099 IEEE80211_AMPDU_TX_STOP_CONT,
2100 IEEE80211_AMPDU_TX_STOP_FLUSH,
2101 IEEE80211_AMPDU_TX_STOP_FLUSH_CONT,
2047 IEEE80211_AMPDU_TX_OPERATIONAL, 2102 IEEE80211_AMPDU_TX_OPERATIONAL,
2048}; 2103};
2049 2104
@@ -2062,16 +2117,21 @@ enum ieee80211_frame_release_type {
2062 * enum ieee80211_rate_control_changed - flags to indicate what changed 2117 * enum ieee80211_rate_control_changed - flags to indicate what changed
2063 * 2118 *
2064 * @IEEE80211_RC_BW_CHANGED: The bandwidth that can be used to transmit 2119 * @IEEE80211_RC_BW_CHANGED: The bandwidth that can be used to transmit
2065 * to this station changed. 2120 * to this station changed. The actual bandwidth is in the station
2121 * information -- for HT20/40 the IEEE80211_HT_CAP_SUP_WIDTH_20_40
2122 * flag changes, for HT and VHT the bandwidth field changes.
2066 * @IEEE80211_RC_SMPS_CHANGED: The SMPS state of the station changed. 2123 * @IEEE80211_RC_SMPS_CHANGED: The SMPS state of the station changed.
2067 * @IEEE80211_RC_SUPP_RATES_CHANGED: The supported rate set of this peer 2124 * @IEEE80211_RC_SUPP_RATES_CHANGED: The supported rate set of this peer
2068 * changed (in IBSS mode) due to discovering more information about 2125 * changed (in IBSS mode) due to discovering more information about
2069 * the peer. 2126 * the peer.
2127 * @IEEE80211_RC_NSS_CHANGED: N_SS (number of spatial streams) was changed
2128 * by the peer
2070 */ 2129 */
2071enum ieee80211_rate_control_changed { 2130enum ieee80211_rate_control_changed {
2072 IEEE80211_RC_BW_CHANGED = BIT(0), 2131 IEEE80211_RC_BW_CHANGED = BIT(0),
2073 IEEE80211_RC_SMPS_CHANGED = BIT(1), 2132 IEEE80211_RC_SMPS_CHANGED = BIT(1),
2074 IEEE80211_RC_SUPP_RATES_CHANGED = BIT(2), 2133 IEEE80211_RC_SUPP_RATES_CHANGED = BIT(2),
2134 IEEE80211_RC_NSS_CHANGED = BIT(3),
2075}; 2135};
2076 2136
2077/** 2137/**
@@ -2152,6 +2212,18 @@ enum ieee80211_rate_control_changed {
2152 * MAC address of the device going away. 2212 * MAC address of the device going away.
2153 * Hence, this callback must be implemented. It can sleep. 2213 * Hence, this callback must be implemented. It can sleep.
2154 * 2214 *
2215 * @add_interface_debugfs: Drivers can use this callback to add debugfs files
2216 * when a vif is added to mac80211. This callback and
2217 * @remove_interface_debugfs should be within a CONFIG_MAC80211_DEBUGFS
2218 * conditional. @remove_interface_debugfs must be provided for cleanup.
2219 * This callback can sleep.
2220 *
2221 * @remove_interface_debugfs: Remove the debugfs files which were added using
2222 * @add_interface_debugfs. This callback must remove all debugfs entries
2223 * that were added because mac80211 only removes interface debugfs when the
2224 * interface is destroyed, not when it is removed from the driver.
2225 * This callback can sleep.
2226 *
2155 * @config: Handler for configuration requests. IEEE 802.11 code calls this 2227 * @config: Handler for configuration requests. IEEE 802.11 code calls this
2156 * function to change hardware configuration, e.g., channel. 2228 * function to change hardware configuration, e.g., channel.
2157 * This function should never fail but returns a negative error code 2229 * This function should never fail but returns a negative error code
@@ -2194,6 +2266,10 @@ enum ieee80211_rate_control_changed {
2194 * After rekeying was done it should (for example during resume) notify 2266 * After rekeying was done it should (for example during resume) notify
2195 * userspace of the new replay counter using ieee80211_gtk_rekey_notify(). 2267 * userspace of the new replay counter using ieee80211_gtk_rekey_notify().
2196 * 2268 *
2269 * @set_default_unicast_key: Set the default (unicast) key index, useful for
2270 * WEP when the device sends data packets autonomously, e.g. for ARP
2271 * offloading. The index can be 0-3, or -1 for unsetting it.
2272 *
2197 * @hw_scan: Ask the hardware to service the scan request, no need to start 2273 * @hw_scan: Ask the hardware to service the scan request, no need to start
2198 * the scan state machine in stack. The scan must honour the channel 2274 * the scan state machine in stack. The scan must honour the channel
2199 * configuration done by the regulatory agent in the wiphy's 2275 * configuration done by the regulatory agent in the wiphy's
@@ -2474,7 +2550,13 @@ enum ieee80211_rate_control_changed {
2474 * 2550 *
2475 * @restart_complete: Called after a call to ieee80211_restart_hw(), when the 2551 * @restart_complete: Called after a call to ieee80211_restart_hw(), when the
2476 * reconfiguration has completed. This can help the driver implement the 2552 * reconfiguration has completed. This can help the driver implement the
2477 * reconfiguration step. This callback may sleep. 2553 * reconfiguration step. Also called when reconfiguring because the
2554 * driver's resume function returned 1, as this is just like an "inline"
2555 * hardware restart. This callback may sleep.
2556 *
2557 * @ipv6_addr_change: IPv6 address assignment on the given interface changed.
2558 * Currently, this is only called for managed or P2P client interfaces.
2559 * This callback is optional; it must not sleep.
2478 */ 2560 */
2479struct ieee80211_ops { 2561struct ieee80211_ops {
2480 void (*tx)(struct ieee80211_hw *hw, 2562 void (*tx)(struct ieee80211_hw *hw,
@@ -2522,6 +2604,8 @@ struct ieee80211_ops {
2522 void (*set_rekey_data)(struct ieee80211_hw *hw, 2604 void (*set_rekey_data)(struct ieee80211_hw *hw,
2523 struct ieee80211_vif *vif, 2605 struct ieee80211_vif *vif,
2524 struct cfg80211_gtk_rekey_data *data); 2606 struct cfg80211_gtk_rekey_data *data);
2607 void (*set_default_unicast_key)(struct ieee80211_hw *hw,
2608 struct ieee80211_vif *vif, int idx);
2525 int (*hw_scan)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 2609 int (*hw_scan)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
2526 struct cfg80211_scan_request *req); 2610 struct cfg80211_scan_request *req);
2527 void (*cancel_hw_scan)(struct ieee80211_hw *hw, 2611 void (*cancel_hw_scan)(struct ieee80211_hw *hw,
@@ -2553,6 +2637,12 @@ struct ieee80211_ops {
2553 struct ieee80211_vif *vif, 2637 struct ieee80211_vif *vif,
2554 struct ieee80211_sta *sta, 2638 struct ieee80211_sta *sta,
2555 struct dentry *dir); 2639 struct dentry *dir);
2640 void (*add_interface_debugfs)(struct ieee80211_hw *hw,
2641 struct ieee80211_vif *vif,
2642 struct dentry *dir);
2643 void (*remove_interface_debugfs)(struct ieee80211_hw *hw,
2644 struct ieee80211_vif *vif,
2645 struct dentry *dir);
2556#endif 2646#endif
2557 void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 2647 void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
2558 enum sta_notify_cmd, struct ieee80211_sta *sta); 2648 enum sta_notify_cmd, struct ieee80211_sta *sta);
@@ -2606,6 +2696,7 @@ struct ieee80211_ops {
2606 int (*set_bitrate_mask)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 2696 int (*set_bitrate_mask)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
2607 const struct cfg80211_bitrate_mask *mask); 2697 const struct cfg80211_bitrate_mask *mask);
2608 void (*rssi_callback)(struct ieee80211_hw *hw, 2698 void (*rssi_callback)(struct ieee80211_hw *hw,
2699 struct ieee80211_vif *vif,
2609 enum ieee80211_rssi_event rssi_event); 2700 enum ieee80211_rssi_event rssi_event);
2610 2701
2611 void (*allow_buffered_frames)(struct ieee80211_hw *hw, 2702 void (*allow_buffered_frames)(struct ieee80211_hw *hw,
@@ -2648,6 +2739,12 @@ struct ieee80211_ops {
2648 struct ieee80211_chanctx_conf *ctx); 2739 struct ieee80211_chanctx_conf *ctx);
2649 2740
2650 void (*restart_complete)(struct ieee80211_hw *hw); 2741 void (*restart_complete)(struct ieee80211_hw *hw);
2742
2743#if IS_ENABLED(CONFIG_IPV6)
2744 void (*ipv6_addr_change)(struct ieee80211_hw *hw,
2745 struct ieee80211_vif *vif,
2746 struct inet6_dev *idev);
2747#endif
2651}; 2748};
2652 2749
2653/** 2750/**
@@ -2661,6 +2758,8 @@ struct ieee80211_ops {
2661 * 2758 *
2662 * @priv_data_len: length of private data 2759 * @priv_data_len: length of private data
2663 * @ops: callbacks for this device 2760 * @ops: callbacks for this device
2761 *
2762 * Return: A pointer to the new hardware device, or %NULL on error.
2664 */ 2763 */
2665struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len, 2764struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len,
2666 const struct ieee80211_ops *ops); 2765 const struct ieee80211_ops *ops);
@@ -2673,6 +2772,8 @@ struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len,
2673 * need to fill the contained wiphy's information. 2772 * need to fill the contained wiphy's information.
2674 * 2773 *
2675 * @hw: the device to register as returned by ieee80211_alloc_hw() 2774 * @hw: the device to register as returned by ieee80211_alloc_hw()
2775 *
2776 * Return: 0 on success. An error code otherwise.
2676 */ 2777 */
2677int ieee80211_register_hw(struct ieee80211_hw *hw); 2778int ieee80211_register_hw(struct ieee80211_hw *hw);
2678 2779
@@ -2719,6 +2820,8 @@ extern char *__ieee80211_create_tpt_led_trigger(
2719 * of the trigger so you can automatically link the LED device. 2820 * of the trigger so you can automatically link the LED device.
2720 * 2821 *
2721 * @hw: the hardware to get the LED trigger name for 2822 * @hw: the hardware to get the LED trigger name for
2823 *
2824 * Return: The name of the LED trigger. %NULL if not configured for LEDs.
2722 */ 2825 */
2723static inline char *ieee80211_get_tx_led_name(struct ieee80211_hw *hw) 2826static inline char *ieee80211_get_tx_led_name(struct ieee80211_hw *hw)
2724{ 2827{
@@ -2738,6 +2841,8 @@ static inline char *ieee80211_get_tx_led_name(struct ieee80211_hw *hw)
2738 * of the trigger so you can automatically link the LED device. 2841 * of the trigger so you can automatically link the LED device.
2739 * 2842 *
2740 * @hw: the hardware to get the LED trigger name for 2843 * @hw: the hardware to get the LED trigger name for
2844 *
2845 * Return: The name of the LED trigger. %NULL if not configured for LEDs.
2741 */ 2846 */
2742static inline char *ieee80211_get_rx_led_name(struct ieee80211_hw *hw) 2847static inline char *ieee80211_get_rx_led_name(struct ieee80211_hw *hw)
2743{ 2848{
@@ -2757,6 +2862,8 @@ static inline char *ieee80211_get_rx_led_name(struct ieee80211_hw *hw)
2757 * of the trigger so you can automatically link the LED device. 2862 * of the trigger so you can automatically link the LED device.
2758 * 2863 *
2759 * @hw: the hardware to get the LED trigger name for 2864 * @hw: the hardware to get the LED trigger name for
2865 *
2866 * Return: The name of the LED trigger. %NULL if not configured for LEDs.
2760 */ 2867 */
2761static inline char *ieee80211_get_assoc_led_name(struct ieee80211_hw *hw) 2868static inline char *ieee80211_get_assoc_led_name(struct ieee80211_hw *hw)
2762{ 2869{
@@ -2776,6 +2883,8 @@ static inline char *ieee80211_get_assoc_led_name(struct ieee80211_hw *hw)
2776 * of the trigger so you can automatically link the LED device. 2883 * of the trigger so you can automatically link the LED device.
2777 * 2884 *
2778 * @hw: the hardware to get the LED trigger name for 2885 * @hw: the hardware to get the LED trigger name for
2886 *
2887 * Return: The name of the LED trigger. %NULL if not configured for LEDs.
2779 */ 2888 */
2780static inline char *ieee80211_get_radio_led_name(struct ieee80211_hw *hw) 2889static inline char *ieee80211_get_radio_led_name(struct ieee80211_hw *hw)
2781{ 2890{
@@ -2793,9 +2902,10 @@ static inline char *ieee80211_get_radio_led_name(struct ieee80211_hw *hw)
2793 * @blink_table: the blink table -- needs to be ordered by throughput 2902 * @blink_table: the blink table -- needs to be ordered by throughput
2794 * @blink_table_len: size of the blink table 2903 * @blink_table_len: size of the blink table
2795 * 2904 *
2796 * This function returns %NULL (in case of error, or if no LED 2905 * Return: %NULL (in case of error, or if no LED triggers are
2797 * triggers are configured) or the name of the new trigger. 2906 * configured) or the name of the new trigger.
2798 * This function must be called before ieee80211_register_hw(). 2907 *
2908 * Note: This function must be called before ieee80211_register_hw().
2799 */ 2909 */
2800static inline char * 2910static inline char *
2801ieee80211_create_tpt_led_trigger(struct ieee80211_hw *hw, unsigned int flags, 2911ieee80211_create_tpt_led_trigger(struct ieee80211_hw *hw, unsigned int flags,
@@ -2928,10 +3038,10 @@ static inline void ieee80211_rx_ni(struct ieee80211_hw *hw,
2928 * Calls to this function for a single hardware must be synchronized against 3038 * Calls to this function for a single hardware must be synchronized against
2929 * each other. 3039 * each other.
2930 * 3040 *
2931 * The function returns -EINVAL when the requested PS mode is already set.
2932 *
2933 * @sta: currently connected sta 3041 * @sta: currently connected sta
2934 * @start: start or stop PS 3042 * @start: start or stop PS
3043 *
3044 * Return: 0 on success. -EINVAL when the requested PS mode is already set.
2935 */ 3045 */
2936int ieee80211_sta_ps_transition(struct ieee80211_sta *sta, bool start); 3046int ieee80211_sta_ps_transition(struct ieee80211_sta *sta, bool start);
2937 3047
@@ -2945,6 +3055,8 @@ int ieee80211_sta_ps_transition(struct ieee80211_sta *sta, bool start);
2945 * 3055 *
2946 * @sta: currently connected sta 3056 * @sta: currently connected sta
2947 * @start: start or stop PS 3057 * @start: start or stop PS
3058 *
3059 * Return: Like ieee80211_sta_ps_transition().
2948 */ 3060 */
2949static inline int ieee80211_sta_ps_transition_ni(struct ieee80211_sta *sta, 3061static inline int ieee80211_sta_ps_transition_ni(struct ieee80211_sta *sta,
2950 bool start) 3062 bool start)
@@ -3082,6 +3194,8 @@ void ieee80211_report_low_ack(struct ieee80211_sta *sta, u32 num_packets);
3082 * according to the current DTIM parameters/TIM bitmap. 3194 * according to the current DTIM parameters/TIM bitmap.
3083 * 3195 *
3084 * The driver is responsible for freeing the returned skb. 3196 * The driver is responsible for freeing the returned skb.
3197 *
3198 * Return: The beacon template. %NULL on error.
3085 */ 3199 */
3086struct sk_buff *ieee80211_beacon_get_tim(struct ieee80211_hw *hw, 3200struct sk_buff *ieee80211_beacon_get_tim(struct ieee80211_hw *hw,
3087 struct ieee80211_vif *vif, 3201 struct ieee80211_vif *vif,
@@ -3093,6 +3207,8 @@ struct sk_buff *ieee80211_beacon_get_tim(struct ieee80211_hw *hw,
3093 * @vif: &struct ieee80211_vif pointer from the add_interface callback. 3207 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
3094 * 3208 *
3095 * See ieee80211_beacon_get_tim(). 3209 * See ieee80211_beacon_get_tim().
3210 *
3211 * Return: See ieee80211_beacon_get_tim().
3096 */ 3212 */
3097static inline struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, 3213static inline struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw,
3098 struct ieee80211_vif *vif) 3214 struct ieee80211_vif *vif)
@@ -3109,6 +3225,8 @@ static inline struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw,
3109 * hardware. The destination address should be set by the caller. 3225 * hardware. The destination address should be set by the caller.
3110 * 3226 *
3111 * Can only be called in AP mode. 3227 * Can only be called in AP mode.
3228 *
3229 * Return: The Probe Response template. %NULL on error.
3112 */ 3230 */
3113struct sk_buff *ieee80211_proberesp_get(struct ieee80211_hw *hw, 3231struct sk_buff *ieee80211_proberesp_get(struct ieee80211_hw *hw,
3114 struct ieee80211_vif *vif); 3232 struct ieee80211_vif *vif);
@@ -3124,6 +3242,8 @@ struct sk_buff *ieee80211_proberesp_get(struct ieee80211_hw *hw,
3124 * 3242 *
3125 * Note: Caller (or hardware) is responsible for setting the 3243 * Note: Caller (or hardware) is responsible for setting the
3126 * &IEEE80211_FCTL_PM bit. 3244 * &IEEE80211_FCTL_PM bit.
3245 *
3246 * Return: The PS Poll template. %NULL on error.
3127 */ 3247 */
3128struct sk_buff *ieee80211_pspoll_get(struct ieee80211_hw *hw, 3248struct sk_buff *ieee80211_pspoll_get(struct ieee80211_hw *hw,
3129 struct ieee80211_vif *vif); 3249 struct ieee80211_vif *vif);
@@ -3139,6 +3259,8 @@ struct sk_buff *ieee80211_pspoll_get(struct ieee80211_hw *hw,
3139 * 3259 *
3140 * Note: Caller (or hardware) is responsible for setting the 3260 * Note: Caller (or hardware) is responsible for setting the
3141 * &IEEE80211_FCTL_PM bit as well as Duration and Sequence Control fields. 3261 * &IEEE80211_FCTL_PM bit as well as Duration and Sequence Control fields.
3262 *
3263 * Return: The nullfunc template. %NULL on error.
3142 */ 3264 */
3143struct sk_buff *ieee80211_nullfunc_get(struct ieee80211_hw *hw, 3265struct sk_buff *ieee80211_nullfunc_get(struct ieee80211_hw *hw,
3144 struct ieee80211_vif *vif); 3266 struct ieee80211_vif *vif);
@@ -3153,6 +3275,8 @@ struct sk_buff *ieee80211_nullfunc_get(struct ieee80211_hw *hw,
3153 * 3275 *
3154 * Creates a Probe Request template which can, for example, be uploaded to 3276 * Creates a Probe Request template which can, for example, be uploaded to
3155 * hardware. 3277 * hardware.
3278 *
3279 * Return: The Probe Request template. %NULL on error.
3156 */ 3280 */
3157struct sk_buff *ieee80211_probereq_get(struct ieee80211_hw *hw, 3281struct sk_buff *ieee80211_probereq_get(struct ieee80211_hw *hw,
3158 struct ieee80211_vif *vif, 3282 struct ieee80211_vif *vif,
@@ -3188,6 +3312,8 @@ void ieee80211_rts_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
3188 * If the RTS is generated in firmware, but the host system must provide 3312 * If the RTS is generated in firmware, but the host system must provide
3189 * the duration field, the low-level driver uses this function to receive 3313 * the duration field, the low-level driver uses this function to receive
3190 * the duration field value in little-endian byteorder. 3314 * the duration field value in little-endian byteorder.
3315 *
3316 * Return: The duration.
3191 */ 3317 */
3192__le16 ieee80211_rts_duration(struct ieee80211_hw *hw, 3318__le16 ieee80211_rts_duration(struct ieee80211_hw *hw,
3193 struct ieee80211_vif *vif, size_t frame_len, 3319 struct ieee80211_vif *vif, size_t frame_len,
@@ -3223,6 +3349,8 @@ void ieee80211_ctstoself_get(struct ieee80211_hw *hw,
3223 * If the CTS-to-self is generated in firmware, but the host system must provide 3349 * If the CTS-to-self is generated in firmware, but the host system must provide
3224 * the duration field, the low-level driver uses this function to receive 3350 * the duration field, the low-level driver uses this function to receive
3225 * the duration field value in little-endian byteorder. 3351 * the duration field value in little-endian byteorder.
3352 *
3353 * Return: The duration.
3226 */ 3354 */
3227__le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw, 3355__le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw,
3228 struct ieee80211_vif *vif, 3356 struct ieee80211_vif *vif,
@@ -3239,6 +3367,8 @@ __le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw,
3239 * 3367 *
3240 * Calculate the duration field of some generic frame, given its 3368 * Calculate the duration field of some generic frame, given its
3241 * length and transmission rate (in 100kbps). 3369 * length and transmission rate (in 100kbps).
3370 *
3371 * Return: The duration.
3242 */ 3372 */
3243__le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw, 3373__le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw,
3244 struct ieee80211_vif *vif, 3374 struct ieee80211_vif *vif,
@@ -3255,9 +3385,10 @@ __le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw,
3255 * hardware/firmware does not implement buffering of broadcast/multicast 3385 * hardware/firmware does not implement buffering of broadcast/multicast
3256 * frames when power saving is used, 802.11 code buffers them in the host 3386 * frames when power saving is used, 802.11 code buffers them in the host
3257 * memory. The low-level driver uses this function to fetch next buffered 3387 * memory. The low-level driver uses this function to fetch next buffered
3258 * frame. In most cases, this is used when generating beacon frame. This 3388 * frame. In most cases, this is used when generating beacon frame.
3259 * function returns a pointer to the next buffered skb or NULL if no more 3389 *
3260 * buffered frames are available. 3390 * Return: A pointer to the next buffered skb or NULL if no more buffered
3391 * frames are available.
3261 * 3392 *
3262 * Note: buffered frames are returned only after DTIM beacon frame was 3393 * Note: buffered frames are returned only after DTIM beacon frame was
3263 * generated with ieee80211_beacon_get() and the low-level driver must thus 3394 * generated with ieee80211_beacon_get() and the low-level driver must thus
@@ -3437,6 +3568,8 @@ void ieee80211_stop_queue(struct ieee80211_hw *hw, int queue);
3437 * @queue: queue number (counted from zero). 3568 * @queue: queue number (counted from zero).
3438 * 3569 *
3439 * Drivers should use this function instead of netif_stop_queue. 3570 * Drivers should use this function instead of netif_stop_queue.
3571 *
3572 * Return: %true if the queue is stopped. %false otherwise.
3440 */ 3573 */
3441 3574
3442int ieee80211_queue_stopped(struct ieee80211_hw *hw, int queue); 3575int ieee80211_queue_stopped(struct ieee80211_hw *hw, int queue);
@@ -3634,7 +3767,9 @@ void ieee80211_stop_tx_ba_cb_irqsafe(struct ieee80211_vif *vif, const u8 *ra,
3634 * @vif: virtual interface to look for station on 3767 * @vif: virtual interface to look for station on
3635 * @addr: station's address 3768 * @addr: station's address
3636 * 3769 *
3637 * This function must be called under RCU lock and the 3770 * Return: The station, if found. %NULL otherwise.
3771 *
3772 * Note: This function must be called under RCU lock and the
3638 * resulting pointer is only valid under RCU lock as well. 3773 * resulting pointer is only valid under RCU lock as well.
3639 */ 3774 */
3640struct ieee80211_sta *ieee80211_find_sta(struct ieee80211_vif *vif, 3775struct ieee80211_sta *ieee80211_find_sta(struct ieee80211_vif *vif,
@@ -3647,7 +3782,9 @@ struct ieee80211_sta *ieee80211_find_sta(struct ieee80211_vif *vif,
3647 * @addr: remote station's address 3782 * @addr: remote station's address
3648 * @localaddr: local address (vif->sdata->vif.addr). Use NULL for 'any'. 3783 * @localaddr: local address (vif->sdata->vif.addr). Use NULL for 'any'.
3649 * 3784 *
3650 * This function must be called under RCU lock and the 3785 * Return: The station, if found. %NULL otherwise.
3786 *
3787 * Note: This function must be called under RCU lock and the
3651 * resulting pointer is only valid under RCU lock as well. 3788 * resulting pointer is only valid under RCU lock as well.
3652 * 3789 *
3653 * NOTE: You may pass NULL for localaddr, but then you will just get 3790 * NOTE: You may pass NULL for localaddr, but then you will just get
@@ -3754,6 +3891,11 @@ void ieee80211_iter_keys(struct ieee80211_hw *hw,
3754 * The iterator will not find a context that's being added (during 3891 * The iterator will not find a context that's being added (during
3755 * the driver callback to add it) but will find it while it's being 3892 * the driver callback to add it) but will find it while it's being
3756 * removed. 3893 * removed.
3894 *
3895 * Note that during hardware restart, all contexts that existed
3896 * before the restart are considered already present so will be
3897 * found while iterating, whether they've been re-added already
3898 * or not.
3757 */ 3899 */
3758void ieee80211_iter_chan_contexts_atomic( 3900void ieee80211_iter_chan_contexts_atomic(
3759 struct ieee80211_hw *hw, 3901 struct ieee80211_hw *hw,
@@ -3772,7 +3914,9 @@ void ieee80211_iter_chan_contexts_atomic(
3772 * information. This function must only be called from within the 3914 * information. This function must only be called from within the
3773 * .bss_info_changed callback function and only in managed mode. The function 3915 * .bss_info_changed callback function and only in managed mode. The function
3774 * is only useful when the interface is associated, otherwise it will return 3916 * is only useful when the interface is associated, otherwise it will return
3775 * NULL. 3917 * %NULL.
3918 *
3919 * Return: The Probe Request template. %NULL on error.
3776 */ 3920 */
3777struct sk_buff *ieee80211_ap_probereq_get(struct ieee80211_hw *hw, 3921struct sk_buff *ieee80211_ap_probereq_get(struct ieee80211_hw *hw,
3778 struct ieee80211_vif *vif); 3922 struct ieee80211_vif *vif);
@@ -3796,6 +3940,8 @@ void ieee80211_beacon_loss(struct ieee80211_vif *vif);
3796 * When beacon filtering is enabled with %IEEE80211_VIF_BEACON_FILTER, and 3940 * When beacon filtering is enabled with %IEEE80211_VIF_BEACON_FILTER, and
3797 * %IEEE80211_CONF_PS and %IEEE80211_HW_CONNECTION_MONITOR are set, the driver 3941 * %IEEE80211_CONF_PS and %IEEE80211_HW_CONNECTION_MONITOR are set, the driver
3798 * needs to inform if the connection to the AP has been lost. 3942 * needs to inform if the connection to the AP has been lost.
3943 * The function may also be called if the connection needs to be terminated
3944 * for some other reason, even if %IEEE80211_HW_CONNECTION_MONITOR isn't set.
3799 * 3945 *
3800 * This function will cause immediate change to disassociated state, 3946 * This function will cause immediate change to disassociated state,
3801 * without connection recovery attempts. 3947 * without connection recovery attempts.
@@ -3826,36 +3972,6 @@ void ieee80211_connection_loss(struct ieee80211_vif *vif);
3826void ieee80211_resume_disconnect(struct ieee80211_vif *vif); 3972void ieee80211_resume_disconnect(struct ieee80211_vif *vif);
3827 3973
3828/** 3974/**
3829 * ieee80211_disable_dyn_ps - force mac80211 to temporarily disable dynamic psm
3830 *
3831 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
3832 *
3833 * Some hardware require full power save to manage simultaneous BT traffic
3834 * on the WLAN frequency. Full PSM is required periodically, whenever there are
3835 * burst of BT traffic. The hardware gets information of BT traffic via
3836 * hardware co-existence lines, and consequentially requests mac80211 to
3837 * (temporarily) enter full psm.
3838 * This function will only temporarily disable dynamic PS, not enable PSM if
3839 * it was not already enabled.
3840 * The driver must make sure to re-enable dynamic PS using
3841 * ieee80211_enable_dyn_ps() if the driver has disabled it.
3842 *
3843 */
3844void ieee80211_disable_dyn_ps(struct ieee80211_vif *vif);
3845
3846/**
3847 * ieee80211_enable_dyn_ps - restore dynamic psm after being disabled
3848 *
3849 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
3850 *
3851 * This function restores dynamic PS after being temporarily disabled via
3852 * ieee80211_disable_dyn_ps(). Each ieee80211_disable_dyn_ps() call must
3853 * be coupled with an eventual call to this function.
3854 *
3855 */
3856void ieee80211_enable_dyn_ps(struct ieee80211_vif *vif);
3857
3858/**
3859 * ieee80211_cqm_rssi_notify - inform a configured connection quality monitoring 3975 * ieee80211_cqm_rssi_notify - inform a configured connection quality monitoring
3860 * rssi threshold triggered 3976 * rssi threshold triggered
3861 * 3977 *
@@ -3872,6 +3988,13 @@ void ieee80211_cqm_rssi_notify(struct ieee80211_vif *vif,
3872 gfp_t gfp); 3988 gfp_t gfp);
3873 3989
3874/** 3990/**
3991 * ieee80211_radar_detected - inform that a radar was detected
3992 *
3993 * @hw: pointer as obtained from ieee80211_alloc_hw()
3994 */
3995void ieee80211_radar_detected(struct ieee80211_hw *hw);
3996
3997/**
3875 * ieee80211_chswitch_done - Complete channel switch process 3998 * ieee80211_chswitch_done - Complete channel switch process
3876 * @vif: &struct ieee80211_vif pointer from the add_interface callback. 3999 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
3877 * @success: make the channel switch successful or not 4000 * @success: make the channel switch successful or not
@@ -4119,13 +4242,27 @@ void ieee80211_enable_rssi_reports(struct ieee80211_vif *vif,
4119void ieee80211_disable_rssi_reports(struct ieee80211_vif *vif); 4242void ieee80211_disable_rssi_reports(struct ieee80211_vif *vif);
4120 4243
4121/** 4244/**
4122 * ieee80211_ave_rssi - report the average rssi for the specified interface 4245 * ieee80211_ave_rssi - report the average RSSI for the specified interface
4123 * 4246 *
4124 * @vif: the specified virtual interface 4247 * @vif: the specified virtual interface
4125 * 4248 *
4126 * This function return the average rssi value for the requested interface. 4249 * Note: This function assumes that the given vif is valid.
4127 * It assumes that the given vif is valid. 4250 *
4251 * Return: The average RSSI value for the requested interface, or 0 if not
4252 * applicable.
4128 */ 4253 */
4129int ieee80211_ave_rssi(struct ieee80211_vif *vif); 4254int ieee80211_ave_rssi(struct ieee80211_vif *vif);
4130 4255
4256/**
4257 * ieee80211_report_wowlan_wakeup - report WoWLAN wakeup
4258 * @vif: virtual interface
4259 * @wakeup: wakeup reason(s)
4260 * @gfp: allocation flags
4261 *
4262 * See cfg80211_report_wowlan_wakeup().
4263 */
4264void ieee80211_report_wowlan_wakeup(struct ieee80211_vif *vif,
4265 struct cfg80211_wowlan_wakeup *wakeup,
4266 gfp_t gfp);
4267
4131#endif /* MAC80211_H */ 4268#endif /* MAC80211_H */
diff --git a/include/net/mrp.h b/include/net/mrp.h
new file mode 100644
index 000000000000..4fbf02aa2ec1
--- /dev/null
+++ b/include/net/mrp.h
@@ -0,0 +1,143 @@
1#ifndef _NET_MRP_H
2#define _NET_MRP_H
3
4#define MRP_END_MARK 0x0
5
6struct mrp_pdu_hdr {
7 u8 version;
8};
9
10struct mrp_msg_hdr {
11 u8 attrtype;
12 u8 attrlen;
13};
14
15struct mrp_vecattr_hdr {
16 __be16 lenflags;
17 unsigned char firstattrvalue[];
18#define MRP_VECATTR_HDR_LEN_MASK cpu_to_be16(0x1FFF)
19#define MRP_VECATTR_HDR_FLAG_LA cpu_to_be16(0x2000)
20};
21
22enum mrp_vecattr_event {
23 MRP_VECATTR_EVENT_NEW,
24 MRP_VECATTR_EVENT_JOIN_IN,
25 MRP_VECATTR_EVENT_IN,
26 MRP_VECATTR_EVENT_JOIN_MT,
27 MRP_VECATTR_EVENT_MT,
28 MRP_VECATTR_EVENT_LV,
29 __MRP_VECATTR_EVENT_MAX
30};
31
32struct mrp_skb_cb {
33 struct mrp_msg_hdr *mh;
34 struct mrp_vecattr_hdr *vah;
35 unsigned char attrvalue[];
36};
37
38static inline struct mrp_skb_cb *mrp_cb(struct sk_buff *skb)
39{
40 BUILD_BUG_ON(sizeof(struct mrp_skb_cb) >
41 FIELD_SIZEOF(struct sk_buff, cb));
42 return (struct mrp_skb_cb *)skb->cb;
43}
44
45enum mrp_applicant_state {
46 MRP_APPLICANT_INVALID,
47 MRP_APPLICANT_VO,
48 MRP_APPLICANT_VP,
49 MRP_APPLICANT_VN,
50 MRP_APPLICANT_AN,
51 MRP_APPLICANT_AA,
52 MRP_APPLICANT_QA,
53 MRP_APPLICANT_LA,
54 MRP_APPLICANT_AO,
55 MRP_APPLICANT_QO,
56 MRP_APPLICANT_AP,
57 MRP_APPLICANT_QP,
58 __MRP_APPLICANT_MAX
59};
60#define MRP_APPLICANT_MAX (__MRP_APPLICANT_MAX - 1)
61
62enum mrp_event {
63 MRP_EVENT_NEW,
64 MRP_EVENT_JOIN,
65 MRP_EVENT_LV,
66 MRP_EVENT_TX,
67 MRP_EVENT_R_NEW,
68 MRP_EVENT_R_JOIN_IN,
69 MRP_EVENT_R_IN,
70 MRP_EVENT_R_JOIN_MT,
71 MRP_EVENT_R_MT,
72 MRP_EVENT_R_LV,
73 MRP_EVENT_R_LA,
74 MRP_EVENT_REDECLARE,
75 MRP_EVENT_PERIODIC,
76 __MRP_EVENT_MAX
77};
78#define MRP_EVENT_MAX (__MRP_EVENT_MAX - 1)
79
80enum mrp_tx_action {
81 MRP_TX_ACTION_NONE,
82 MRP_TX_ACTION_S_NEW,
83 MRP_TX_ACTION_S_JOIN_IN,
84 MRP_TX_ACTION_S_JOIN_IN_OPTIONAL,
85 MRP_TX_ACTION_S_IN_OPTIONAL,
86 MRP_TX_ACTION_S_LV,
87};
88
89struct mrp_attr {
90 struct rb_node node;
91 enum mrp_applicant_state state;
92 u8 type;
93 u8 len;
94 unsigned char value[];
95};
96
97enum mrp_applications {
98 MRP_APPLICATION_MVRP,
99 __MRP_APPLICATION_MAX
100};
101#define MRP_APPLICATION_MAX (__MRP_APPLICATION_MAX - 1)
102
103struct mrp_application {
104 enum mrp_applications type;
105 unsigned int maxattr;
106 struct packet_type pkttype;
107 unsigned char group_address[ETH_ALEN];
108 u8 version;
109};
110
111struct mrp_applicant {
112 struct mrp_application *app;
113 struct net_device *dev;
114 struct timer_list join_timer;
115
116 spinlock_t lock;
117 struct sk_buff_head queue;
118 struct sk_buff *pdu;
119 struct rb_root mad;
120 struct rcu_head rcu;
121};
122
123struct mrp_port {
124 struct mrp_applicant __rcu *applicants[MRP_APPLICATION_MAX + 1];
125 struct rcu_head rcu;
126};
127
128extern int mrp_register_application(struct mrp_application *app);
129extern void mrp_unregister_application(struct mrp_application *app);
130
131extern int mrp_init_applicant(struct net_device *dev,
132 struct mrp_application *app);
133extern void mrp_uninit_applicant(struct net_device *dev,
134 struct mrp_application *app);
135
136extern int mrp_request_join(const struct net_device *dev,
137 const struct mrp_application *app,
138 const void *value, u8 len, u8 type);
139extern void mrp_request_leave(const struct net_device *dev,
140 const struct mrp_application *app,
141 const void *value, u8 len, u8 type);
142
143#endif /* _NET_MRP_H */
diff --git a/include/net/ndisc.h b/include/net/ndisc.h
index 23b3a7c58783..745bf741e029 100644
--- a/include/net/ndisc.h
+++ b/include/net/ndisc.h
@@ -127,13 +127,19 @@ static int ndisc_addr_option_pad(unsigned short type)
127 } 127 }
128} 128}
129 129
130static inline int ndisc_opt_addr_space(struct net_device *dev)
131{
132 return NDISC_OPT_SPACE(dev->addr_len +
133 ndisc_addr_option_pad(dev->type));
134}
135
130static inline u8 *ndisc_opt_addr_data(struct nd_opt_hdr *p, 136static inline u8 *ndisc_opt_addr_data(struct nd_opt_hdr *p,
131 struct net_device *dev) 137 struct net_device *dev)
132{ 138{
133 u8 *lladdr = (u8 *)(p + 1); 139 u8 *lladdr = (u8 *)(p + 1);
134 int lladdrlen = p->nd_opt_len << 3; 140 int lladdrlen = p->nd_opt_len << 3;
135 int prepad = ndisc_addr_option_pad(dev->type); 141 int prepad = ndisc_addr_option_pad(dev->type);
136 if (lladdrlen != NDISC_OPT_SPACE(dev->addr_len + prepad)) 142 if (lladdrlen != ndisc_opt_addr_space(dev))
137 return NULL; 143 return NULL;
138 return lladdr + prepad; 144 return lladdr + prepad;
139} 145}
@@ -148,15 +154,14 @@ static inline u32 ndisc_hashfn(const void *pkey, const struct net_device *dev, _
148 (p32[3] * hash_rnd[3])); 154 (p32[3] * hash_rnd[3]));
149} 155}
150 156
151static inline struct neighbour *__ipv6_neigh_lookup(struct neigh_table *tbl, struct net_device *dev, const void *pkey) 157static inline struct neighbour *__ipv6_neigh_lookup_noref(struct net_device *dev, const void *pkey)
152{ 158{
153 struct neigh_hash_table *nht; 159 struct neigh_hash_table *nht;
154 const u32 *p32 = pkey; 160 const u32 *p32 = pkey;
155 struct neighbour *n; 161 struct neighbour *n;
156 u32 hash_val; 162 u32 hash_val;
157 163
158 rcu_read_lock_bh(); 164 nht = rcu_dereference_bh(nd_tbl.nht);
159 nht = rcu_dereference_bh(tbl->nht);
160 hash_val = ndisc_hashfn(pkey, dev, nht->hash_rnd) >> (32 - nht->hash_shift); 165 hash_val = ndisc_hashfn(pkey, dev, nht->hash_rnd) >> (32 - nht->hash_shift);
161 for (n = rcu_dereference_bh(nht->hash_buckets[hash_val]); 166 for (n = rcu_dereference_bh(nht->hash_buckets[hash_val]);
162 n != NULL; 167 n != NULL;
@@ -164,12 +169,21 @@ static inline struct neighbour *__ipv6_neigh_lookup(struct neigh_table *tbl, str
164 u32 *n32 = (u32 *) n->primary_key; 169 u32 *n32 = (u32 *) n->primary_key;
165 if (n->dev == dev && 170 if (n->dev == dev &&
166 ((n32[0] ^ p32[0]) | (n32[1] ^ p32[1]) | 171 ((n32[0] ^ p32[0]) | (n32[1] ^ p32[1]) |
167 (n32[2] ^ p32[2]) | (n32[3] ^ p32[3])) == 0) { 172 (n32[2] ^ p32[2]) | (n32[3] ^ p32[3])) == 0)
168 if (!atomic_inc_not_zero(&n->refcnt)) 173 return n;
169 n = NULL;
170 break;
171 }
172 } 174 }
175
176 return NULL;
177}
178
179static inline struct neighbour *__ipv6_neigh_lookup(struct net_device *dev, const void *pkey)
180{
181 struct neighbour *n;
182
183 rcu_read_lock_bh();
184 n = __ipv6_neigh_lookup_noref(dev, pkey);
185 if (n && !atomic_inc_not_zero(&n->refcnt))
186 n = NULL;
173 rcu_read_unlock_bh(); 187 rcu_read_unlock_bh();
174 188
175 return n; 189 return n;
diff --git a/include/net/neighbour.h b/include/net/neighbour.h
index 0dab173e27da..7e748ad8b50c 100644
--- a/include/net/neighbour.h
+++ b/include/net/neighbour.h
@@ -181,10 +181,11 @@ struct neigh_table {
181}; 181};
182 182
183#define NEIGH_PRIV_ALIGN sizeof(long long) 183#define NEIGH_PRIV_ALIGN sizeof(long long)
184#define NEIGH_ENTRY_SIZE(size) ALIGN((size), NEIGH_PRIV_ALIGN)
184 185
185static inline void *neighbour_priv(const struct neighbour *n) 186static inline void *neighbour_priv(const struct neighbour *n)
186{ 187{
187 return (char *)n + ALIGN(sizeof(*n) + n->tbl->key_len, NEIGH_PRIV_ALIGN); 188 return (char *)n + n->tbl->entry_size;
188} 189}
189 190
190/* flags for neigh_update() */ 191/* flags for neigh_update() */
diff --git a/include/net/netevent.h b/include/net/netevent.h
index 3ce4988c9c08..fe630dde35c3 100644
--- a/include/net/netevent.h
+++ b/include/net/netevent.h
@@ -16,9 +16,8 @@ struct neighbour;
16 16
17struct netevent_redirect { 17struct netevent_redirect {
18 struct dst_entry *old; 18 struct dst_entry *old;
19 struct neighbour *old_neigh;
20 struct dst_entry *new; 19 struct dst_entry *new;
21 struct neighbour *new_neigh; 20 struct neighbour *neigh;
22 const void *daddr; 21 const void *daddr;
23}; 22};
24 23
diff --git a/include/net/netfilter/nf_conntrack_acct.h b/include/net/netfilter/nf_conntrack_acct.h
index 463ae8e16696..2bdb7a15fe06 100644
--- a/include/net/netfilter/nf_conntrack_acct.h
+++ b/include/net/netfilter/nf_conntrack_acct.h
@@ -57,7 +57,9 @@ static inline void nf_ct_set_acct(struct net *net, bool enable)
57 net->ct.sysctl_acct = enable; 57 net->ct.sysctl_acct = enable;
58} 58}
59 59
60extern int nf_conntrack_acct_init(struct net *net); 60extern int nf_conntrack_acct_pernet_init(struct net *net);
61extern void nf_conntrack_acct_fini(struct net *net); 61extern void nf_conntrack_acct_pernet_fini(struct net *net);
62 62
63extern int nf_conntrack_acct_init(void);
64extern void nf_conntrack_acct_fini(void);
63#endif /* _NF_CONNTRACK_ACCT_H */ 65#endif /* _NF_CONNTRACK_ACCT_H */
diff --git a/include/net/netfilter/nf_conntrack_core.h b/include/net/netfilter/nf_conntrack_core.h
index d8f5b9f52169..930275fa2ea6 100644
--- a/include/net/netfilter/nf_conntrack_core.h
+++ b/include/net/netfilter/nf_conntrack_core.h
@@ -25,11 +25,20 @@ extern unsigned int nf_conntrack_in(struct net *net,
25 unsigned int hooknum, 25 unsigned int hooknum,
26 struct sk_buff *skb); 26 struct sk_buff *skb);
27 27
28extern int nf_conntrack_init(struct net *net); 28extern int nf_conntrack_init_net(struct net *net);
29extern void nf_conntrack_cleanup(struct net *net); 29extern void nf_conntrack_cleanup_net(struct net *net);
30 30
31extern int nf_conntrack_proto_init(struct net *net); 31extern int nf_conntrack_proto_pernet_init(struct net *net);
32extern void nf_conntrack_proto_fini(struct net *net); 32extern void nf_conntrack_proto_pernet_fini(struct net *net);
33
34extern int nf_conntrack_proto_init(void);
35extern void nf_conntrack_proto_fini(void);
36
37extern int nf_conntrack_init_start(void);
38extern void nf_conntrack_cleanup_start(void);
39
40extern void nf_conntrack_init_end(void);
41extern void nf_conntrack_cleanup_end(void);
33 42
34extern bool 43extern bool
35nf_ct_get_tuple(const struct sk_buff *skb, 44nf_ct_get_tuple(const struct sk_buff *skb,
diff --git a/include/net/netfilter/nf_conntrack_ecache.h b/include/net/netfilter/nf_conntrack_ecache.h
index 5654d292efd4..092dc651689f 100644
--- a/include/net/netfilter/nf_conntrack_ecache.h
+++ b/include/net/netfilter/nf_conntrack_ecache.h
@@ -207,9 +207,11 @@ nf_ct_expect_event(enum ip_conntrack_expect_events event,
207 nf_ct_expect_event_report(event, exp, 0, 0); 207 nf_ct_expect_event_report(event, exp, 0, 0);
208} 208}
209 209
210extern int nf_conntrack_ecache_init(struct net *net); 210extern int nf_conntrack_ecache_pernet_init(struct net *net);
211extern void nf_conntrack_ecache_fini(struct net *net); 211extern void nf_conntrack_ecache_pernet_fini(struct net *net);
212 212
213extern int nf_conntrack_ecache_init(void);
214extern void nf_conntrack_ecache_fini(void);
213#else /* CONFIG_NF_CONNTRACK_EVENTS */ 215#else /* CONFIG_NF_CONNTRACK_EVENTS */
214 216
215static inline void nf_conntrack_event_cache(enum ip_conntrack_events event, 217static inline void nf_conntrack_event_cache(enum ip_conntrack_events event,
@@ -232,12 +234,21 @@ static inline void nf_ct_expect_event_report(enum ip_conntrack_expect_events e,
232 u32 portid, 234 u32 portid,
233 int report) {} 235 int report) {}
234 236
235static inline int nf_conntrack_ecache_init(struct net *net) 237static inline int nf_conntrack_ecache_pernet_init(struct net *net)
236{ 238{
237 return 0; 239 return 0;
238} 240}
239 241
240static inline void nf_conntrack_ecache_fini(struct net *net) 242static inline void nf_conntrack_ecache_pernet_fini(struct net *net)
243{
244}
245
246static inline int nf_conntrack_ecache_init(void)
247{
248 return 0;
249}
250
251static inline void nf_conntrack_ecache_fini(void)
241{ 252{
242} 253}
243#endif /* CONFIG_NF_CONNTRACK_EVENTS */ 254#endif /* CONFIG_NF_CONNTRACK_EVENTS */
diff --git a/include/net/netfilter/nf_conntrack_expect.h b/include/net/netfilter/nf_conntrack_expect.h
index cc13f377a705..cbbae7621e22 100644
--- a/include/net/netfilter/nf_conntrack_expect.h
+++ b/include/net/netfilter/nf_conntrack_expect.h
@@ -69,8 +69,11 @@ struct nf_conntrack_expect_policy {
69 69
70#define NF_CT_EXPECT_CLASS_DEFAULT 0 70#define NF_CT_EXPECT_CLASS_DEFAULT 0
71 71
72int nf_conntrack_expect_init(struct net *net); 72int nf_conntrack_expect_pernet_init(struct net *net);
73void nf_conntrack_expect_fini(struct net *net); 73void nf_conntrack_expect_pernet_fini(struct net *net);
74
75int nf_conntrack_expect_init(void);
76void nf_conntrack_expect_fini(void);
74 77
75struct nf_conntrack_expect * 78struct nf_conntrack_expect *
76__nf_ct_expect_find(struct net *net, u16 zone, 79__nf_ct_expect_find(struct net *net, u16 zone,
diff --git a/include/net/netfilter/nf_conntrack_extend.h b/include/net/netfilter/nf_conntrack_extend.h
index 8b4d1fc29096..977bc8a46444 100644
--- a/include/net/netfilter/nf_conntrack_extend.h
+++ b/include/net/netfilter/nf_conntrack_extend.h
@@ -23,6 +23,9 @@ enum nf_ct_ext_id {
23#ifdef CONFIG_NF_CONNTRACK_TIMEOUT 23#ifdef CONFIG_NF_CONNTRACK_TIMEOUT
24 NF_CT_EXT_TIMEOUT, 24 NF_CT_EXT_TIMEOUT,
25#endif 25#endif
26#ifdef CONFIG_NF_CONNTRACK_LABELS
27 NF_CT_EXT_LABELS,
28#endif
26 NF_CT_EXT_NUM, 29 NF_CT_EXT_NUM,
27}; 30};
28 31
@@ -33,6 +36,7 @@ enum nf_ct_ext_id {
33#define NF_CT_EXT_ZONE_TYPE struct nf_conntrack_zone 36#define NF_CT_EXT_ZONE_TYPE struct nf_conntrack_zone
34#define NF_CT_EXT_TSTAMP_TYPE struct nf_conn_tstamp 37#define NF_CT_EXT_TSTAMP_TYPE struct nf_conn_tstamp
35#define NF_CT_EXT_TIMEOUT_TYPE struct nf_conn_timeout 38#define NF_CT_EXT_TIMEOUT_TYPE struct nf_conn_timeout
39#define NF_CT_EXT_LABELS_TYPE struct nf_conn_labels
36 40
37/* Extensions: optional stuff which isn't permanently in struct. */ 41/* Extensions: optional stuff which isn't permanently in struct. */
38struct nf_ct_ext { 42struct nf_ct_ext {
diff --git a/include/net/netfilter/nf_conntrack_helper.h b/include/net/netfilter/nf_conntrack_helper.h
index 9aad956d1008..26c4ae5bfbb8 100644
--- a/include/net/netfilter/nf_conntrack_helper.h
+++ b/include/net/netfilter/nf_conntrack_helper.h
@@ -82,8 +82,11 @@ static inline void *nfct_help_data(const struct nf_conn *ct)
82 return (void *)help->data; 82 return (void *)help->data;
83} 83}
84 84
85extern int nf_conntrack_helper_init(struct net *net); 85extern int nf_conntrack_helper_pernet_init(struct net *net);
86extern void nf_conntrack_helper_fini(struct net *net); 86extern void nf_conntrack_helper_pernet_fini(struct net *net);
87
88extern int nf_conntrack_helper_init(void);
89extern void nf_conntrack_helper_fini(void);
87 90
88extern int nf_conntrack_broadcast_help(struct sk_buff *skb, 91extern int nf_conntrack_broadcast_help(struct sk_buff *skb,
89 unsigned int protoff, 92 unsigned int protoff,
@@ -97,6 +100,10 @@ struct nf_ct_helper_expectfn {
97 void (*expectfn)(struct nf_conn *ct, struct nf_conntrack_expect *exp); 100 void (*expectfn)(struct nf_conn *ct, struct nf_conntrack_expect *exp);
98}; 101};
99 102
103__printf(3,4)
104void nf_ct_helper_log(struct sk_buff *skb, const struct nf_conn *ct,
105 const char *fmt, ...);
106
100void nf_ct_helper_expectfn_register(struct nf_ct_helper_expectfn *n); 107void nf_ct_helper_expectfn_register(struct nf_ct_helper_expectfn *n);
101void nf_ct_helper_expectfn_unregister(struct nf_ct_helper_expectfn *n); 108void nf_ct_helper_expectfn_unregister(struct nf_ct_helper_expectfn *n);
102struct nf_ct_helper_expectfn * 109struct nf_ct_helper_expectfn *
diff --git a/include/net/netfilter/nf_conntrack_l3proto.h b/include/net/netfilter/nf_conntrack_l3proto.h
index 6f7c13f4ac03..3bb89eac3fa1 100644
--- a/include/net/netfilter/nf_conntrack_l3proto.h
+++ b/include/net/netfilter/nf_conntrack_l3proto.h
@@ -76,11 +76,16 @@ struct nf_conntrack_l3proto {
76 76
77extern struct nf_conntrack_l3proto __rcu *nf_ct_l3protos[AF_MAX]; 77extern struct nf_conntrack_l3proto __rcu *nf_ct_l3protos[AF_MAX];
78 78
79/* Protocol registration. */ 79/* Protocol pernet registration. */
80extern int nf_conntrack_l3proto_register(struct net *net, 80extern int nf_ct_l3proto_pernet_register(struct net *net,
81 struct nf_conntrack_l3proto *proto); 81 struct nf_conntrack_l3proto *proto);
82extern void nf_conntrack_l3proto_unregister(struct net *net, 82extern void nf_ct_l3proto_pernet_unregister(struct net *net,
83 struct nf_conntrack_l3proto *proto); 83 struct nf_conntrack_l3proto *proto);
84
85/* Protocol global registration. */
86extern int nf_ct_l3proto_register(struct nf_conntrack_l3proto *proto);
87extern void nf_ct_l3proto_unregister(struct nf_conntrack_l3proto *proto);
88
84extern struct nf_conntrack_l3proto *nf_ct_l3proto_find_get(u_int16_t l3proto); 89extern struct nf_conntrack_l3proto *nf_ct_l3proto_find_get(u_int16_t l3proto);
85extern void nf_ct_l3proto_put(struct nf_conntrack_l3proto *p); 90extern void nf_ct_l3proto_put(struct nf_conntrack_l3proto *p);
86 91
diff --git a/include/net/netfilter/nf_conntrack_l4proto.h b/include/net/netfilter/nf_conntrack_l4proto.h
index c3be4aef6bf7..914d8d900798 100644
--- a/include/net/netfilter/nf_conntrack_l4proto.h
+++ b/include/net/netfilter/nf_conntrack_l4proto.h
@@ -121,12 +121,16 @@ extern struct nf_conntrack_l4proto *
121nf_ct_l4proto_find_get(u_int16_t l3proto, u_int8_t l4proto); 121nf_ct_l4proto_find_get(u_int16_t l3proto, u_int8_t l4proto);
122extern void nf_ct_l4proto_put(struct nf_conntrack_l4proto *p); 122extern void nf_ct_l4proto_put(struct nf_conntrack_l4proto *p);
123 123
124/* Protocol registration. */ 124/* Protocol pernet registration. */
125extern int nf_conntrack_l4proto_register(struct net *net, 125extern int nf_ct_l4proto_pernet_register(struct net *net,
126 struct nf_conntrack_l4proto *proto); 126 struct nf_conntrack_l4proto *proto);
127extern void nf_conntrack_l4proto_unregister(struct net *net, 127extern void nf_ct_l4proto_pernet_unregister(struct net *net,
128 struct nf_conntrack_l4proto *proto); 128 struct nf_conntrack_l4proto *proto);
129 129
130/* Protocol global registration. */
131extern int nf_ct_l4proto_register(struct nf_conntrack_l4proto *proto);
132extern void nf_ct_l4proto_unregister(struct nf_conntrack_l4proto *proto);
133
130static inline void nf_ct_kfree_compat_sysctl_table(struct nf_proto_net *pn) 134static inline void nf_ct_kfree_compat_sysctl_table(struct nf_proto_net *pn)
131{ 135{
132#if defined(CONFIG_SYSCTL) && defined(CONFIG_NF_CONNTRACK_PROC_COMPAT) 136#if defined(CONFIG_SYSCTL) && defined(CONFIG_NF_CONNTRACK_PROC_COMPAT)
diff --git a/include/net/netfilter/nf_conntrack_labels.h b/include/net/netfilter/nf_conntrack_labels.h
new file mode 100644
index 000000000000..c985695283b3
--- /dev/null
+++ b/include/net/netfilter/nf_conntrack_labels.h
@@ -0,0 +1,58 @@
1#include <linux/types.h>
2#include <net/net_namespace.h>
3#include <linux/netfilter/nf_conntrack_common.h>
4#include <linux/netfilter/nf_conntrack_tuple_common.h>
5#include <net/netfilter/nf_conntrack.h>
6#include <net/netfilter/nf_conntrack_extend.h>
7
8#include <uapi/linux/netfilter/xt_connlabel.h>
9
10struct nf_conn_labels {
11 u8 words;
12 unsigned long bits[];
13};
14
15static inline struct nf_conn_labels *nf_ct_labels_find(const struct nf_conn *ct)
16{
17#ifdef CONFIG_NF_CONNTRACK_LABELS
18 return nf_ct_ext_find(ct, NF_CT_EXT_LABELS);
19#else
20 return NULL;
21#endif
22}
23
24static inline struct nf_conn_labels *nf_ct_labels_ext_add(struct nf_conn *ct)
25{
26#ifdef CONFIG_NF_CONNTRACK_LABELS
27 struct nf_conn_labels *cl_ext;
28 struct net *net = nf_ct_net(ct);
29 u8 words;
30
31 words = ACCESS_ONCE(net->ct.label_words);
32 if (words == 0 || WARN_ON_ONCE(words > 8))
33 return NULL;
34
35 cl_ext = nf_ct_ext_add_length(ct, NF_CT_EXT_LABELS,
36 words * sizeof(long), GFP_ATOMIC);
37 if (cl_ext != NULL)
38 cl_ext->words = words;
39
40 return cl_ext;
41#else
42 return NULL;
43#endif
44}
45
46bool nf_connlabel_match(const struct nf_conn *ct, u16 bit);
47int nf_connlabel_set(struct nf_conn *ct, u16 bit);
48
49int nf_connlabels_replace(struct nf_conn *ct,
50 const u32 *data, const u32 *mask, unsigned int words);
51
52#ifdef CONFIG_NF_CONNTRACK_LABELS
53int nf_conntrack_labels_init(void);
54void nf_conntrack_labels_fini(void);
55#else
56static inline int nf_conntrack_labels_init(void) { return 0; }
57static inline void nf_conntrack_labels_fini(void) {}
58#endif
diff --git a/include/net/netfilter/nf_conntrack_timeout.h b/include/net/netfilter/nf_conntrack_timeout.h
index e41e472d08f2..d23aceb16d94 100644
--- a/include/net/netfilter/nf_conntrack_timeout.h
+++ b/include/net/netfilter/nf_conntrack_timeout.h
@@ -76,15 +76,15 @@ nf_ct_timeout_lookup(struct net *net, struct nf_conn *ct,
76} 76}
77 77
78#ifdef CONFIG_NF_CONNTRACK_TIMEOUT 78#ifdef CONFIG_NF_CONNTRACK_TIMEOUT
79extern int nf_conntrack_timeout_init(struct net *net); 79extern int nf_conntrack_timeout_init(void);
80extern void nf_conntrack_timeout_fini(struct net *net); 80extern void nf_conntrack_timeout_fini(void);
81#else 81#else
82static inline int nf_conntrack_timeout_init(struct net *net) 82static inline int nf_conntrack_timeout_init(void)
83{ 83{
84 return 0; 84 return 0;
85} 85}
86 86
87static inline void nf_conntrack_timeout_fini(struct net *net) 87static inline void nf_conntrack_timeout_fini(void)
88{ 88{
89 return; 89 return;
90} 90}
diff --git a/include/net/netfilter/nf_conntrack_timestamp.h b/include/net/netfilter/nf_conntrack_timestamp.h
index fc9c82b1f06b..b00461413efd 100644
--- a/include/net/netfilter/nf_conntrack_timestamp.h
+++ b/include/net/netfilter/nf_conntrack_timestamp.h
@@ -48,15 +48,28 @@ static inline void nf_ct_set_tstamp(struct net *net, bool enable)
48} 48}
49 49
50#ifdef CONFIG_NF_CONNTRACK_TIMESTAMP 50#ifdef CONFIG_NF_CONNTRACK_TIMESTAMP
51extern int nf_conntrack_tstamp_init(struct net *net); 51extern int nf_conntrack_tstamp_pernet_init(struct net *net);
52extern void nf_conntrack_tstamp_fini(struct net *net); 52extern void nf_conntrack_tstamp_pernet_fini(struct net *net);
53
54extern int nf_conntrack_tstamp_init(void);
55extern void nf_conntrack_tstamp_fini(void);
53#else 56#else
54static inline int nf_conntrack_tstamp_init(struct net *net) 57static inline int nf_conntrack_tstamp_pernet_init(struct net *net)
58{
59 return 0;
60}
61
62static inline void nf_conntrack_tstamp_pernet_fini(struct net *net)
63{
64 return;
65}
66
67static inline int nf_conntrack_tstamp_init(void)
55{ 68{
56 return 0; 69 return 0;
57} 70}
58 71
59static inline void nf_conntrack_tstamp_fini(struct net *net) 72static inline void nf_conntrack_tstamp_fini(void)
60{ 73{
61 return; 74 return;
62} 75}
diff --git a/include/net/netfilter/nf_tproxy_core.h b/include/net/netfilter/nf_tproxy_core.h
index 75ca9291cf2c..36d9379d4c4b 100644
--- a/include/net/netfilter/nf_tproxy_core.h
+++ b/include/net/netfilter/nf_tproxy_core.h
@@ -82,6 +82,7 @@ nf_tproxy_get_sock_v4(struct net *net, const u8 protocol,
82 break; 82 break;
83 case NFT_LOOKUP_LISTENER: 83 case NFT_LOOKUP_LISTENER:
84 sk = inet_lookup_listener(net, &tcp_hashinfo, 84 sk = inet_lookup_listener(net, &tcp_hashinfo,
85 saddr, sport,
85 daddr, dport, 86 daddr, dport,
86 in->ifindex); 87 in->ifindex);
87 88
@@ -151,6 +152,7 @@ nf_tproxy_get_sock_v6(struct net *net, const u8 protocol,
151 break; 152 break;
152 case NFT_LOOKUP_LISTENER: 153 case NFT_LOOKUP_LISTENER:
153 sk = inet6_lookup_listener(net, &tcp_hashinfo, 154 sk = inet6_lookup_listener(net, &tcp_hashinfo,
155 saddr, sport,
154 daddr, ntohs(dport), 156 daddr, ntohs(dport),
155 in->ifindex); 157 in->ifindex);
156 158
diff --git a/include/net/netns/conntrack.h b/include/net/netns/conntrack.h
index 923cb20051ed..c9c0c538b68b 100644
--- a/include/net/netns/conntrack.h
+++ b/include/net/netns/conntrack.h
@@ -84,6 +84,10 @@ struct netns_ct {
84 int sysctl_auto_assign_helper; 84 int sysctl_auto_assign_helper;
85 bool auto_assign_helper_warned; 85 bool auto_assign_helper_warned;
86 struct nf_ip_net nf_ct_proto; 86 struct nf_ip_net nf_ct_proto;
87#if defined(CONFIG_NF_CONNTRACK_LABELS)
88 unsigned int labels_used;
89 u8 label_words;
90#endif
87#ifdef CONFIG_NF_NAT_NEEDED 91#ifdef CONFIG_NF_NAT_NEEDED
88 struct hlist_head *nat_bysource; 92 struct hlist_head *nat_bysource;
89 unsigned int nat_htable_size; 93 unsigned int nat_htable_size;
diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h
index 2ae2b8372cfd..2ba9de89e8ec 100644
--- a/include/net/netns/ipv4.h
+++ b/include/net/netns/ipv4.h
@@ -22,6 +22,7 @@ struct netns_ipv4 {
22 struct ctl_table_header *frags_hdr; 22 struct ctl_table_header *frags_hdr;
23 struct ctl_table_header *ipv4_hdr; 23 struct ctl_table_header *ipv4_hdr;
24 struct ctl_table_header *route_hdr; 24 struct ctl_table_header *route_hdr;
25 struct ctl_table_header *xfrm4_hdr;
25#endif 26#endif
26 struct ipv4_devconf *devconf_all; 27 struct ipv4_devconf *devconf_all;
27 struct ipv4_devconf *devconf_dflt; 28 struct ipv4_devconf *devconf_dflt;
@@ -61,6 +62,8 @@ struct netns_ipv4 {
61 int sysctl_icmp_ratemask; 62 int sysctl_icmp_ratemask;
62 int sysctl_icmp_errors_use_inbound_ifaddr; 63 int sysctl_icmp_errors_use_inbound_ifaddr;
63 64
65 int sysctl_tcp_ecn;
66
64 kgid_t sysctl_ping_group_range[2]; 67 kgid_t sysctl_ping_group_range[2];
65 long sysctl_tcp_mem[3]; 68 long sysctl_tcp_mem[3];
66 69
diff --git a/include/net/netns/ipv6.h b/include/net/netns/ipv6.h
index 214cb0a53359..1242f371718b 100644
--- a/include/net/netns/ipv6.h
+++ b/include/net/netns/ipv6.h
@@ -16,6 +16,7 @@ struct netns_sysctl_ipv6 {
16 struct ctl_table_header *route_hdr; 16 struct ctl_table_header *route_hdr;
17 struct ctl_table_header *icmp_hdr; 17 struct ctl_table_header *icmp_hdr;
18 struct ctl_table_header *frags_hdr; 18 struct ctl_table_header *frags_hdr;
19 struct ctl_table_header *xfrm6_hdr;
19#endif 20#endif
20 int bindv6only; 21 int bindv6only;
21 int flush_delay; 22 int flush_delay;
diff --git a/include/net/nfc/hci.h b/include/net/nfc/hci.h
index 671953e11575..b87a1692b086 100644
--- a/include/net/nfc/hci.h
+++ b/include/net/nfc/hci.h
@@ -57,8 +57,10 @@ struct nfc_hci_ops {
57 int (*tm_send)(struct nfc_hci_dev *hdev, struct sk_buff *skb); 57 int (*tm_send)(struct nfc_hci_dev *hdev, struct sk_buff *skb);
58 int (*check_presence)(struct nfc_hci_dev *hdev, 58 int (*check_presence)(struct nfc_hci_dev *hdev,
59 struct nfc_target *target); 59 struct nfc_target *target);
60 void (*event_received)(struct nfc_hci_dev *hdev, u8 gate, u8 event, 60 int (*event_received)(struct nfc_hci_dev *hdev, u8 gate, u8 event,
61 struct sk_buff *skb); 61 struct sk_buff *skb);
62 int (*enable_se)(struct nfc_dev *dev, u32 secure_element);
63 int (*disable_se)(struct nfc_dev *dev, u32 secure_element);
62}; 64};
63 65
64/* Pipes */ 66/* Pipes */
@@ -82,11 +84,23 @@ typedef int (*xmit) (struct sk_buff *skb, void *cb_data);
82 84
83#define NFC_HCI_MAX_GATES 256 85#define NFC_HCI_MAX_GATES 256
84 86
87/*
88 * These values can be specified by a driver to indicate it requires some
89 * adaptation of the HCI standard.
90 *
91 * NFC_HCI_QUIRK_SHORT_CLEAR - send HCI_ADM_CLEAR_ALL_PIPE cmd with no params
92 */
93enum {
94 NFC_HCI_QUIRK_SHORT_CLEAR = 0,
95};
96
85struct nfc_hci_dev { 97struct nfc_hci_dev {
86 struct nfc_dev *ndev; 98 struct nfc_dev *ndev;
87 99
88 u32 max_data_link_payload; 100 u32 max_data_link_payload;
89 101
102 bool shutting_down;
103
90 struct mutex msg_tx_mutex; 104 struct mutex msg_tx_mutex;
91 105
92 struct list_head msg_tx_queue; 106 struct list_head msg_tx_queue;
@@ -129,12 +143,16 @@ struct nfc_hci_dev {
129 143
130 u8 *gb; 144 u8 *gb;
131 size_t gb_len; 145 size_t gb_len;
146
147 unsigned long quirks;
132}; 148};
133 149
134/* hci device allocation */ 150/* hci device allocation */
135struct nfc_hci_dev *nfc_hci_allocate_device(struct nfc_hci_ops *ops, 151struct nfc_hci_dev *nfc_hci_allocate_device(struct nfc_hci_ops *ops,
136 struct nfc_hci_init_data *init_data, 152 struct nfc_hci_init_data *init_data,
153 unsigned long quirks,
137 u32 protocols, 154 u32 protocols,
155 u32 supported_se,
138 const char *llc_name, 156 const char *llc_name,
139 int tx_headroom, 157 int tx_headroom,
140 int tx_tailroom, 158 int tx_tailroom,
diff --git a/include/net/nfc/nci_core.h b/include/net/nfc/nci_core.h
index d705d8674949..5bc0c460edc0 100644
--- a/include/net/nfc/nci_core.h
+++ b/include/net/nfc/nci_core.h
@@ -147,6 +147,7 @@ struct nci_dev {
147/* ----- NCI Devices ----- */ 147/* ----- NCI Devices ----- */
148struct nci_dev *nci_allocate_device(struct nci_ops *ops, 148struct nci_dev *nci_allocate_device(struct nci_ops *ops,
149 __u32 supported_protocols, 149 __u32 supported_protocols,
150 __u32 supported_se,
150 int tx_headroom, 151 int tx_headroom,
151 int tx_tailroom); 152 int tx_tailroom);
152void nci_free_device(struct nci_dev *ndev); 153void nci_free_device(struct nci_dev *ndev);
diff --git a/include/net/nfc/nfc.h b/include/net/nfc/nfc.h
index fce80b2f9be7..87a6417fc934 100644
--- a/include/net/nfc/nfc.h
+++ b/include/net/nfc/nfc.h
@@ -68,6 +68,8 @@ struct nfc_ops {
68 void *cb_context); 68 void *cb_context);
69 int (*tm_send)(struct nfc_dev *dev, struct sk_buff *skb); 69 int (*tm_send)(struct nfc_dev *dev, struct sk_buff *skb);
70 int (*check_presence)(struct nfc_dev *dev, struct nfc_target *target); 70 int (*check_presence)(struct nfc_dev *dev, struct nfc_target *target);
71 int (*enable_se)(struct nfc_dev *dev, u32 secure_element);
72 int (*disable_se)(struct nfc_dev *dev, u32 secure_element);
71}; 73};
72 74
73#define NFC_TARGET_IDX_ANY -1 75#define NFC_TARGET_IDX_ANY -1
@@ -109,12 +111,17 @@ struct nfc_dev {
109 struct nfc_genl_data genl_data; 111 struct nfc_genl_data genl_data;
110 u32 supported_protocols; 112 u32 supported_protocols;
111 113
114 u32 supported_se;
115 u32 active_se;
116
112 int tx_headroom; 117 int tx_headroom;
113 int tx_tailroom; 118 int tx_tailroom;
114 119
115 struct timer_list check_pres_timer; 120 struct timer_list check_pres_timer;
116 struct work_struct check_pres_work; 121 struct work_struct check_pres_work;
117 122
123 bool shutting_down;
124
118 struct nfc_ops *ops; 125 struct nfc_ops *ops;
119}; 126};
120#define to_nfc_dev(_dev) container_of(_dev, struct nfc_dev, dev) 127#define to_nfc_dev(_dev) container_of(_dev, struct nfc_dev, dev)
@@ -123,6 +130,7 @@ extern struct class nfc_class;
123 130
124struct nfc_dev *nfc_allocate_device(struct nfc_ops *ops, 131struct nfc_dev *nfc_allocate_device(struct nfc_ops *ops,
125 u32 supported_protocols, 132 u32 supported_protocols,
133 u32 supported_se,
126 int tx_headroom, 134 int tx_headroom,
127 int tx_tailroom); 135 int tx_tailroom);
128 136
diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h
index 9fcc680ab6b9..13174509cdfd 100644
--- a/include/net/pkt_cls.h
+++ b/include/net/pkt_cls.h
@@ -126,9 +126,10 @@ tcf_exts_exec(struct sk_buff *skb, struct tcf_exts *exts,
126 return 0; 126 return 0;
127} 127}
128 128
129extern int tcf_exts_validate(struct tcf_proto *tp, struct nlattr **tb, 129extern int tcf_exts_validate(struct net *net, struct tcf_proto *tp,
130 struct nlattr *rate_tlv, struct tcf_exts *exts, 130 struct nlattr **tb, struct nlattr *rate_tlv,
131 const struct tcf_ext_map *map); 131 struct tcf_exts *exts,
132 const struct tcf_ext_map *map);
132extern void tcf_exts_destroy(struct tcf_proto *tp, struct tcf_exts *exts); 133extern void tcf_exts_destroy(struct tcf_proto *tp, struct tcf_exts *exts);
133extern void tcf_exts_change(struct tcf_proto *tp, struct tcf_exts *dst, 134extern void tcf_exts_change(struct tcf_proto *tp, struct tcf_exts *dst,
134 struct tcf_exts *src); 135 struct tcf_exts *src);
diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h
index 66f5ac370f92..388bf8b6d060 100644
--- a/include/net/pkt_sched.h
+++ b/include/net/pkt_sched.h
@@ -65,8 +65,14 @@ struct qdisc_watchdog {
65}; 65};
66 66
67extern void qdisc_watchdog_init(struct qdisc_watchdog *wd, struct Qdisc *qdisc); 67extern void qdisc_watchdog_init(struct qdisc_watchdog *wd, struct Qdisc *qdisc);
68extern void qdisc_watchdog_schedule(struct qdisc_watchdog *wd, 68extern void qdisc_watchdog_schedule_ns(struct qdisc_watchdog *wd, u64 expires);
69 psched_time_t expires); 69
70static inline void qdisc_watchdog_schedule(struct qdisc_watchdog *wd,
71 psched_time_t expires)
72{
73 qdisc_watchdog_schedule_ns(wd, PSCHED_TICKS2NS(expires));
74}
75
70extern void qdisc_watchdog_cancel(struct qdisc_watchdog *wd); 76extern void qdisc_watchdog_cancel(struct qdisc_watchdog *wd);
71 77
72extern struct Qdisc_ops pfifo_qdisc_ops; 78extern struct Qdisc_ops pfifo_qdisc_ops;
diff --git a/include/net/regulatory.h b/include/net/regulatory.h
index 7dcaa2794fde..f17ed590d64a 100644
--- a/include/net/regulatory.h
+++ b/include/net/regulatory.h
@@ -18,6 +18,7 @@
18 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 18 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19 */ 19 */
20 20
21#include <linux/rcupdate.h>
21 22
22/** 23/**
23 * enum environment_cap - Environment parsed from country IE 24 * enum environment_cap - Environment parsed from country IE
@@ -35,6 +36,7 @@ enum environment_cap {
35/** 36/**
36 * struct regulatory_request - used to keep track of regulatory requests 37 * struct regulatory_request - used to keep track of regulatory requests
37 * 38 *
39 * @rcu_head: RCU head struct used to free the request
38 * @wiphy_idx: this is set if this request's initiator is 40 * @wiphy_idx: this is set if this request's initiator is
39 * %REGDOM_SET_BY_COUNTRY_IE or %REGDOM_SET_BY_DRIVER. This 41 * %REGDOM_SET_BY_COUNTRY_IE or %REGDOM_SET_BY_DRIVER. This
40 * can be used by the wireless core to deal with conflicts 42 * can be used by the wireless core to deal with conflicts
@@ -72,6 +74,7 @@ enum environment_cap {
72 * @list: used to insert into the reg_requests_list linked list 74 * @list: used to insert into the reg_requests_list linked list
73 */ 75 */
74struct regulatory_request { 76struct regulatory_request {
77 struct rcu_head rcu_head;
75 int wiphy_idx; 78 int wiphy_idx;
76 enum nl80211_reg_initiator initiator; 79 enum nl80211_reg_initiator initiator;
77 enum nl80211_user_reg_hint_type user_reg_hint_type; 80 enum nl80211_user_reg_hint_type user_reg_hint_type;
@@ -101,6 +104,7 @@ struct ieee80211_reg_rule {
101}; 104};
102 105
103struct ieee80211_regdomain { 106struct ieee80211_regdomain {
107 struct rcu_head rcu_head;
104 u32 n_reg_rules; 108 u32 n_reg_rules;
105 char alpha2[2]; 109 char alpha2[2];
106 u8 dfs_region; 110 u8 dfs_region;
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index 1540f9c2fcf4..2761c905504e 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -195,7 +195,7 @@ struct tcf_proto_ops {
195 195
196 unsigned long (*get)(struct tcf_proto*, u32 handle); 196 unsigned long (*get)(struct tcf_proto*, u32 handle);
197 void (*put)(struct tcf_proto*, unsigned long); 197 void (*put)(struct tcf_proto*, unsigned long);
198 int (*change)(struct sk_buff *, 198 int (*change)(struct net *net, struct sk_buff *,
199 struct tcf_proto*, unsigned long, 199 struct tcf_proto*, unsigned long,
200 u32 handle, struct nlattr **, 200 u32 handle, struct nlattr **,
201 unsigned long *); 201 unsigned long *);
@@ -679,4 +679,23 @@ static inline struct sk_buff *skb_act_clone(struct sk_buff *skb, gfp_t gfp_mask,
679} 679}
680#endif 680#endif
681 681
682struct psched_ratecfg {
683 u64 rate_bps;
684 u32 mult;
685 u32 shift;
686};
687
688static inline u64 psched_l2t_ns(const struct psched_ratecfg *r,
689 unsigned int len)
690{
691 return ((u64)len * r->mult) >> r->shift;
692}
693
694extern void psched_ratecfg_precompute(struct psched_ratecfg *r, u32 rate);
695
696static inline u32 psched_ratecfg_getrate(const struct psched_ratecfg *r)
697{
698 return r->rate_bps >> 3;
699}
700
682#endif 701#endif
diff --git a/include/net/sctp/constants.h b/include/net/sctp/constants.h
index c29707d654c0..a7dd5c50df79 100644
--- a/include/net/sctp/constants.h
+++ b/include/net/sctp/constants.h
@@ -303,7 +303,7 @@ enum { SCTP_MAX_GABS = 16 };
303 * to which we will raise the P-MTU. 303 * to which we will raise the P-MTU.
304 */ 304 */
305#define SCTP_DEFAULT_MINSEGMENT 512 /* MTU size ... if no mtu disc */ 305#define SCTP_DEFAULT_MINSEGMENT 512 /* MTU size ... if no mtu disc */
306#define SCTP_HOW_MANY_SECRETS 2 /* How many secrets I keep */ 306
307#define SCTP_SECRET_SIZE 32 /* Number of octets in a 256 bits. */ 307#define SCTP_SECRET_SIZE 32 /* Number of octets in a 256 bits. */
308 308
309#define SCTP_SIGNATURE_SIZE 20 /* size of a SLA-1 signature */ 309#define SCTP_SIGNATURE_SIZE 20 /* size of a SLA-1 signature */
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index fdeb85a970fc..0e0f9d2322e3 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -1236,10 +1236,7 @@ struct sctp_endpoint {
1236 * Discussion in [RFC1750] can be helpful in 1236 * Discussion in [RFC1750] can be helpful in
1237 * selection of the key. 1237 * selection of the key.
1238 */ 1238 */
1239 __u8 secret_key[SCTP_HOW_MANY_SECRETS][SCTP_SECRET_SIZE]; 1239 __u8 secret_key[SCTP_SECRET_SIZE];
1240 int current_key;
1241 int last_key;
1242 int key_changed_at;
1243 1240
1244 /* digest: This is a digest of the sctp cookie. This field is 1241 /* digest: This is a digest of the sctp cookie. This field is
1245 * only used on the receive path when we try to validate 1242 * only used on the receive path when we try to validate
diff --git a/include/net/sock.h b/include/net/sock.h
index 182ca99405ad..a66caa223d18 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -140,6 +140,7 @@ typedef __u64 __bitwise __addrpair;
140 * @skc_family: network address family 140 * @skc_family: network address family
141 * @skc_state: Connection state 141 * @skc_state: Connection state
142 * @skc_reuse: %SO_REUSEADDR setting 142 * @skc_reuse: %SO_REUSEADDR setting
143 * @skc_reuseport: %SO_REUSEPORT setting
143 * @skc_bound_dev_if: bound device index if != 0 144 * @skc_bound_dev_if: bound device index if != 0
144 * @skc_bind_node: bind hash linkage for various protocol lookup tables 145 * @skc_bind_node: bind hash linkage for various protocol lookup tables
145 * @skc_portaddr_node: second hash linkage for UDP/UDP-Lite protocol 146 * @skc_portaddr_node: second hash linkage for UDP/UDP-Lite protocol
@@ -179,7 +180,8 @@ struct sock_common {
179 180
180 unsigned short skc_family; 181 unsigned short skc_family;
181 volatile unsigned char skc_state; 182 volatile unsigned char skc_state;
182 unsigned char skc_reuse; 183 unsigned char skc_reuse:4;
184 unsigned char skc_reuseport:4;
183 int skc_bound_dev_if; 185 int skc_bound_dev_if;
184 union { 186 union {
185 struct hlist_node skc_bind_node; 187 struct hlist_node skc_bind_node;
@@ -297,6 +299,7 @@ struct sock {
297#define sk_family __sk_common.skc_family 299#define sk_family __sk_common.skc_family
298#define sk_state __sk_common.skc_state 300#define sk_state __sk_common.skc_state
299#define sk_reuse __sk_common.skc_reuse 301#define sk_reuse __sk_common.skc_reuse
302#define sk_reuseport __sk_common.skc_reuseport
300#define sk_bound_dev_if __sk_common.skc_bound_dev_if 303#define sk_bound_dev_if __sk_common.skc_bound_dev_if
301#define sk_bind_node __sk_common.skc_bind_node 304#define sk_bind_node __sk_common.skc_bind_node
302#define sk_prot __sk_common.skc_prot 305#define sk_prot __sk_common.skc_prot
@@ -337,7 +340,7 @@ struct sock {
337#endif 340#endif
338 unsigned long sk_flags; 341 unsigned long sk_flags;
339 struct dst_entry *sk_rx_dst; 342 struct dst_entry *sk_rx_dst;
340 struct dst_entry *sk_dst_cache; 343 struct dst_entry __rcu *sk_dst_cache;
341 spinlock_t sk_dst_lock; 344 spinlock_t sk_dst_lock;
342 atomic_t sk_wmem_alloc; 345 atomic_t sk_wmem_alloc;
343 atomic_t sk_omem_alloc; 346 atomic_t sk_omem_alloc;
@@ -664,6 +667,7 @@ enum sock_flags {
664 * Will use last 4 bytes of packet sent from 667 * Will use last 4 bytes of packet sent from
665 * user-space instead. 668 * user-space instead.
666 */ 669 */
670 SOCK_FILTER_LOCKED, /* Filter cannot be changed anymore */
667}; 671};
668 672
669static inline void sock_copy_flags(struct sock *nsk, struct sock *osk) 673static inline void sock_copy_flags(struct sock *nsk, struct sock *osk)
@@ -1037,7 +1041,7 @@ static inline void sk_refcnt_debug_dec(struct sock *sk)
1037 sk->sk_prot->name, sk, atomic_read(&sk->sk_prot->socks)); 1041 sk->sk_prot->name, sk, atomic_read(&sk->sk_prot->socks));
1038} 1042}
1039 1043
1040inline void sk_refcnt_debug_release(const struct sock *sk) 1044static inline void sk_refcnt_debug_release(const struct sock *sk)
1041{ 1045{
1042 if (atomic_read(&sk->sk_refcnt) != 1) 1046 if (atomic_read(&sk->sk_refcnt) != 1)
1043 printk(KERN_DEBUG "Destruction of the %s socket %p delayed, refcnt=%d\n", 1047 printk(KERN_DEBUG "Destruction of the %s socket %p delayed, refcnt=%d\n",
diff --git a/include/net/tcp.h b/include/net/tcp.h
index aed42c785153..23f2e98d4b65 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -266,7 +266,6 @@ extern int sysctl_tcp_abort_on_overflow;
266extern int sysctl_tcp_max_orphans; 266extern int sysctl_tcp_max_orphans;
267extern int sysctl_tcp_fack; 267extern int sysctl_tcp_fack;
268extern int sysctl_tcp_reordering; 268extern int sysctl_tcp_reordering;
269extern int sysctl_tcp_ecn;
270extern int sysctl_tcp_dsack; 269extern int sysctl_tcp_dsack;
271extern int sysctl_tcp_wmem[3]; 270extern int sysctl_tcp_wmem[3];
272extern int sysctl_tcp_rmem[3]; 271extern int sysctl_tcp_rmem[3];
@@ -280,7 +279,6 @@ extern int sysctl_tcp_dma_copybreak;
280extern int sysctl_tcp_nometrics_save; 279extern int sysctl_tcp_nometrics_save;
281extern int sysctl_tcp_moderate_rcvbuf; 280extern int sysctl_tcp_moderate_rcvbuf;
282extern int sysctl_tcp_tso_win_divisor; 281extern int sysctl_tcp_tso_win_divisor;
283extern int sysctl_tcp_abc;
284extern int sysctl_tcp_mtu_probing; 282extern int sysctl_tcp_mtu_probing;
285extern int sysctl_tcp_base_mss; 283extern int sysctl_tcp_base_mss;
286extern int sysctl_tcp_workaround_signed_windows; 284extern int sysctl_tcp_workaround_signed_windows;
@@ -504,7 +502,8 @@ static inline __u32 cookie_v4_init_sequence(struct sock *sk,
504#endif 502#endif
505 503
506extern __u32 cookie_init_timestamp(struct request_sock *req); 504extern __u32 cookie_init_timestamp(struct request_sock *req);
507extern bool cookie_check_timestamp(struct tcp_options_received *opt, bool *); 505extern bool cookie_check_timestamp(struct tcp_options_received *opt,
506 struct net *net, bool *ecn_ok);
508 507
509/* From net/ipv6/syncookies.c */ 508/* From net/ipv6/syncookies.c */
510extern struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb); 509extern struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb);
@@ -728,11 +727,12 @@ struct tcp_skb_cb {
728 * notifications, we disable TCP ECN negociation. 727 * notifications, we disable TCP ECN negociation.
729 */ 728 */
730static inline void 729static inline void
731TCP_ECN_create_request(struct request_sock *req, const struct sk_buff *skb) 730TCP_ECN_create_request(struct request_sock *req, const struct sk_buff *skb,
731 struct net *net)
732{ 732{
733 const struct tcphdr *th = tcp_hdr(skb); 733 const struct tcphdr *th = tcp_hdr(skb);
734 734
735 if (sysctl_tcp_ecn && th->ece && th->cwr && 735 if (net->ipv4.sysctl_tcp_ecn && th->ece && th->cwr &&
736 INET_ECN_is_not_ect(TCP_SKB_CB(skb)->ip_dsfield)) 736 INET_ECN_is_not_ect(TCP_SKB_CB(skb)->ip_dsfield))
737 inet_rsk(req)->ecn_ok = 1; 737 inet_rsk(req)->ecn_ok = 1;
738} 738}
diff --git a/include/net/transp_v6.h b/include/net/transp_v6.h
index 498433dd067d..938b7fd11204 100644
--- a/include/net/transp_v6.h
+++ b/include/net/transp_v6.h
@@ -34,17 +34,17 @@ extern int udpv6_connect(struct sock *sk,
34 struct sockaddr *uaddr, 34 struct sockaddr *uaddr,
35 int addr_len); 35 int addr_len);
36 36
37extern int datagram_recv_ctl(struct sock *sk, 37extern int ip6_datagram_recv_ctl(struct sock *sk,
38 struct msghdr *msg, 38 struct msghdr *msg,
39 struct sk_buff *skb); 39 struct sk_buff *skb);
40 40
41extern int datagram_send_ctl(struct net *net, 41extern int ip6_datagram_send_ctl(struct net *net,
42 struct sock *sk, 42 struct sock *sk,
43 struct msghdr *msg, 43 struct msghdr *msg,
44 struct flowi6 *fl6, 44 struct flowi6 *fl6,
45 struct ipv6_txoptions *opt, 45 struct ipv6_txoptions *opt,
46 int *hlimit, int *tclass, 46 int *hlimit, int *tclass,
47 int *dontfrag); 47 int *dontfrag);
48 48
49#define LOOPBACK4_IPV6 cpu_to_be32(0x7f000006) 49#define LOOPBACK4_IPV6 cpu_to_be32(0x7f000006)
50 50
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 63445ede48bb..24c8886fd969 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -501,6 +501,12 @@ struct xfrm_policy_walk {
501 u32 seq; 501 u32 seq;
502}; 502};
503 503
504struct xfrm_policy_queue {
505 struct sk_buff_head hold_queue;
506 struct timer_list hold_timer;
507 unsigned long timeout;
508};
509
504struct xfrm_policy { 510struct xfrm_policy {
505#ifdef CONFIG_NET_NS 511#ifdef CONFIG_NET_NS
506 struct net *xp_net; 512 struct net *xp_net;
@@ -522,6 +528,7 @@ struct xfrm_policy {
522 struct xfrm_lifetime_cfg lft; 528 struct xfrm_lifetime_cfg lft;
523 struct xfrm_lifetime_cur curlft; 529 struct xfrm_lifetime_cur curlft;
524 struct xfrm_policy_walk_entry walk; 530 struct xfrm_policy_walk_entry walk;
531 struct xfrm_policy_queue polq;
525 u8 type; 532 u8 type;
526 u8 action; 533 u8 action;
527 u8 flags; 534 u8 flags;
@@ -557,10 +564,6 @@ struct xfrm_migrate {
557}; 564};
558 565
559#define XFRM_KM_TIMEOUT 30 566#define XFRM_KM_TIMEOUT 30
560/* which seqno */
561#define XFRM_REPLAY_SEQ 1
562#define XFRM_REPLAY_OSEQ 2
563#define XFRM_REPLAY_SEQ_MASK 3
564/* what happened */ 567/* what happened */
565#define XFRM_REPLAY_UPDATE XFRM_AE_CR 568#define XFRM_REPLAY_UPDATE XFRM_AE_CR
566#define XFRM_REPLAY_TIMEOUT XFRM_AE_CE 569#define XFRM_REPLAY_TIMEOUT XFRM_AE_CE
@@ -1036,7 +1039,7 @@ static inline int
1036__xfrm6_state_addr_cmp(const struct xfrm_tmpl *tmpl, const struct xfrm_state *x) 1039__xfrm6_state_addr_cmp(const struct xfrm_tmpl *tmpl, const struct xfrm_state *x)
1037{ 1040{
1038 return (!ipv6_addr_any((struct in6_addr*)&tmpl->saddr) && 1041 return (!ipv6_addr_any((struct in6_addr*)&tmpl->saddr) &&
1039 ipv6_addr_cmp((struct in6_addr *)&tmpl->saddr, (struct in6_addr*)&x->props.saddr)); 1042 !ipv6_addr_equal((struct in6_addr *)&tmpl->saddr, (struct in6_addr*)&x->props.saddr));
1040} 1043}
1041 1044
1042static inline int 1045static inline int
@@ -1247,8 +1250,8 @@ static __inline__ int
1247__xfrm6_state_addr_check(const struct xfrm_state *x, 1250__xfrm6_state_addr_check(const struct xfrm_state *x,
1248 const xfrm_address_t *daddr, const xfrm_address_t *saddr) 1251 const xfrm_address_t *daddr, const xfrm_address_t *saddr)
1249{ 1252{
1250 if (!ipv6_addr_cmp((struct in6_addr *)daddr, (struct in6_addr *)&x->id.daddr) && 1253 if (ipv6_addr_equal((struct in6_addr *)daddr, (struct in6_addr *)&x->id.daddr) &&
1251 (!ipv6_addr_cmp((struct in6_addr *)saddr, (struct in6_addr *)&x->props.saddr)|| 1254 (ipv6_addr_equal((struct in6_addr *)saddr, (struct in6_addr *)&x->props.saddr) ||
1252 ipv6_addr_any((struct in6_addr *)saddr) || 1255 ipv6_addr_any((struct in6_addr *)saddr) ||
1253 ipv6_addr_any((struct in6_addr *)&x->props.saddr))) 1256 ipv6_addr_any((struct in6_addr *)&x->props.saddr)))
1254 return 1; 1257 return 1;
@@ -1324,6 +1327,7 @@ struct xfrm_algo_desc {
1324 char *name; 1327 char *name;
1325 char *compat; 1328 char *compat;
1326 u8 available:1; 1329 u8 available:1;
1330 u8 pfkey_supported:1;
1327 union { 1331 union {
1328 struct xfrm_algo_aead_info aead; 1332 struct xfrm_algo_aead_info aead;
1329 struct xfrm_algo_auth_info auth; 1333 struct xfrm_algo_auth_info auth;
@@ -1565,8 +1569,8 @@ extern void xfrm_input_init(void);
1565extern int xfrm_parse_spi(struct sk_buff *skb, u8 nexthdr, __be32 *spi, __be32 *seq); 1569extern int xfrm_parse_spi(struct sk_buff *skb, u8 nexthdr, __be32 *spi, __be32 *seq);
1566 1570
1567extern void xfrm_probe_algs(void); 1571extern void xfrm_probe_algs(void);
1568extern int xfrm_count_auth_supported(void); 1572extern int xfrm_count_pfkey_auth_supported(void);
1569extern int xfrm_count_enc_supported(void); 1573extern int xfrm_count_pfkey_enc_supported(void);
1570extern struct xfrm_algo_desc *xfrm_aalg_get_byidx(unsigned int idx); 1574extern struct xfrm_algo_desc *xfrm_aalg_get_byidx(unsigned int idx);
1571extern struct xfrm_algo_desc *xfrm_ealg_get_byidx(unsigned int idx); 1575extern struct xfrm_algo_desc *xfrm_ealg_get_byidx(unsigned int idx);
1572extern struct xfrm_algo_desc *xfrm_aalg_get_byid(int alg_id); 1576extern struct xfrm_algo_desc *xfrm_aalg_get_byid(int alg_id);
@@ -1578,17 +1582,23 @@ extern struct xfrm_algo_desc *xfrm_calg_get_byname(const char *name, int probe);
1578extern struct xfrm_algo_desc *xfrm_aead_get_byname(const char *name, int icv_len, 1582extern struct xfrm_algo_desc *xfrm_aead_get_byname(const char *name, int icv_len,
1579 int probe); 1583 int probe);
1580 1584
1581static inline int xfrm_addr_cmp(const xfrm_address_t *a, 1585static inline bool xfrm6_addr_equal(const xfrm_address_t *a,
1582 const xfrm_address_t *b, 1586 const xfrm_address_t *b)
1583 int family) 1587{
1588 return ipv6_addr_equal((const struct in6_addr *)a,
1589 (const struct in6_addr *)b);
1590}
1591
1592static inline bool xfrm_addr_equal(const xfrm_address_t *a,
1593 const xfrm_address_t *b,
1594 sa_family_t family)
1584{ 1595{
1585 switch (family) { 1596 switch (family) {
1586 default: 1597 default:
1587 case AF_INET: 1598 case AF_INET:
1588 return (__force u32)a->a4 - (__force u32)b->a4; 1599 return ((__force u32)a->a4 ^ (__force u32)b->a4) == 0;
1589 case AF_INET6: 1600 case AF_INET6:
1590 return ipv6_addr_cmp((const struct in6_addr *)a, 1601 return xfrm6_addr_equal(a, b);
1591 (const struct in6_addr *)b);
1592 } 1602 }
1593} 1603}
1594 1604
diff --git a/include/sound/compress_driver.h b/include/sound/compress_driver.h
index f2912abacdf3..ff6c74153fa1 100644
--- a/include/sound/compress_driver.h
+++ b/include/sound/compress_driver.h
@@ -71,6 +71,8 @@ struct snd_compr_runtime {
71 * @runtime: pointer to runtime structure 71 * @runtime: pointer to runtime structure
72 * @device: device pointer 72 * @device: device pointer
73 * @direction: stream direction, playback/recording 73 * @direction: stream direction, playback/recording
74 * @metadata_set: metadata set flag, true when set
75 * @next_track: has userspace signall next track transistion, true when set
74 * @private_data: pointer to DSP private data 76 * @private_data: pointer to DSP private data
75 */ 77 */
76struct snd_compr_stream { 78struct snd_compr_stream {
@@ -79,6 +81,8 @@ struct snd_compr_stream {
79 struct snd_compr_runtime *runtime; 81 struct snd_compr_runtime *runtime;
80 struct snd_compr *device; 82 struct snd_compr *device;
81 enum snd_compr_direction direction; 83 enum snd_compr_direction direction;
84 bool metadata_set;
85 bool next_track;
82 void *private_data; 86 void *private_data;
83}; 87};
84 88
@@ -110,6 +114,10 @@ struct snd_compr_ops {
110 struct snd_compr_params *params); 114 struct snd_compr_params *params);
111 int (*get_params)(struct snd_compr_stream *stream, 115 int (*get_params)(struct snd_compr_stream *stream,
112 struct snd_codec *params); 116 struct snd_codec *params);
117 int (*set_metadata)(struct snd_compr_stream *stream,
118 struct snd_compr_metadata *metadata);
119 int (*get_metadata)(struct snd_compr_stream *stream,
120 struct snd_compr_metadata *metadata);
113 int (*trigger)(struct snd_compr_stream *stream, int cmd); 121 int (*trigger)(struct snd_compr_stream *stream, int cmd);
114 int (*pointer)(struct snd_compr_stream *stream, 122 int (*pointer)(struct snd_compr_stream *stream,
115 struct snd_compr_tstamp *tstamp); 123 struct snd_compr_tstamp *tstamp);
diff --git a/include/sound/core.h b/include/sound/core.h
index 93896ad1fcdd..7cede2d6aa86 100644
--- a/include/sound/core.h
+++ b/include/sound/core.h
@@ -394,8 +394,11 @@ void __snd_printk(unsigned int level, const char *file, int line,
394 394
395#else /* !CONFIG_SND_DEBUG */ 395#else /* !CONFIG_SND_DEBUG */
396 396
397#define snd_printd(fmt, args...) do { } while (0) 397__printf(1, 2)
398#define _snd_printd(level, fmt, args...) do { } while (0) 398static inline void snd_printd(const char *format, ...) {}
399__printf(2, 3)
400static inline void _snd_printd(int level, const char *format, ...) {}
401
399#define snd_BUG() do { } while (0) 402#define snd_BUG() do { } while (0)
400static inline int __snd_bug_on(int cond) 403static inline int __snd_bug_on(int cond)
401{ 404{
@@ -416,7 +419,8 @@ static inline int __snd_bug_on(int cond)
416#define snd_printdd(format, args...) \ 419#define snd_printdd(format, args...) \
417 __snd_printk(2, __FILE__, __LINE__, format, ##args) 420 __snd_printk(2, __FILE__, __LINE__, format, ##args)
418#else 421#else
419#define snd_printdd(format, args...) do { } while (0) 422__printf(1, 2)
423static inline void snd_printdd(const char *format, ...) {}
420#endif 424#endif
421 425
422 426
@@ -454,6 +458,7 @@ struct snd_pci_quirk {
454#define SND_PCI_QUIRK_MASK(vend, mask, dev, xname, val) \ 458#define SND_PCI_QUIRK_MASK(vend, mask, dev, xname, val) \
455 {_SND_PCI_QUIRK_ID_MASK(vend, mask, dev), \ 459 {_SND_PCI_QUIRK_ID_MASK(vend, mask, dev), \
456 .value = (val), .name = (xname)} 460 .value = (val), .name = (xname)}
461#define snd_pci_quirk_name(q) ((q)->name)
457#else 462#else
458#define SND_PCI_QUIRK(vend,dev,xname,val) \ 463#define SND_PCI_QUIRK(vend,dev,xname,val) \
459 {_SND_PCI_QUIRK_ID(vend, dev), .value = (val)} 464 {_SND_PCI_QUIRK_ID(vend, dev), .value = (val)}
@@ -461,6 +466,7 @@ struct snd_pci_quirk {
461 {_SND_PCI_QUIRK_ID_MASK(vend, mask, dev), .value = (val)} 466 {_SND_PCI_QUIRK_ID_MASK(vend, mask, dev), .value = (val)}
462#define SND_PCI_QUIRK_VENDOR(vend, xname, val) \ 467#define SND_PCI_QUIRK_VENDOR(vend, xname, val) \
463 {_SND_PCI_QUIRK_ID_MASK(vend, 0, 0), .value = (val)} 468 {_SND_PCI_QUIRK_ID_MASK(vend, 0, 0), .value = (val)}
469#define snd_pci_quirk_name(q) ""
464#endif 470#endif
465 471
466const struct snd_pci_quirk * 472const struct snd_pci_quirk *
diff --git a/include/sound/cs4271.h b/include/sound/cs4271.h
index dd8c48d14ed9..70f45355acaa 100644
--- a/include/sound/cs4271.h
+++ b/include/sound/cs4271.h
@@ -20,6 +20,21 @@
20struct cs4271_platform_data { 20struct cs4271_platform_data {
21 int gpio_nreset; /* GPIO driving Reset pin, if any */ 21 int gpio_nreset; /* GPIO driving Reset pin, if any */
22 bool amutec_eq_bmutec; /* flag to enable AMUTEC=BMUTEC */ 22 bool amutec_eq_bmutec; /* flag to enable AMUTEC=BMUTEC */
23
24 /*
25 * The CS4271 requires its LRCLK and MCLK to be stable before its RESET
26 * line is de-asserted. That also means that clocks cannot be changed
27 * without putting the chip back into hardware reset, which also requires
28 * a complete re-initialization of all registers.
29 *
30 * One (undocumented) workaround is to assert and de-assert the PDN bit
31 * in the MODE2 register. This workaround can be enabled with the
32 * following flag.
33 *
34 * Note that this is not needed in case the clocks are stable
35 * throughout the entire runtime of the codec.
36 */
37 bool enable_soft_reset;
23}; 38};
24 39
25#endif /* __CS4271_H */ 40#endif /* __CS4271_H */
diff --git a/include/sound/da7213.h b/include/sound/da7213.h
new file mode 100644
index 000000000000..673f5c39cbf2
--- /dev/null
+++ b/include/sound/da7213.h
@@ -0,0 +1,52 @@
1/*
2 * da7213.h - DA7213 ASoC Codec Driver Platform Data
3 *
4 * Copyright (c) 2013 Dialog Semiconductor
5 *
6 * Author: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#ifndef _DA7213_PDATA_H
14#define _DA7213_PDATA_H
15
16enum da7213_micbias_voltage {
17 DA7213_MICBIAS_1_6V = 0,
18 DA7213_MICBIAS_2_2V = 1,
19 DA7213_MICBIAS_2_5V = 2,
20 DA7213_MICBIAS_3_0V = 3,
21};
22
23enum da7213_dmic_data_sel {
24 DA7213_DMIC_DATA_LRISE_RFALL = 0,
25 DA7213_DMIC_DATA_LFALL_RRISE = 1,
26};
27
28enum da7213_dmic_samplephase {
29 DA7213_DMIC_SAMPLE_ON_CLKEDGE = 0,
30 DA7213_DMIC_SAMPLE_BETWEEN_CLKEDGE = 1,
31};
32
33enum da7213_dmic_clk_rate {
34 DA7213_DMIC_CLK_3_0MHZ = 0,
35 DA7213_DMIC_CLK_1_5MHZ = 1,
36};
37
38struct da7213_platform_data {
39 /* Mic Bias voltage */
40 enum da7213_micbias_voltage micbias1_lvl;
41 enum da7213_micbias_voltage micbias2_lvl;
42
43 /* DMIC config */
44 enum da7213_dmic_data_sel dmic_data_sel;
45 enum da7213_dmic_samplephase dmic_samplephase;
46 enum da7213_dmic_clk_rate dmic_clk_rate;
47
48 /* MCLK squaring config */
49 bool mclk_squaring;
50};
51
52#endif /* _DA7213_PDATA_H */
diff --git a/include/sound/max98090.h b/include/sound/max98090.h
new file mode 100755
index 000000000000..95efb13f8478
--- /dev/null
+++ b/include/sound/max98090.h
@@ -0,0 +1,29 @@
1/*
2 * Platform data for MAX98090
3 *
4 * Copyright 2011-2012 Maxim Integrated Products
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 *
11 */
12
13#ifndef __SOUND_MAX98090_PDATA_H__
14#define __SOUND_MAX98090_PDATA_H__
15
16/* codec platform data */
17struct max98090_pdata {
18
19 /* Analog/digital microphone configuration:
20 * 0 = analog microphone input (normal setting)
21 * 1 = digital microphone input
22 */
23 unsigned int digmic_left_mode:1;
24 unsigned int digmic_right_mode:1;
25 unsigned int digmic_3_mode:1;
26 unsigned int digmic_4_mode:1;
27};
28
29#endif
diff --git a/include/sound/memalloc.h b/include/sound/memalloc.h
index 844af65af626..cf15b8213df7 100644
--- a/include/sound/memalloc.h
+++ b/include/sound/memalloc.h
@@ -37,7 +37,7 @@ struct snd_dma_device {
37#ifndef snd_dma_pci_data 37#ifndef snd_dma_pci_data
38#define snd_dma_pci_data(pci) (&(pci)->dev) 38#define snd_dma_pci_data(pci) (&(pci)->dev)
39#define snd_dma_isa_data() NULL 39#define snd_dma_isa_data() NULL
40#define snd_dma_continuous_data(x) ((struct device *)(unsigned long)(x)) 40#define snd_dma_continuous_data(x) ((struct device *)(__force unsigned long)(x))
41#endif 41#endif
42 42
43 43
diff --git a/include/sound/saif.h b/include/sound/saif.h
deleted file mode 100644
index f22f3e16edf4..000000000000
--- a/include/sound/saif.h
+++ /dev/null
@@ -1,16 +0,0 @@
1/*
2 * Copyright 2011 Freescale Semiconductor, Inc. All Rights Reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#ifndef __SOUND_SAIF_H__
10#define __SOUND_SAIF_H__
11
12struct mxs_saif_platform_data {
13 bool master_mode; /* if true use master mode */
14 int master_id; /* id of the master if in slave mode */
15};
16#endif
diff --git a/include/sound/sh_fsi.h b/include/sound/sh_fsi.h
index cc1c919c6436..7a9710b4b799 100644
--- a/include/sound/sh_fsi.h
+++ b/include/sound/sh_fsi.h
@@ -11,82 +11,20 @@
11 * it under the terms of the GNU General Public License version 2 as 11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation. 12 * published by the Free Software Foundation.
13 */ 13 */
14
15#define FSI_PORT_A 0
16#define FSI_PORT_B 1
17
18#include <linux/clk.h> 14#include <linux/clk.h>
19#include <sound/soc.h> 15#include <sound/soc.h>
20 16
21/* 17/*
22 * flags format 18 * flags
23 *
24 * 0x00000CBA
25 *
26 * A: inversion
27 * B: format mode
28 * C: chip specific
29 * D: clock selecter if master mode
30 */ 19 */
31 20#define SH_FSI_FMT_SPDIF (1 << 0) /* spdif for HDMI */
32/* A: clock inversion */ 21#define SH_FSI_ENABLE_STREAM_MODE (1 << 1) /* for 16bit data */
33#define SH_FSI_INVERSION_MASK 0x0000000F 22#define SH_FSI_CLK_CPG (1 << 2) /* FSIxCK + FSI-DIV */
34#define SH_FSI_LRM_INV (1 << 0)
35#define SH_FSI_BRM_INV (1 << 1)
36#define SH_FSI_LRS_INV (1 << 2)
37#define SH_FSI_BRS_INV (1 << 3)
38
39/* B: format mode */
40#define SH_FSI_FMT_MASK 0x000000F0
41#define SH_FSI_FMT_DAI (0 << 4)
42#define SH_FSI_FMT_SPDIF (1 << 4)
43
44/* C: chip specific */
45#define SH_FSI_OPTION_MASK 0x00000F00
46#define SH_FSI_ENABLE_STREAM_MODE (1 << 8) /* for 16bit data */
47
48/* D: clock selecter if master mode */
49#define SH_FSI_CLK_MASK 0x0000F000
50#define SH_FSI_CLK_EXTERNAL (0 << 12)
51#define SH_FSI_CLK_CPG (1 << 12) /* FSIxCK + FSI-DIV */
52
53/*
54 * set_rate return value
55 *
56 * see ACKMD/BPFMD on
57 * ACK_MD (FSI2)
58 * CKG1 (FSI)
59 *
60 * err : return value < 0
61 * no change : return value == 0
62 * change xMD : return value > 0
63 *
64 * 0x-00000AB
65 *
66 * A: ACKMD value
67 * B: BPFMD value
68 */
69
70#define SH_FSI_ACKMD_MASK (0xF << 0)
71#define SH_FSI_ACKMD_512 (1 << 0)
72#define SH_FSI_ACKMD_256 (2 << 0)
73#define SH_FSI_ACKMD_128 (3 << 0)
74#define SH_FSI_ACKMD_64 (4 << 0)
75#define SH_FSI_ACKMD_32 (5 << 0)
76
77#define SH_FSI_BPFMD_MASK (0xF << 4)
78#define SH_FSI_BPFMD_512 (1 << 4)
79#define SH_FSI_BPFMD_256 (2 << 4)
80#define SH_FSI_BPFMD_128 (3 << 4)
81#define SH_FSI_BPFMD_64 (4 << 4)
82#define SH_FSI_BPFMD_32 (5 << 4)
83#define SH_FSI_BPFMD_16 (6 << 4)
84 23
85struct sh_fsi_port_info { 24struct sh_fsi_port_info {
86 unsigned long flags; 25 unsigned long flags;
87 int tx_id; 26 int tx_id;
88 int rx_id; 27 int rx_id;
89 int (*set_rate)(struct device *dev, int rate, int enable);
90}; 28};
91 29
92struct sh_fsi_platform_info { 30struct sh_fsi_platform_info {
diff --git a/include/sound/simple_card.h b/include/sound/simple_card.h
index 4b62b8dc6a4f..6c74527d4926 100644
--- a/include/sound/simple_card.h
+++ b/include/sound/simple_card.h
@@ -14,21 +14,21 @@
14 14
15#include <sound/soc.h> 15#include <sound/soc.h>
16 16
17struct asoc_simple_dai_init_info { 17struct asoc_simple_dai {
18 const char *name;
18 unsigned int fmt; 19 unsigned int fmt;
19 unsigned int cpu_daifmt;
20 unsigned int codec_daifmt;
21 unsigned int sysclk; 20 unsigned int sysclk;
22}; 21};
23 22
24struct asoc_simple_card_info { 23struct asoc_simple_card_info {
25 const char *name; 24 const char *name;
26 const char *card; 25 const char *card;
27 const char *cpu_dai;
28 const char *codec; 26 const char *codec;
29 const char *platform; 27 const char *platform;
30 const char *codec_dai; 28
31 struct asoc_simple_dai_init_info *init; /* for snd_link.init */ 29 unsigned int daifmt;
30 struct asoc_simple_dai cpu_dai;
31 struct asoc_simple_dai codec_dai;
32 32
33 /* used in simple-card.c */ 33 /* used in simple-card.c */
34 struct snd_soc_dai_link snd_link; 34 struct snd_soc_dai_link snd_link;
diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h
index 3953cea0ecfb..3d84808952b9 100644
--- a/include/sound/soc-dai.h
+++ b/include/sound/soc-dai.h
@@ -45,7 +45,7 @@ struct snd_compr_stream;
45 * sending or receiving PCM data in a frame. This can be used to save power. 45 * sending or receiving PCM data in a frame. This can be used to save power.
46 */ 46 */
47#define SND_SOC_DAIFMT_CONT (1 << 4) /* continuous clock */ 47#define SND_SOC_DAIFMT_CONT (1 << 4) /* continuous clock */
48#define SND_SOC_DAIFMT_GATED (2 << 4) /* clock is gated */ 48#define SND_SOC_DAIFMT_GATED (0 << 4) /* clock is gated */
49 49
50/* 50/*
51 * DAI hardware signal inversions. 51 * DAI hardware signal inversions.
@@ -53,7 +53,7 @@ struct snd_compr_stream;
53 * Specifies whether the DAI can also support inverted clocks for the specified 53 * Specifies whether the DAI can also support inverted clocks for the specified
54 * format. 54 * format.
55 */ 55 */
56#define SND_SOC_DAIFMT_NB_NF (1 << 8) /* normal bit clock + frame */ 56#define SND_SOC_DAIFMT_NB_NF (0 << 8) /* normal bit clock + frame */
57#define SND_SOC_DAIFMT_NB_IF (2 << 8) /* normal BCLK + inv FRM */ 57#define SND_SOC_DAIFMT_NB_IF (2 << 8) /* normal BCLK + inv FRM */
58#define SND_SOC_DAIFMT_IB_NF (3 << 8) /* invert BCLK + nor FRM */ 58#define SND_SOC_DAIFMT_IB_NF (3 << 8) /* invert BCLK + nor FRM */
59#define SND_SOC_DAIFMT_IB_IF (4 << 8) /* invert BCLK + FRM */ 59#define SND_SOC_DAIFMT_IB_IF (4 << 8) /* invert BCLK + FRM */
@@ -126,7 +126,8 @@ int snd_soc_dai_set_channel_map(struct snd_soc_dai *dai,
126int snd_soc_dai_set_tristate(struct snd_soc_dai *dai, int tristate); 126int snd_soc_dai_set_tristate(struct snd_soc_dai *dai, int tristate);
127 127
128/* Digital Audio Interface mute */ 128/* Digital Audio Interface mute */
129int snd_soc_dai_digital_mute(struct snd_soc_dai *dai, int mute); 129int snd_soc_dai_digital_mute(struct snd_soc_dai *dai, int mute,
130 int direction);
130 131
131struct snd_soc_dai_ops { 132struct snd_soc_dai_ops {
132 /* 133 /*
@@ -157,6 +158,7 @@ struct snd_soc_dai_ops {
157 * Called by soc-core to minimise any pops. 158 * Called by soc-core to minimise any pops.
158 */ 159 */
159 int (*digital_mute)(struct snd_soc_dai *dai, int mute); 160 int (*digital_mute)(struct snd_soc_dai *dai, int mute);
161 int (*mute_stream)(struct snd_soc_dai *dai, int mute, int stream);
160 162
161 /* 163 /*
162 * ALSA PCM audio operations - all optional. 164 * ALSA PCM audio operations - all optional.
diff --git a/include/sound/soc.h b/include/sound/soc.h
index bc56738cb109..a6a059ca3874 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -906,8 +906,8 @@ struct snd_soc_dai_link {
906 struct snd_pcm_hw_params *params); 906 struct snd_pcm_hw_params *params);
907 907
908 /* machine stream operations */ 908 /* machine stream operations */
909 struct snd_soc_ops *ops; 909 const struct snd_soc_ops *ops;
910 struct snd_soc_compr_ops *compr_ops; 910 const struct snd_soc_compr_ops *compr_ops;
911}; 911};
912 912
913struct snd_soc_codec_conf { 913struct snd_soc_codec_conf {
@@ -1171,6 +1171,8 @@ int snd_soc_of_parse_card_name(struct snd_soc_card *card,
1171 const char *propname); 1171 const char *propname);
1172int snd_soc_of_parse_audio_routing(struct snd_soc_card *card, 1172int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
1173 const char *propname); 1173 const char *propname);
1174unsigned int snd_soc_of_parse_daifmt(struct device_node *np,
1175 const char *prefix);
1174 1176
1175#include <sound/soc-dai.h> 1177#include <sound/soc-dai.h>
1176 1178
diff --git a/include/sound/tlv320aic3x.h b/include/sound/tlv320aic3x.h
index ffd9bc793105..9407fd00363b 100644
--- a/include/sound/tlv320aic3x.h
+++ b/include/sound/tlv320aic3x.h
@@ -46,6 +46,13 @@ enum {
46 AIC3X_GPIO2_FUNC_BUTTON_PRESS_IRQ = 15 46 AIC3X_GPIO2_FUNC_BUTTON_PRESS_IRQ = 15
47}; 47};
48 48
49enum aic3x_micbias_voltage {
50 AIC3X_MICBIAS_OFF = 0,
51 AIC3X_MICBIAS_2_0V = 1,
52 AIC3X_MICBIAS_2_5V = 2,
53 AIC3X_MICBIAS_AVDDV = 3,
54};
55
49struct aic3x_setup_data { 56struct aic3x_setup_data {
50 unsigned int gpio_func[2]; 57 unsigned int gpio_func[2];
51}; 58};
@@ -53,6 +60,9 @@ struct aic3x_setup_data {
53struct aic3x_pdata { 60struct aic3x_pdata {
54 int gpio_reset; /* < 0 if not used */ 61 int gpio_reset; /* < 0 if not used */
55 struct aic3x_setup_data *setup; 62 struct aic3x_setup_data *setup;
63
64 /* Selects the micbias voltage */
65 enum aic3x_micbias_voltage micbias_vg;
56}; 66};
57 67
58#endif 68#endif
diff --git a/include/sound/wm2000.h b/include/sound/wm2000.h
index aa388ca9ec64..4de81f41c90f 100644
--- a/include/sound/wm2000.h
+++ b/include/sound/wm2000.h
@@ -15,9 +15,6 @@ struct wm2000_platform_data {
15 /** Filename for system-specific image to download to device. */ 15 /** Filename for system-specific image to download to device. */
16 const char *download_file; 16 const char *download_file;
17 17
18 /** Divide MCLK by 2 for system clock? */
19 unsigned int mclkdiv2:1;
20
21 /** Disable speech clarity enhancement, for use when an 18 /** Disable speech clarity enhancement, for use when an
22 * external algorithm is used. */ 19 * external algorithm is used. */
23 unsigned int speech_enh_disable:1; 20 unsigned int speech_enh_disable:1;
diff --git a/include/sound/wm2200.h b/include/sound/wm2200.h
index 79bf55be7ffa..bc7ab1a4b480 100644
--- a/include/sound/wm2200.h
+++ b/include/sound/wm2200.h
@@ -12,6 +12,7 @@
12#define __LINUX_SND_WM2200_H 12#define __LINUX_SND_WM2200_H
13 13
14#define WM2200_GPIO_SET 0x10000 14#define WM2200_GPIO_SET 0x10000
15#define WM2200_MAX_MICBIAS 2
15 16
16enum wm2200_in_mode { 17enum wm2200_in_mode {
17 WM2200_IN_SE = 0, 18 WM2200_IN_SE = 0,
@@ -25,6 +26,24 @@ enum wm2200_dmic_sup {
25 WM2200_DMIC_SUP_MICBIAS2 = 2, 26 WM2200_DMIC_SUP_MICBIAS2 = 2,
26}; 27};
27 28
29enum wm2200_mbias_lvl {
30 WM2200_MBIAS_LVL_1V5 = 1,
31 WM2200_MBIAS_LVL_1V8 = 2,
32 WM2200_MBIAS_LVL_1V9 = 3,
33 WM2200_MBIAS_LVL_2V0 = 4,
34 WM2200_MBIAS_LVL_2V2 = 5,
35 WM2200_MBIAS_LVL_2V4 = 6,
36 WM2200_MBIAS_LVL_2V5 = 7,
37 WM2200_MBIAS_LVL_2V6 = 8,
38};
39
40struct wm2200_micbias {
41 enum wm2200_mbias_lvl mb_lvl; /** Regulated voltage */
42 unsigned int discharge:1; /** Actively discharge */
43 unsigned int fast_start:1; /** Enable aggressive startup ramp rate */
44 unsigned int bypass:1; /** Use bypass mode */
45};
46
28struct wm2200_pdata { 47struct wm2200_pdata {
29 int reset; /** GPIO controlling /RESET, if any */ 48 int reset; /** GPIO controlling /RESET, if any */
30 int ldo_ena; /** GPIO controlling LODENA, if any */ 49 int ldo_ena; /** GPIO controlling LODENA, if any */
@@ -35,7 +54,8 @@ struct wm2200_pdata {
35 enum wm2200_in_mode in_mode[3]; 54 enum wm2200_in_mode in_mode[3];
36 enum wm2200_dmic_sup dmic_sup[3]; 55 enum wm2200_dmic_sup dmic_sup[3];
37 56
38 int micbias_cfg[2]; /** Register value to configure MICBIAS */ 57 /** MICBIAS configurations */
58 struct wm2200_micbias micbias[WM2200_MAX_MICBIAS];
39}; 59};
40 60
41#endif 61#endif
diff --git a/include/trace/events/power.h b/include/trace/events/power.h
index 0c9783841a30..427acab5d69a 100644
--- a/include/trace/events/power.h
+++ b/include/trace/events/power.h
@@ -99,98 +99,6 @@ DEFINE_EVENT(wakeup_source, wakeup_source_deactivate,
99 TP_ARGS(name, state) 99 TP_ARGS(name, state)
100); 100);
101 101
102#ifdef CONFIG_EVENT_POWER_TRACING_DEPRECATED
103
104/*
105 * The power events are used for cpuidle & suspend (power_start, power_end)
106 * and for cpufreq (power_frequency)
107 */
108DECLARE_EVENT_CLASS(power,
109
110 TP_PROTO(unsigned int type, unsigned int state, unsigned int cpu_id),
111
112 TP_ARGS(type, state, cpu_id),
113
114 TP_STRUCT__entry(
115 __field( u64, type )
116 __field( u64, state )
117 __field( u64, cpu_id )
118 ),
119
120 TP_fast_assign(
121 __entry->type = type;
122 __entry->state = state;
123 __entry->cpu_id = cpu_id;
124 ),
125
126 TP_printk("type=%lu state=%lu cpu_id=%lu", (unsigned long)__entry->type,
127 (unsigned long)__entry->state, (unsigned long)__entry->cpu_id)
128);
129
130DEFINE_EVENT(power, power_start,
131
132 TP_PROTO(unsigned int type, unsigned int state, unsigned int cpu_id),
133
134 TP_ARGS(type, state, cpu_id)
135);
136
137DEFINE_EVENT(power, power_frequency,
138
139 TP_PROTO(unsigned int type, unsigned int state, unsigned int cpu_id),
140
141 TP_ARGS(type, state, cpu_id)
142);
143
144TRACE_EVENT(power_end,
145
146 TP_PROTO(unsigned int cpu_id),
147
148 TP_ARGS(cpu_id),
149
150 TP_STRUCT__entry(
151 __field( u64, cpu_id )
152 ),
153
154 TP_fast_assign(
155 __entry->cpu_id = cpu_id;
156 ),
157
158 TP_printk("cpu_id=%lu", (unsigned long)__entry->cpu_id)
159
160);
161
162/* Deprecated dummy functions must be protected against multi-declartion */
163#ifndef _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED
164#define _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED
165
166enum {
167 POWER_NONE = 0,
168 POWER_CSTATE = 1,
169 POWER_PSTATE = 2,
170};
171#endif /* _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED */
172
173#else /* CONFIG_EVENT_POWER_TRACING_DEPRECATED */
174
175#ifndef _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED
176#define _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED
177enum {
178 POWER_NONE = 0,
179 POWER_CSTATE = 1,
180 POWER_PSTATE = 2,
181};
182
183/* These dummy declaration have to be ripped out when the deprecated
184 events get removed */
185static inline void trace_power_start(u64 type, u64 state, u64 cpuid) {};
186static inline void trace_power_end(u64 cpuid) {};
187static inline void trace_power_start_rcuidle(u64 type, u64 state, u64 cpuid) {};
188static inline void trace_power_end_rcuidle(u64 cpuid) {};
189static inline void trace_power_frequency(u64 type, u64 state, u64 cpuid) {};
190#endif /* _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED */
191
192#endif /* CONFIG_EVENT_POWER_TRACING_DEPRECATED */
193
194/* 102/*
195 * The clock events are used for clock enable/disable and for 103 * The clock events are used for clock enable/disable and for
196 * clock rate change 104 * clock rate change
diff --git a/include/trace/events/ras.h b/include/trace/events/ras.h
new file mode 100644
index 000000000000..88b878383797
--- /dev/null
+++ b/include/trace/events/ras.h
@@ -0,0 +1,77 @@
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM ras
3
4#if !defined(_TRACE_AER_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_AER_H
6
7#include <linux/tracepoint.h>
8#include <linux/edac.h>
9
10
11/*
12 * PCIe AER Trace event
13 *
14 * These events are generated when hardware detects a corrected or
15 * uncorrected event on a PCIe device. The event report has
16 * the following structure:
17 *
18 * char * dev_name - The name of the slot where the device resides
19 * ([domain:]bus:device.function).
20 * u32 status - Either the correctable or uncorrectable register
21 * indicating what error or errors have been seen
22 * u8 severity - error severity 0:NONFATAL 1:FATAL 2:CORRECTED
23 */
24
25#define aer_correctable_errors \
26 {BIT(0), "Receiver Error"}, \
27 {BIT(6), "Bad TLP"}, \
28 {BIT(7), "Bad DLLP"}, \
29 {BIT(8), "RELAY_NUM Rollover"}, \
30 {BIT(12), "Replay Timer Timeout"}, \
31 {BIT(13), "Advisory Non-Fatal"}
32
33#define aer_uncorrectable_errors \
34 {BIT(4), "Data Link Protocol"}, \
35 {BIT(12), "Poisoned TLP"}, \
36 {BIT(13), "Flow Control Protocol"}, \
37 {BIT(14), "Completion Timeout"}, \
38 {BIT(15), "Completer Abort"}, \
39 {BIT(16), "Unexpected Completion"}, \
40 {BIT(17), "Receiver Overflow"}, \
41 {BIT(18), "Malformed TLP"}, \
42 {BIT(19), "ECRC"}, \
43 {BIT(20), "Unsupported Request"}
44
45TRACE_EVENT(aer_event,
46 TP_PROTO(const char *dev_name,
47 const u32 status,
48 const u8 severity),
49
50 TP_ARGS(dev_name, status, severity),
51
52 TP_STRUCT__entry(
53 __string( dev_name, dev_name )
54 __field( u32, status )
55 __field( u8, severity )
56 ),
57
58 TP_fast_assign(
59 __assign_str(dev_name, dev_name);
60 __entry->status = status;
61 __entry->severity = severity;
62 ),
63
64 TP_printk("%s PCIe Bus Error: severity=%s, %s\n",
65 __get_str(dev_name),
66 __entry->severity == HW_EVENT_ERR_CORRECTED ? "Corrected" :
67 __entry->severity == HW_EVENT_ERR_FATAL ?
68 "Fatal" : "Uncorrected",
69 __entry->severity == HW_EVENT_ERR_CORRECTED ?
70 __print_flags(__entry->status, "|", aer_correctable_errors) :
71 __print_flags(__entry->status, "|", aer_uncorrectable_errors))
72);
73
74#endif /* _TRACE_AER_H */
75
76/* This part must be outside protection */
77#include <trace/define_trace.h>
diff --git a/include/trace/events/rcu.h b/include/trace/events/rcu.h
index d4f559b1ec34..1918e832da4f 100644
--- a/include/trace/events/rcu.h
+++ b/include/trace/events/rcu.h
@@ -44,8 +44,10 @@ TRACE_EVENT(rcu_utilization,
44 * of a new grace period or the end of an old grace period ("cpustart" 44 * of a new grace period or the end of an old grace period ("cpustart"
45 * and "cpuend", respectively), a CPU passing through a quiescent 45 * and "cpuend", respectively), a CPU passing through a quiescent
46 * state ("cpuqs"), a CPU coming online or going offline ("cpuonl" 46 * state ("cpuqs"), a CPU coming online or going offline ("cpuonl"
47 * and "cpuofl", respectively), and a CPU being kicked for being too 47 * and "cpuofl", respectively), a CPU being kicked for being too
48 * long in dyntick-idle mode ("kick"). 48 * long in dyntick-idle mode ("kick"), a CPU accelerating its new
49 * callbacks to RCU_NEXT_READY_TAIL ("AccReadyCB"), and a CPU
50 * accelerating its new callbacks to RCU_WAIT_TAIL ("AccWaitCB").
49 */ 51 */
50TRACE_EVENT(rcu_grace_period, 52TRACE_EVENT(rcu_grace_period,
51 53
@@ -393,7 +395,7 @@ TRACE_EVENT(rcu_kfree_callback,
393 */ 395 */
394TRACE_EVENT(rcu_batch_start, 396TRACE_EVENT(rcu_batch_start,
395 397
396 TP_PROTO(char *rcuname, long qlen_lazy, long qlen, int blimit), 398 TP_PROTO(char *rcuname, long qlen_lazy, long qlen, long blimit),
397 399
398 TP_ARGS(rcuname, qlen_lazy, qlen, blimit), 400 TP_ARGS(rcuname, qlen_lazy, qlen, blimit),
399 401
@@ -401,7 +403,7 @@ TRACE_EVENT(rcu_batch_start,
401 __field(char *, rcuname) 403 __field(char *, rcuname)
402 __field(long, qlen_lazy) 404 __field(long, qlen_lazy)
403 __field(long, qlen) 405 __field(long, qlen)
404 __field(int, blimit) 406 __field(long, blimit)
405 ), 407 ),
406 408
407 TP_fast_assign( 409 TP_fast_assign(
@@ -411,7 +413,7 @@ TRACE_EVENT(rcu_batch_start,
411 __entry->blimit = blimit; 413 __entry->blimit = blimit;
412 ), 414 ),
413 415
414 TP_printk("%s CBs=%ld/%ld bl=%d", 416 TP_printk("%s CBs=%ld/%ld bl=%ld",
415 __entry->rcuname, __entry->qlen_lazy, __entry->qlen, 417 __entry->rcuname, __entry->qlen_lazy, __entry->qlen,
416 __entry->blimit) 418 __entry->blimit)
417); 419);
@@ -523,22 +525,30 @@ TRACE_EVENT(rcu_batch_end,
523 */ 525 */
524TRACE_EVENT(rcu_torture_read, 526TRACE_EVENT(rcu_torture_read,
525 527
526 TP_PROTO(char *rcutorturename, struct rcu_head *rhp), 528 TP_PROTO(char *rcutorturename, struct rcu_head *rhp,
529 unsigned long secs, unsigned long c_old, unsigned long c),
527 530
528 TP_ARGS(rcutorturename, rhp), 531 TP_ARGS(rcutorturename, rhp, secs, c_old, c),
529 532
530 TP_STRUCT__entry( 533 TP_STRUCT__entry(
531 __field(char *, rcutorturename) 534 __field(char *, rcutorturename)
532 __field(struct rcu_head *, rhp) 535 __field(struct rcu_head *, rhp)
536 __field(unsigned long, secs)
537 __field(unsigned long, c_old)
538 __field(unsigned long, c)
533 ), 539 ),
534 540
535 TP_fast_assign( 541 TP_fast_assign(
536 __entry->rcutorturename = rcutorturename; 542 __entry->rcutorturename = rcutorturename;
537 __entry->rhp = rhp; 543 __entry->rhp = rhp;
544 __entry->secs = secs;
545 __entry->c_old = c_old;
546 __entry->c = c;
538 ), 547 ),
539 548
540 TP_printk("%s torture read %p", 549 TP_printk("%s torture read %p %luus c: %lu %lu",
541 __entry->rcutorturename, __entry->rhp) 550 __entry->rcutorturename, __entry->rhp,
551 __entry->secs, __entry->c_old, __entry->c)
542); 552);
543 553
544/* 554/*
@@ -608,7 +618,8 @@ TRACE_EVENT(rcu_barrier,
608#define trace_rcu_invoke_kfree_callback(rcuname, rhp, offset) do { } while (0) 618#define trace_rcu_invoke_kfree_callback(rcuname, rhp, offset) do { } while (0)
609#define trace_rcu_batch_end(rcuname, callbacks_invoked, cb, nr, iit, risk) \ 619#define trace_rcu_batch_end(rcuname, callbacks_invoked, cb, nr, iit, risk) \
610 do { } while (0) 620 do { } while (0)
611#define trace_rcu_torture_read(rcutorturename, rhp) do { } while (0) 621#define trace_rcu_torture_read(rcutorturename, rhp, secs, c_old, c) \
622 do { } while (0)
612#define trace_rcu_barrier(name, s, cpu, cnt, done) do { } while (0) 623#define trace_rcu_barrier(name, s, cpu, cnt, done) do { } while (0)
613 624
614#endif /* #else #ifdef CONFIG_RCU_TRACE */ 625#endif /* #else #ifdef CONFIG_RCU_TRACE */
diff --git a/include/trace/events/workqueue.h b/include/trace/events/workqueue.h
index f28d1b65f178..bf0e18ba6cfb 100644
--- a/include/trace/events/workqueue.h
+++ b/include/trace/events/workqueue.h
@@ -27,7 +27,7 @@ DECLARE_EVENT_CLASS(workqueue_work,
27/** 27/**
28 * workqueue_queue_work - called when a work gets queued 28 * workqueue_queue_work - called when a work gets queued
29 * @req_cpu: the requested cpu 29 * @req_cpu: the requested cpu
30 * @cwq: pointer to struct cpu_workqueue_struct 30 * @pwq: pointer to struct pool_workqueue
31 * @work: pointer to struct work_struct 31 * @work: pointer to struct work_struct
32 * 32 *
33 * This event occurs when a work is queued immediately or once a 33 * This event occurs when a work is queued immediately or once a
@@ -36,10 +36,10 @@ DECLARE_EVENT_CLASS(workqueue_work,
36 */ 36 */
37TRACE_EVENT(workqueue_queue_work, 37TRACE_EVENT(workqueue_queue_work,
38 38
39 TP_PROTO(unsigned int req_cpu, struct cpu_workqueue_struct *cwq, 39 TP_PROTO(unsigned int req_cpu, struct pool_workqueue *pwq,
40 struct work_struct *work), 40 struct work_struct *work),
41 41
42 TP_ARGS(req_cpu, cwq, work), 42 TP_ARGS(req_cpu, pwq, work),
43 43
44 TP_STRUCT__entry( 44 TP_STRUCT__entry(
45 __field( void *, work ) 45 __field( void *, work )
@@ -52,9 +52,9 @@ TRACE_EVENT(workqueue_queue_work,
52 TP_fast_assign( 52 TP_fast_assign(
53 __entry->work = work; 53 __entry->work = work;
54 __entry->function = work->func; 54 __entry->function = work->func;
55 __entry->workqueue = cwq->wq; 55 __entry->workqueue = pwq->wq;
56 __entry->req_cpu = req_cpu; 56 __entry->req_cpu = req_cpu;
57 __entry->cpu = cwq->pool->gcwq->cpu; 57 __entry->cpu = pwq->pool->cpu;
58 ), 58 ),
59 59
60 TP_printk("work struct=%p function=%pf workqueue=%p req_cpu=%u cpu=%u", 60 TP_printk("work struct=%p function=%pf workqueue=%p req_cpu=%u cpu=%u",
diff --git a/include/uapi/asm-generic/socket.h b/include/uapi/asm-generic/socket.h
index 2d32d073a6f9..4ef3acbba5da 100644
--- a/include/uapi/asm-generic/socket.h
+++ b/include/uapi/asm-generic/socket.h
@@ -22,8 +22,7 @@
22#define SO_PRIORITY 12 22#define SO_PRIORITY 12
23#define SO_LINGER 13 23#define SO_LINGER 13
24#define SO_BSDCOMPAT 14 24#define SO_BSDCOMPAT 14
25/* To add :#define SO_REUSEPORT 15 */ 25#define SO_REUSEPORT 15
26
27#ifndef SO_PASSCRED /* powerpc only differs in these */ 26#ifndef SO_PASSCRED /* powerpc only differs in these */
28#define SO_PASSCRED 16 27#define SO_PASSCRED 16
29#define SO_PEERCRED 17 28#define SO_PEERCRED 17
@@ -73,4 +72,6 @@
73/* Instruct lower device to use last 4-bytes of skb data as FCS */ 72/* Instruct lower device to use last 4-bytes of skb data as FCS */
74#define SO_NOFCS 43 73#define SO_NOFCS 43
75 74
75#define SO_LOCK_FILTER 44
76
76#endif /* __ASM_GENERIC_SOCKET_H */ 77#endif /* __ASM_GENERIC_SOCKET_H */
diff --git a/include/uapi/linux/auto_fs.h b/include/uapi/linux/auto_fs.h
index 77cdba9df274..bb991dfe134f 100644
--- a/include/uapi/linux/auto_fs.h
+++ b/include/uapi/linux/auto_fs.h
@@ -28,25 +28,16 @@
28#define AUTOFS_MIN_PROTO_VERSION AUTOFS_PROTO_VERSION 28#define AUTOFS_MIN_PROTO_VERSION AUTOFS_PROTO_VERSION
29 29
30/* 30/*
31 * Architectures where both 32- and 64-bit binaries can be executed 31 * The wait_queue_token (autofs_wqt_t) is part of a structure which is passed
32 * on 64-bit kernels need this. This keeps the structure format 32 * back to the kernel via ioctl from userspace. On architectures where 32- and
33 * uniform, and makes sure the wait_queue_token isn't too big to be 33 * 64-bit userspace binaries can be executed it's important that the size of
34 * passed back down to the kernel. 34 * autofs_wqt_t stays constant between 32- and 64-bit Linux kernels so that we
35 * 35 * do not break the binary ABI interface by changing the structure size.
36 * This assumes that on these architectures:
37 * mode 32 bit 64 bit
38 * -------------------------
39 * int 32 bit 32 bit
40 * long 32 bit 64 bit
41 *
42 * If so, 32-bit user-space code should be backwards compatible.
43 */ 36 */
44 37#if defined(__ia64__) || defined(__alpha__) /* pure 64bit architectures */
45#if defined(__sparc__) || defined(__mips__) || defined(__x86_64__) \
46 || defined(__powerpc__) || defined(__s390__)
47typedef unsigned int autofs_wqt_t;
48#else
49typedef unsigned long autofs_wqt_t; 38typedef unsigned long autofs_wqt_t;
39#else
40typedef unsigned int autofs_wqt_t;
50#endif 41#endif
51 42
52/* Packet types */ 43/* Packet types */
diff --git a/include/uapi/linux/can/gw.h b/include/uapi/linux/can/gw.h
index 8e1db18c3cb6..ae07bec74f4b 100644
--- a/include/uapi/linux/can/gw.h
+++ b/include/uapi/linux/can/gw.h
@@ -44,6 +44,7 @@ enum {
44 CGW_SRC_IF, /* ifindex of source network interface */ 44 CGW_SRC_IF, /* ifindex of source network interface */
45 CGW_DST_IF, /* ifindex of destination network interface */ 45 CGW_DST_IF, /* ifindex of destination network interface */
46 CGW_FILTER, /* specify struct can_filter on source CAN device */ 46 CGW_FILTER, /* specify struct can_filter on source CAN device */
47 CGW_DELETED, /* number of deleted CAN frames (see max_hops param) */
47 __CGW_MAX 48 __CGW_MAX
48}; 49};
49 50
@@ -51,6 +52,7 @@ enum {
51 52
52#define CGW_FLAGS_CAN_ECHO 0x01 53#define CGW_FLAGS_CAN_ECHO 0x01
53#define CGW_FLAGS_CAN_SRC_TSTAMP 0x02 54#define CGW_FLAGS_CAN_SRC_TSTAMP 0x02
55#define CGW_FLAGS_CAN_IIF_TX_OK 0x04
54 56
55#define CGW_MOD_FUNCS 4 /* AND OR XOR SET */ 57#define CGW_MOD_FUNCS 4 /* AND OR XOR SET */
56 58
diff --git a/include/uapi/linux/elf.h b/include/uapi/linux/elf.h
index 126a8175e3e2..900b9484445b 100644
--- a/include/uapi/linux/elf.h
+++ b/include/uapi/linux/elf.h
@@ -49,14 +49,14 @@ typedef __s64 Elf64_Sxword;
49 * 49 *
50 * Specifications are available in: 50 * Specifications are available in:
51 * 51 *
52 * - Sun microsystems: Linker and Libraries. 52 * - Oracle: Linker and Libraries.
53 * Part No: 817-1984-17, September 2008. 53 * Part No: 817–1984–19, August 2011.
54 * URL: http://docs.sun.com/app/docs/doc/817-1984 54 * http://docs.oracle.com/cd/E18752_01/pdf/817-1984.pdf
55 * 55 *
56 * - System V ABI AMD64 Architecture Processor Supplement 56 * - System V ABI AMD64 Architecture Processor Supplement
57 * Draft Version 0.99., 57 * Draft Version 0.99.4,
58 * May 11, 2009. 58 * January 13, 2010.
59 * URL: http://www.x86-64.org/ 59 * http://www.cs.washington.edu/education/courses/cse351/12wi/supp-docs/abi.pdf
60 */ 60 */
61#define PN_XNUM 0xffff 61#define PN_XNUM 0xffff
62 62
diff --git a/include/uapi/linux/fs.h b/include/uapi/linux/fs.h
index 780d4c6093eb..c7fc1e6517c3 100644
--- a/include/uapi/linux/fs.h
+++ b/include/uapi/linux/fs.h
@@ -86,6 +86,9 @@ struct inodes_stat_t {
86#define MS_KERNMOUNT (1<<22) /* this is a kern_mount call */ 86#define MS_KERNMOUNT (1<<22) /* this is a kern_mount call */
87#define MS_I_VERSION (1<<23) /* Update inode I_version field */ 87#define MS_I_VERSION (1<<23) /* Update inode I_version field */
88#define MS_STRICTATIME (1<<24) /* Always perform atime updates */ 88#define MS_STRICTATIME (1<<24) /* Always perform atime updates */
89
90/* These sb flags are internal to the kernel */
91#define MS_SNAP_STABLE (1<<27) /* Snapshot pages during writeback, if needed */
89#define MS_NOSEC (1<<28) 92#define MS_NOSEC (1<<28)
90#define MS_BORN (1<<29) 93#define MS_BORN (1<<29)
91#define MS_ACTIVE (1<<30) 94#define MS_ACTIVE (1<<30)
diff --git a/include/uapi/linux/fuse.h b/include/uapi/linux/fuse.h
index d8c713e148e3..4c43b4448792 100644
--- a/include/uapi/linux/fuse.h
+++ b/include/uapi/linux/fuse.h
@@ -1,9 +1,35 @@
1/* 1/*
2 FUSE: Filesystem in Userspace 2 This file defines the kernel interface of FUSE
3 Copyright (C) 2001-2008 Miklos Szeredi <miklos@szeredi.hu> 3 Copyright (C) 2001-2008 Miklos Szeredi <miklos@szeredi.hu>
4 4
5 This program can be distributed under the terms of the GNU GPL. 5 This program can be distributed under the terms of the GNU GPL.
6 See the file COPYING. 6 See the file COPYING.
7
8 This -- and only this -- header file may also be distributed under
9 the terms of the BSD Licence as follows:
10
11 Copyright (C) 2001-2007 Miklos Szeredi. All rights reserved.
12
13 Redistribution and use in source and binary forms, with or without
14 modification, are permitted provided that the following conditions
15 are met:
16 1. Redistributions of source code must retain the above copyright
17 notice, this list of conditions and the following disclaimer.
18 2. Redistributions in binary form must reproduce the above copyright
19 notice, this list of conditions and the following disclaimer in the
20 documentation and/or other materials provided with the distribution.
21
22 THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
23 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
26 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 SUCH DAMAGE.
7*/ 33*/
8 34
9/* 35/*
@@ -60,12 +86,25 @@
60 * 86 *
61 * 7.20 87 * 7.20
62 * - add FUSE_AUTO_INVAL_DATA 88 * - add FUSE_AUTO_INVAL_DATA
89 *
90 * 7.21
91 * - add FUSE_READDIRPLUS
92 * - send the requested events in POLL request
63 */ 93 */
64 94
65#ifndef _LINUX_FUSE_H 95#ifndef _LINUX_FUSE_H
66#define _LINUX_FUSE_H 96#define _LINUX_FUSE_H
67 97
98#ifdef __linux__
68#include <linux/types.h> 99#include <linux/types.h>
100#else
101#include <stdint.h>
102#define __u64 uint64_t
103#define __s64 int64_t
104#define __u32 uint32_t
105#define __s32 int32_t
106#define __u16 uint16_t
107#endif
69 108
70/* 109/*
71 * Version negotiation: 110 * Version negotiation:
@@ -91,7 +130,7 @@
91#define FUSE_KERNEL_VERSION 7 130#define FUSE_KERNEL_VERSION 7
92 131
93/** Minor version number of this interface */ 132/** Minor version number of this interface */
94#define FUSE_KERNEL_MINOR_VERSION 20 133#define FUSE_KERNEL_MINOR_VERSION 21
95 134
96/** The node ID of the root inode */ 135/** The node ID of the root inode */
97#define FUSE_ROOT_ID 1 136#define FUSE_ROOT_ID 1
@@ -179,6 +218,8 @@ struct fuse_file_lock {
179 * FUSE_FLOCK_LOCKS: remote locking for BSD style file locks 218 * FUSE_FLOCK_LOCKS: remote locking for BSD style file locks
180 * FUSE_HAS_IOCTL_DIR: kernel supports ioctl on directories 219 * FUSE_HAS_IOCTL_DIR: kernel supports ioctl on directories
181 * FUSE_AUTO_INVAL_DATA: automatically invalidate cached pages 220 * FUSE_AUTO_INVAL_DATA: automatically invalidate cached pages
221 * FUSE_DO_READDIRPLUS: do READDIRPLUS (READDIR+LOOKUP in one)
222 * FUSE_READDIRPLUS_AUTO: adaptive readdirplus
182 */ 223 */
183#define FUSE_ASYNC_READ (1 << 0) 224#define FUSE_ASYNC_READ (1 << 0)
184#define FUSE_POSIX_LOCKS (1 << 1) 225#define FUSE_POSIX_LOCKS (1 << 1)
@@ -193,6 +234,8 @@ struct fuse_file_lock {
193#define FUSE_FLOCK_LOCKS (1 << 10) 234#define FUSE_FLOCK_LOCKS (1 << 10)
194#define FUSE_HAS_IOCTL_DIR (1 << 11) 235#define FUSE_HAS_IOCTL_DIR (1 << 11)
195#define FUSE_AUTO_INVAL_DATA (1 << 12) 236#define FUSE_AUTO_INVAL_DATA (1 << 12)
237#define FUSE_DO_READDIRPLUS (1 << 13)
238#define FUSE_READDIRPLUS_AUTO (1 << 14)
196 239
197/** 240/**
198 * CUSE INIT request/reply flags 241 * CUSE INIT request/reply flags
@@ -299,6 +342,7 @@ enum fuse_opcode {
299 FUSE_NOTIFY_REPLY = 41, 342 FUSE_NOTIFY_REPLY = 41,
300 FUSE_BATCH_FORGET = 42, 343 FUSE_BATCH_FORGET = 42,
301 FUSE_FALLOCATE = 43, 344 FUSE_FALLOCATE = 43,
345 FUSE_READDIRPLUS = 44,
302 346
303 /* CUSE specific operations */ 347 /* CUSE specific operations */
304 CUSE_INIT = 4096, 348 CUSE_INIT = 4096,
@@ -580,7 +624,7 @@ struct fuse_poll_in {
580 __u64 fh; 624 __u64 fh;
581 __u64 kh; 625 __u64 kh;
582 __u32 flags; 626 __u32 flags;
583 __u32 padding; 627 __u32 events;
584}; 628};
585 629
586struct fuse_poll_out { 630struct fuse_poll_out {
@@ -630,6 +674,16 @@ struct fuse_dirent {
630#define FUSE_DIRENT_SIZE(d) \ 674#define FUSE_DIRENT_SIZE(d) \
631 FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET + (d)->namelen) 675 FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET + (d)->namelen)
632 676
677struct fuse_direntplus {
678 struct fuse_entry_out entry_out;
679 struct fuse_dirent dirent;
680};
681
682#define FUSE_NAME_OFFSET_DIRENTPLUS \
683 offsetof(struct fuse_direntplus, dirent.name)
684#define FUSE_DIRENTPLUS_SIZE(d) \
685 FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET_DIRENTPLUS + (d)->dirent.namelen)
686
633struct fuse_notify_inval_inode_out { 687struct fuse_notify_inval_inode_out {
634 __u64 ino; 688 __u64 ino;
635 __s64 off; 689 __s64 off;
diff --git a/include/uapi/linux/if_bridge.h b/include/uapi/linux/if_bridge.h
index 5db297514aec..2d70d79ce2fd 100644
--- a/include/uapi/linux/if_bridge.h
+++ b/include/uapi/linux/if_bridge.h
@@ -108,15 +108,26 @@ struct __fdb_entry {
108 * [IFLA_AF_SPEC] = { 108 * [IFLA_AF_SPEC] = {
109 * [IFLA_BRIDGE_FLAGS] 109 * [IFLA_BRIDGE_FLAGS]
110 * [IFLA_BRIDGE_MODE] 110 * [IFLA_BRIDGE_MODE]
111 * [IFLA_BRIDGE_VLAN_INFO]
111 * } 112 * }
112 */ 113 */
113enum { 114enum {
114 IFLA_BRIDGE_FLAGS, 115 IFLA_BRIDGE_FLAGS,
115 IFLA_BRIDGE_MODE, 116 IFLA_BRIDGE_MODE,
117 IFLA_BRIDGE_VLAN_INFO,
116 __IFLA_BRIDGE_MAX, 118 __IFLA_BRIDGE_MAX,
117}; 119};
118#define IFLA_BRIDGE_MAX (__IFLA_BRIDGE_MAX - 1) 120#define IFLA_BRIDGE_MAX (__IFLA_BRIDGE_MAX - 1)
119 121
122#define BRIDGE_VLAN_INFO_MASTER (1<<0) /* Operate on Bridge device as well */
123#define BRIDGE_VLAN_INFO_PVID (1<<1) /* VLAN is PVID, ingress untagged */
124#define BRIDGE_VLAN_INFO_UNTAGGED (1<<2) /* VLAN egresses untagged */
125
126struct bridge_vlan_info {
127 __u16 flags;
128 __u16 vid;
129};
130
120/* Bridge multicast database attributes 131/* Bridge multicast database attributes
121 * [MDBA_MDB] = { 132 * [MDBA_MDB] = {
122 * [MDBA_MDB_ENTRY] = { 133 * [MDBA_MDB_ENTRY] = {
diff --git a/include/uapi/linux/if_ether.h b/include/uapi/linux/if_ether.h
index 67fb87ca1094..798032d01112 100644
--- a/include/uapi/linux/if_ether.h
+++ b/include/uapi/linux/if_ether.h
@@ -83,6 +83,7 @@
83#define ETH_P_802_EX1 0x88B5 /* 802.1 Local Experimental 1. */ 83#define ETH_P_802_EX1 0x88B5 /* 802.1 Local Experimental 1. */
84#define ETH_P_TIPC 0x88CA /* TIPC */ 84#define ETH_P_TIPC 0x88CA /* TIPC */
85#define ETH_P_8021AH 0x88E7 /* 802.1ah Backbone Service Tag */ 85#define ETH_P_8021AH 0x88E7 /* 802.1ah Backbone Service Tag */
86#define ETH_P_MVRP 0x88F5 /* 802.1Q MVRP */
86#define ETH_P_1588 0x88F7 /* IEEE 1588 Timesync */ 87#define ETH_P_1588 0x88F7 /* IEEE 1588 Timesync */
87#define ETH_P_FCOE 0x8906 /* Fibre Channel over Ethernet */ 88#define ETH_P_FCOE 0x8906 /* Fibre Channel over Ethernet */
88#define ETH_P_TDLS 0x890D /* TDLS */ 89#define ETH_P_TDLS 0x890D /* TDLS */
diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
index 60f3b6b90602..c4edfe11f1f7 100644
--- a/include/uapi/linux/if_link.h
+++ b/include/uapi/linux/if_link.h
@@ -142,6 +142,7 @@ enum {
142#define IFLA_PROMISCUITY IFLA_PROMISCUITY 142#define IFLA_PROMISCUITY IFLA_PROMISCUITY
143 IFLA_NUM_TX_QUEUES, 143 IFLA_NUM_TX_QUEUES,
144 IFLA_NUM_RX_QUEUES, 144 IFLA_NUM_RX_QUEUES,
145 IFLA_CARRIER,
145 __IFLA_MAX 146 __IFLA_MAX
146}; 147};
147 148
diff --git a/include/uapi/linux/if_vlan.h b/include/uapi/linux/if_vlan.h
index 0744f8e65d15..7e5e6b397332 100644
--- a/include/uapi/linux/if_vlan.h
+++ b/include/uapi/linux/if_vlan.h
@@ -34,6 +34,7 @@ enum vlan_flags {
34 VLAN_FLAG_REORDER_HDR = 0x1, 34 VLAN_FLAG_REORDER_HDR = 0x1,
35 VLAN_FLAG_GVRP = 0x2, 35 VLAN_FLAG_GVRP = 0x2,
36 VLAN_FLAG_LOOSE_BINDING = 0x4, 36 VLAN_FLAG_LOOSE_BINDING = 0x4,
37 VLAN_FLAG_MVRP = 0x8,
37}; 38};
38 39
39enum vlan_name_types { 40enum vlan_name_types {
diff --git a/include/uapi/linux/in6.h b/include/uapi/linux/in6.h
index f79c3721da6e..53b1d56a6e7f 100644
--- a/include/uapi/linux/in6.h
+++ b/include/uapi/linux/in6.h
@@ -38,11 +38,6 @@ struct in6_addr {
38#define s6_addr32 in6_u.u6_addr32 38#define s6_addr32 in6_u.u6_addr32
39}; 39};
40 40
41/* IPv6 Wildcard Address (::) and Loopback Address (::1) defined in RFC2553
42 * NOTE: Be aware the IN6ADDR_* constants and in6addr_* externals are defined
43 * in network byte order, not in host byte order as are the IPv4 equivalents
44 */
45
46struct sockaddr_in6 { 41struct sockaddr_in6 {
47 unsigned short int sin6_family; /* AF_INET6 */ 42 unsigned short int sin6_family; /* AF_INET6 */
48 __be16 sin6_port; /* Transport layer port # */ 43 __be16 sin6_port; /* Transport layer port # */
@@ -264,17 +259,10 @@ struct in6_flowlabel_req {
264 259
265/* 260/*
266 * Multicast Routing: 261 * Multicast Routing:
267 * see include/linux/mroute6.h. 262 * see include/uapi/linux/mroute6.h.
268 * 263 *
269 * MRT6_INIT 200 264 * MRT6_BASE 200
270 * MRT6_DONE 201 265 * ...
271 * MRT6_ADD_MIF 202 266 * MRT6_MAX
272 * MRT6_DEL_MIF 203
273 * MRT6_ADD_MFC 204
274 * MRT6_DEL_MFC 205
275 * MRT6_VERSION 206
276 * MRT6_ASSERT 207
277 * MRT6_PIM 208
278 * (reserved) 209
279 */ 267 */
280#endif /* _UAPI_LINUX_IN6_H */ 268#endif /* _UAPI_LINUX_IN6_H */
diff --git a/include/uapi/linux/ipv6.h b/include/uapi/linux/ipv6.h
index 5a2991cf0251..4bda4cf5b0f5 100644
--- a/include/uapi/linux/ipv6.h
+++ b/include/uapi/linux/ipv6.h
@@ -63,6 +63,8 @@ struct ipv6_opt_hdr {
63#define ipv6_destopt_hdr ipv6_opt_hdr 63#define ipv6_destopt_hdr ipv6_opt_hdr
64#define ipv6_hopopt_hdr ipv6_opt_hdr 64#define ipv6_hopopt_hdr ipv6_opt_hdr
65 65
66/* Router Alert option values (RFC2711) */
67#define IPV6_OPT_ROUTERALERT_MLD 0x0000 /* MLD(RFC2710) */
66 68
67/* 69/*
68 * routing header type 0 (used in cmsghdr struct) 70 * routing header type 0 (used in cmsghdr struct)
diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
index e6e5d4b13708..c70577cf67bc 100644
--- a/include/uapi/linux/kvm.h
+++ b/include/uapi/linux/kvm.h
@@ -115,6 +115,7 @@ struct kvm_irq_level {
115 * ACPI gsi notion of irq. 115 * ACPI gsi notion of irq.
116 * For IA-64 (APIC model) IOAPIC0: irq 0-23; IOAPIC1: irq 24-47.. 116 * For IA-64 (APIC model) IOAPIC0: irq 0-23; IOAPIC1: irq 24-47..
117 * For X86 (standard AT mode) PIC0/1: irq 0-15. IOAPIC0: 0-23.. 117 * For X86 (standard AT mode) PIC0/1: irq 0-15. IOAPIC0: 0-23..
118 * For ARM: See Documentation/virtual/kvm/api.txt
118 */ 119 */
119 union { 120 union {
120 __u32 irq; 121 __u32 irq;
@@ -635,6 +636,8 @@ struct kvm_ppc_smmu_info {
635#define KVM_CAP_IRQFD_RESAMPLE 82 636#define KVM_CAP_IRQFD_RESAMPLE 82
636#define KVM_CAP_PPC_BOOKE_WATCHDOG 83 637#define KVM_CAP_PPC_BOOKE_WATCHDOG 83
637#define KVM_CAP_PPC_HTAB_FD 84 638#define KVM_CAP_PPC_HTAB_FD 84
639#define KVM_CAP_ARM_PSCI 87
640#define KVM_CAP_ARM_SET_DEVICE_ADDR 88
638 641
639#ifdef KVM_CAP_IRQ_ROUTING 642#ifdef KVM_CAP_IRQ_ROUTING
640 643
@@ -764,6 +767,11 @@ struct kvm_dirty_tlb {
764#define KVM_REG_SIZE_U512 0x0060000000000000ULL 767#define KVM_REG_SIZE_U512 0x0060000000000000ULL
765#define KVM_REG_SIZE_U1024 0x0070000000000000ULL 768#define KVM_REG_SIZE_U1024 0x0070000000000000ULL
766 769
770struct kvm_reg_list {
771 __u64 n; /* number of regs */
772 __u64 reg[0];
773};
774
767struct kvm_one_reg { 775struct kvm_one_reg {
768 __u64 id; 776 __u64 id;
769 __u64 addr; 777 __u64 addr;
@@ -777,6 +785,11 @@ struct kvm_msi {
777 __u8 pad[16]; 785 __u8 pad[16];
778}; 786};
779 787
788struct kvm_arm_device_addr {
789 __u64 id;
790 __u64 addr;
791};
792
780/* 793/*
781 * ioctls for VM fds 794 * ioctls for VM fds
782 */ 795 */
@@ -862,6 +875,8 @@ struct kvm_s390_ucas_mapping {
862#define KVM_ALLOCATE_RMA _IOR(KVMIO, 0xa9, struct kvm_allocate_rma) 875#define KVM_ALLOCATE_RMA _IOR(KVMIO, 0xa9, struct kvm_allocate_rma)
863/* Available with KVM_CAP_PPC_HTAB_FD */ 876/* Available with KVM_CAP_PPC_HTAB_FD */
864#define KVM_PPC_GET_HTAB_FD _IOW(KVMIO, 0xaa, struct kvm_get_htab_fd) 877#define KVM_PPC_GET_HTAB_FD _IOW(KVMIO, 0xaa, struct kvm_get_htab_fd)
878/* Available with KVM_CAP_ARM_SET_DEVICE_ADDR */
879#define KVM_ARM_SET_DEVICE_ADDR _IOW(KVMIO, 0xab, struct kvm_arm_device_addr)
865 880
866/* 881/*
867 * ioctls for vcpu fds 882 * ioctls for vcpu fds
@@ -932,6 +947,8 @@ struct kvm_s390_ucas_mapping {
932#define KVM_SET_ONE_REG _IOW(KVMIO, 0xac, struct kvm_one_reg) 947#define KVM_SET_ONE_REG _IOW(KVMIO, 0xac, struct kvm_one_reg)
933/* VM is being stopped by host */ 948/* VM is being stopped by host */
934#define KVM_KVMCLOCK_CTRL _IO(KVMIO, 0xad) 949#define KVM_KVMCLOCK_CTRL _IO(KVMIO, 0xad)
950#define KVM_ARM_VCPU_INIT _IOW(KVMIO, 0xae, struct kvm_vcpu_init)
951#define KVM_GET_REG_LIST _IOWR(KVMIO, 0xb0, struct kvm_reg_list)
935 952
936#define KVM_DEV_ASSIGN_ENABLE_IOMMU (1 << 0) 953#define KVM_DEV_ASSIGN_ENABLE_IOMMU (1 << 0)
937#define KVM_DEV_ASSIGN_PCI_2_3 (1 << 1) 954#define KVM_DEV_ASSIGN_PCI_2_3 (1 << 1)
diff --git a/include/uapi/linux/mroute.h b/include/uapi/linux/mroute.h
index 16929993acc4..a382d2c04a42 100644
--- a/include/uapi/linux/mroute.h
+++ b/include/uapi/linux/mroute.h
@@ -26,6 +26,9 @@
26#define MRT_ASSERT (MRT_BASE+7) /* Activate PIM assert mode */ 26#define MRT_ASSERT (MRT_BASE+7) /* Activate PIM assert mode */
27#define MRT_PIM (MRT_BASE+8) /* enable PIM code */ 27#define MRT_PIM (MRT_BASE+8) /* enable PIM code */
28#define MRT_TABLE (MRT_BASE+9) /* Specify mroute table ID */ 28#define MRT_TABLE (MRT_BASE+9) /* Specify mroute table ID */
29#define MRT_ADD_MFC_PROXY (MRT_BASE+10) /* Add a (*,*|G) mfc entry */
30#define MRT_DEL_MFC_PROXY (MRT_BASE+11) /* Del a (*,*|G) mfc entry */
31#define MRT_MAX (MRT_BASE+11)
29 32
30#define SIOCGETVIFCNT SIOCPROTOPRIVATE /* IP protocol privates */ 33#define SIOCGETVIFCNT SIOCPROTOPRIVATE /* IP protocol privates */
31#define SIOCGETSGCNT (SIOCPROTOPRIVATE+1) 34#define SIOCGETSGCNT (SIOCPROTOPRIVATE+1)
diff --git a/include/uapi/linux/mroute6.h b/include/uapi/linux/mroute6.h
index 3e89b5e7f9e3..ce91215cf7e6 100644
--- a/include/uapi/linux/mroute6.h
+++ b/include/uapi/linux/mroute6.h
@@ -26,6 +26,9 @@
26#define MRT6_ASSERT (MRT6_BASE+7) /* Activate PIM assert mode */ 26#define MRT6_ASSERT (MRT6_BASE+7) /* Activate PIM assert mode */
27#define MRT6_PIM (MRT6_BASE+8) /* enable PIM code */ 27#define MRT6_PIM (MRT6_BASE+8) /* enable PIM code */
28#define MRT6_TABLE (MRT6_BASE+9) /* Specify mroute table ID */ 28#define MRT6_TABLE (MRT6_BASE+9) /* Specify mroute table ID */
29#define MRT6_ADD_MFC_PROXY (MRT6_BASE+10) /* Add a (*,*|G) mfc entry */
30#define MRT6_DEL_MFC_PROXY (MRT6_BASE+11) /* Del a (*,*|G) mfc entry */
31#define MRT6_MAX (MRT6_BASE+11)
29 32
30#define SIOCGETMIFCNT_IN6 SIOCPROTOPRIVATE /* IP protocol privates */ 33#define SIOCGETMIFCNT_IN6 SIOCPROTOPRIVATE /* IP protocol privates */
31#define SIOCGETSGCNT_IN6 (SIOCPROTOPRIVATE+1) 34#define SIOCGETSGCNT_IN6 (SIOCPROTOPRIVATE+1)
diff --git a/include/uapi/linux/neighbour.h b/include/uapi/linux/neighbour.h
index 275e5d65dcb2..adb068c53c4e 100644
--- a/include/uapi/linux/neighbour.h
+++ b/include/uapi/linux/neighbour.h
@@ -20,6 +20,7 @@ enum {
20 NDA_LLADDR, 20 NDA_LLADDR,
21 NDA_CACHEINFO, 21 NDA_CACHEINFO,
22 NDA_PROBES, 22 NDA_PROBES,
23 NDA_VLAN,
23 __NDA_MAX 24 __NDA_MAX
24}; 25};
25 26
diff --git a/include/uapi/linux/netfilter/Kbuild b/include/uapi/linux/netfilter/Kbuild
index 08f555fef13f..41115776d76f 100644
--- a/include/uapi/linux/netfilter/Kbuild
+++ b/include/uapi/linux/netfilter/Kbuild
@@ -35,9 +35,11 @@ header-y += xt_TCPOPTSTRIP.h
35header-y += xt_TEE.h 35header-y += xt_TEE.h
36header-y += xt_TPROXY.h 36header-y += xt_TPROXY.h
37header-y += xt_addrtype.h 37header-y += xt_addrtype.h
38header-y += xt_bpf.h
38header-y += xt_cluster.h 39header-y += xt_cluster.h
39header-y += xt_comment.h 40header-y += xt_comment.h
40header-y += xt_connbytes.h 41header-y += xt_connbytes.h
42header-y += xt_connlabel.h
41header-y += xt_connlimit.h 43header-y += xt_connlimit.h
42header-y += xt_connmark.h 44header-y += xt_connmark.h
43header-y += xt_conntrack.h 45header-y += xt_conntrack.h
diff --git a/include/uapi/linux/netfilter/nf_conntrack_common.h b/include/uapi/linux/netfilter/nf_conntrack_common.h
index 1644cdd8be91..d69483fb3825 100644
--- a/include/uapi/linux/netfilter/nf_conntrack_common.h
+++ b/include/uapi/linux/netfilter/nf_conntrack_common.h
@@ -101,6 +101,7 @@ enum ip_conntrack_events {
101 IPCT_MARK, /* new mark has been set */ 101 IPCT_MARK, /* new mark has been set */
102 IPCT_NATSEQADJ, /* NAT is doing sequence adjustment */ 102 IPCT_NATSEQADJ, /* NAT is doing sequence adjustment */
103 IPCT_SECMARK, /* new security mark has been set */ 103 IPCT_SECMARK, /* new security mark has been set */
104 IPCT_LABEL, /* new connlabel has been set */
104}; 105};
105 106
106enum ip_conntrack_expect_events { 107enum ip_conntrack_expect_events {
diff --git a/include/uapi/linux/netfilter/nfnetlink_conntrack.h b/include/uapi/linux/netfilter/nfnetlink_conntrack.h
index 86e930cf3dfb..08fabc6c93f3 100644
--- a/include/uapi/linux/netfilter/nfnetlink_conntrack.h
+++ b/include/uapi/linux/netfilter/nfnetlink_conntrack.h
@@ -49,6 +49,8 @@ enum ctattr_type {
49 CTA_SECCTX, 49 CTA_SECCTX,
50 CTA_TIMESTAMP, 50 CTA_TIMESTAMP,
51 CTA_MARK_MASK, 51 CTA_MARK_MASK,
52 CTA_LABELS,
53 CTA_LABELS_MASK,
52 __CTA_MAX 54 __CTA_MAX
53}; 55};
54#define CTA_MAX (__CTA_MAX - 1) 56#define CTA_MAX (__CTA_MAX - 1)
diff --git a/include/uapi/linux/netfilter/xt_CT.h b/include/uapi/linux/netfilter/xt_CT.h
index a064b8af360c..5a688c1ca4d7 100644
--- a/include/uapi/linux/netfilter/xt_CT.h
+++ b/include/uapi/linux/netfilter/xt_CT.h
@@ -3,7 +3,11 @@
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5 5
6#define XT_CT_NOTRACK 0x1 6enum {
7 XT_CT_NOTRACK = 1 << 0,
8 XT_CT_NOTRACK_ALIAS = 1 << 1,
9 XT_CT_MASK = XT_CT_NOTRACK | XT_CT_NOTRACK_ALIAS,
10};
7 11
8struct xt_ct_target_info { 12struct xt_ct_target_info {
9 __u16 flags; 13 __u16 flags;
diff --git a/include/uapi/linux/netfilter/xt_bpf.h b/include/uapi/linux/netfilter/xt_bpf.h
new file mode 100644
index 000000000000..5dda450eb55b
--- /dev/null
+++ b/include/uapi/linux/netfilter/xt_bpf.h
@@ -0,0 +1,17 @@
1#ifndef _XT_BPF_H
2#define _XT_BPF_H
3
4#include <linux/filter.h>
5#include <linux/types.h>
6
7#define XT_BPF_MAX_NUM_INSTR 64
8
9struct xt_bpf_info {
10 __u16 bpf_program_num_elem;
11 struct sock_filter bpf_program[XT_BPF_MAX_NUM_INSTR];
12
13 /* only used in the kernel */
14 struct sk_filter *filter __attribute__((aligned(8)));
15};
16
17#endif /*_XT_BPF_H */
diff --git a/include/uapi/linux/netfilter/xt_connlabel.h b/include/uapi/linux/netfilter/xt_connlabel.h
new file mode 100644
index 000000000000..c4bc9ee9b330
--- /dev/null
+++ b/include/uapi/linux/netfilter/xt_connlabel.h
@@ -0,0 +1,12 @@
1#include <linux/types.h>
2
3#define XT_CONNLABEL_MAXBIT 127
4enum xt_connlabel_mtopts {
5 XT_CONNLABEL_OP_INVERT = 1 << 0,
6 XT_CONNLABEL_OP_SET = 1 << 1,
7};
8
9struct xt_connlabel_mtinfo {
10 __u16 bit;
11 __u16 options;
12};
diff --git a/include/uapi/linux/netfilter/xt_conntrack.h b/include/uapi/linux/netfilter/xt_conntrack.h
index e3c041d54020..e5bd3083a843 100644
--- a/include/uapi/linux/netfilter/xt_conntrack.h
+++ b/include/uapi/linux/netfilter/xt_conntrack.h
@@ -31,6 +31,7 @@ enum {
31 XT_CONNTRACK_REPLSRC_PORT = 1 << 10, 31 XT_CONNTRACK_REPLSRC_PORT = 1 << 10,
32 XT_CONNTRACK_REPLDST_PORT = 1 << 11, 32 XT_CONNTRACK_REPLDST_PORT = 1 << 11,
33 XT_CONNTRACK_DIRECTION = 1 << 12, 33 XT_CONNTRACK_DIRECTION = 1 << 12,
34 XT_CONNTRACK_STATE_ALIAS = 1 << 13,
34}; 35};
35 36
36struct xt_conntrack_mtinfo1 { 37struct xt_conntrack_mtinfo1 {
diff --git a/include/uapi/linux/nfc.h b/include/uapi/linux/nfc.h
index 0e63cee8d810..7969f46f1bb3 100644
--- a/include/uapi/linux/nfc.h
+++ b/include/uapi/linux/nfc.h
@@ -5,20 +5,17 @@
5 * Lauro Ramos Venancio <lauro.venancio@openbossa.org> 5 * Lauro Ramos Venancio <lauro.venancio@openbossa.org>
6 * Aloisio Almeida Jr <aloisio.almeida@openbossa.org> 6 * Aloisio Almeida Jr <aloisio.almeida@openbossa.org>
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * Permission to use, copy, modify, and/or distribute this software for any
9 * it under the terms of the GNU General Public License as published by 9 * purpose with or without fee is hereby granted, provided that the above
10 * the Free Software Foundation; either version 2 of the License, or 10 * copyright notice and this permission notice appear in all copies.
11 * (at your option) any later version.
12 * 11 *
13 * This program is distributed in the hope that it will be useful, 12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
16 * GNU General Public License for more details. 15 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
17 * 16 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
18 * You should have received a copy of the GNU General Public License 17 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
19 * along with this program; if not, write to the 18 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20 * Free Software Foundation, Inc.,
21 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 */ 19 */
23 20
24#ifndef __LINUX_NFC_H 21#ifndef __LINUX_NFC_H
@@ -67,6 +64,11 @@
67 * subsequent CONNECT and CC messages. 64 * subsequent CONNECT and CC messages.
68 * If one of the passed parameters is wrong none is set and -EINVAL is 65 * If one of the passed parameters is wrong none is set and -EINVAL is
69 * returned. 66 * returned.
67 * @NFC_CMD_ENABLE_SE: Enable the physical link to a specific secure element.
68 * Once enabled a secure element will handle card emulation mode, i.e.
69 * starting a poll from a device which has a secure element enabled means
70 * we want to do SE based card emulation.
71 * @NFC_CMD_DISABLE_SE: Disable the physical link to a specific secure element.
70 */ 72 */
71enum nfc_commands { 73enum nfc_commands {
72 NFC_CMD_UNSPEC, 74 NFC_CMD_UNSPEC,
@@ -86,6 +88,8 @@ enum nfc_commands {
86 NFC_EVENT_TM_DEACTIVATED, 88 NFC_EVENT_TM_DEACTIVATED,
87 NFC_CMD_LLC_GET_PARAMS, 89 NFC_CMD_LLC_GET_PARAMS,
88 NFC_CMD_LLC_SET_PARAMS, 90 NFC_CMD_LLC_SET_PARAMS,
91 NFC_CMD_ENABLE_SE,
92 NFC_CMD_DISABLE_SE,
89/* private: internal use only */ 93/* private: internal use only */
90 __NFC_CMD_AFTER_LAST 94 __NFC_CMD_AFTER_LAST
91}; 95};
@@ -114,6 +118,7 @@ enum nfc_commands {
114 * @NFC_ATTR_LLC_PARAM_LTO: Link TimeOut parameter 118 * @NFC_ATTR_LLC_PARAM_LTO: Link TimeOut parameter
115 * @NFC_ATTR_LLC_PARAM_RW: Receive Window size parameter 119 * @NFC_ATTR_LLC_PARAM_RW: Receive Window size parameter
116 * @NFC_ATTR_LLC_PARAM_MIUX: MIU eXtension parameter 120 * @NFC_ATTR_LLC_PARAM_MIUX: MIU eXtension parameter
121 * @NFC_ATTR_SE: Available Secure Elements
117 */ 122 */
118enum nfc_attrs { 123enum nfc_attrs {
119 NFC_ATTR_UNSPEC, 124 NFC_ATTR_UNSPEC,
@@ -134,6 +139,7 @@ enum nfc_attrs {
134 NFC_ATTR_LLC_PARAM_LTO, 139 NFC_ATTR_LLC_PARAM_LTO,
135 NFC_ATTR_LLC_PARAM_RW, 140 NFC_ATTR_LLC_PARAM_RW,
136 NFC_ATTR_LLC_PARAM_MIUX, 141 NFC_ATTR_LLC_PARAM_MIUX,
142 NFC_ATTR_SE,
137/* private: internal use only */ 143/* private: internal use only */
138 __NFC_ATTR_AFTER_LAST 144 __NFC_ATTR_AFTER_LAST
139}; 145};
@@ -172,6 +178,11 @@ enum nfc_attrs {
172#define NFC_PROTO_NFC_DEP_MASK (1 << NFC_PROTO_NFC_DEP) 178#define NFC_PROTO_NFC_DEP_MASK (1 << NFC_PROTO_NFC_DEP)
173#define NFC_PROTO_ISO14443_B_MASK (1 << NFC_PROTO_ISO14443_B) 179#define NFC_PROTO_ISO14443_B_MASK (1 << NFC_PROTO_ISO14443_B)
174 180
181/* NFC Secure Elements */
182#define NFC_SE_NONE 0x0
183#define NFC_SE_UICC 0x1
184#define NFC_SE_EMBEDDED 0x2
185
175struct sockaddr_nfc { 186struct sockaddr_nfc {
176 sa_family_t sa_family; 187 sa_family_t sa_family;
177 __u32 dev_idx; 188 __u32 dev_idx;
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index e3e19f8b16f2..c46bb016f4e4 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -170,7 +170,8 @@
170 * %NL80211_ATTR_HIDDEN_SSID, %NL80211_ATTR_CIPHERS_PAIRWISE, 170 * %NL80211_ATTR_HIDDEN_SSID, %NL80211_ATTR_CIPHERS_PAIRWISE,
171 * %NL80211_ATTR_CIPHER_GROUP, %NL80211_ATTR_WPA_VERSIONS, 171 * %NL80211_ATTR_CIPHER_GROUP, %NL80211_ATTR_WPA_VERSIONS,
172 * %NL80211_ATTR_AKM_SUITES, %NL80211_ATTR_PRIVACY, 172 * %NL80211_ATTR_AKM_SUITES, %NL80211_ATTR_PRIVACY,
173 * %NL80211_ATTR_AUTH_TYPE and %NL80211_ATTR_INACTIVITY_TIMEOUT. 173 * %NL80211_ATTR_AUTH_TYPE, %NL80211_ATTR_INACTIVITY_TIMEOUT,
174 * %NL80211_ATTR_ACL_POLICY and %NL80211_ATTR_MAC_ADDRS.
174 * The channel to use can be set on the interface or be given using the 175 * The channel to use can be set on the interface or be given using the
175 * %NL80211_ATTR_WIPHY_FREQ and the attributes determining channel width. 176 * %NL80211_ATTR_WIPHY_FREQ and the attributes determining channel width.
176 * @NL80211_CMD_NEW_BEACON: old alias for %NL80211_CMD_START_AP 177 * @NL80211_CMD_NEW_BEACON: old alias for %NL80211_CMD_START_AP
@@ -374,8 +375,8 @@
374 * requests to connect to a specified network but without separating 375 * requests to connect to a specified network but without separating
375 * auth and assoc steps. For this, you need to specify the SSID in a 376 * auth and assoc steps. For this, you need to specify the SSID in a
376 * %NL80211_ATTR_SSID attribute, and can optionally specify the association 377 * %NL80211_ATTR_SSID attribute, and can optionally specify the association
377 * IEs in %NL80211_ATTR_IE, %NL80211_ATTR_AUTH_TYPE, %NL80211_ATTR_MAC, 378 * IEs in %NL80211_ATTR_IE, %NL80211_ATTR_AUTH_TYPE, %NL80211_ATTR_USE_MFP,
378 * %NL80211_ATTR_WIPHY_FREQ, %NL80211_ATTR_CONTROL_PORT, 379 * %NL80211_ATTR_MAC, %NL80211_ATTR_WIPHY_FREQ, %NL80211_ATTR_CONTROL_PORT,
379 * %NL80211_ATTR_CONTROL_PORT_ETHERTYPE and 380 * %NL80211_ATTR_CONTROL_PORT_ETHERTYPE and
380 * %NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT. 381 * %NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT.
381 * Background scan period can optionally be 382 * Background scan period can optionally be
@@ -512,6 +513,12 @@
512 * command with the %NL80211_ATTR_WOWLAN_TRIGGERS attribute. For 513 * command with the %NL80211_ATTR_WOWLAN_TRIGGERS attribute. For
513 * more background information, see 514 * more background information, see
514 * http://wireless.kernel.org/en/users/Documentation/WoWLAN. 515 * http://wireless.kernel.org/en/users/Documentation/WoWLAN.
516 * The @NL80211_CMD_SET_WOWLAN command can also be used as a notification
517 * from the driver reporting the wakeup reason. In this case, the
518 * @NL80211_ATTR_WOWLAN_TRIGGERS attribute will contain the reason
519 * for the wakeup, if it was caused by wireless. If it is not present
520 * in the wakeup notification, the wireless device didn't cause the
521 * wakeup but reports that it was woken up.
515 * 522 *
516 * @NL80211_CMD_SET_REKEY_OFFLOAD: This command is used give the driver 523 * @NL80211_CMD_SET_REKEY_OFFLOAD: This command is used give the driver
517 * the necessary information for supporting GTK rekey offload. This 524 * the necessary information for supporting GTK rekey offload. This
@@ -586,6 +593,24 @@
586 * @NL80211_CMD_SET_MCAST_RATE: Change the rate used to send multicast frames 593 * @NL80211_CMD_SET_MCAST_RATE: Change the rate used to send multicast frames
587 * for IBSS or MESH vif. 594 * for IBSS or MESH vif.
588 * 595 *
596 * @NL80211_CMD_SET_MAC_ACL: sets ACL for MAC address based access control.
597 * This is to be used with the drivers advertising the support of MAC
598 * address based access control. List of MAC addresses is passed in
599 * %NL80211_ATTR_MAC_ADDRS and ACL policy is passed in
600 * %NL80211_ATTR_ACL_POLICY. Driver will enable ACL with this list, if it
601 * is not already done. The new list will replace any existing list. Driver
602 * will clear its ACL when the list of MAC addresses passed is empty. This
603 * command is used in AP/P2P GO mode. Driver has to make sure to clear its
604 * ACL list during %NL80211_CMD_STOP_AP.
605 *
606 * @NL80211_CMD_RADAR_DETECT: Start a Channel availability check (CAC). Once
607 * a radar is detected or the channel availability scan (CAC) has finished
608 * or was aborted, or a radar was detected, usermode will be notified with
609 * this event. This command is also used to notify userspace about radars
610 * while operating on this channel.
611 * %NL80211_ATTR_RADAR_EVENT is used to inform about the type of the
612 * event.
613 *
589 * @NL80211_CMD_MAX: highest used command number 614 * @NL80211_CMD_MAX: highest used command number
590 * @__NL80211_CMD_AFTER_LAST: internal use 615 * @__NL80211_CMD_AFTER_LAST: internal use
591 */ 616 */
@@ -736,6 +761,10 @@ enum nl80211_commands {
736 761
737 NL80211_CMD_SET_MCAST_RATE, 762 NL80211_CMD_SET_MCAST_RATE,
738 763
764 NL80211_CMD_SET_MAC_ACL,
765
766 NL80211_CMD_RADAR_DETECT,
767
739 /* add new commands above here */ 768 /* add new commands above here */
740 769
741 /* used to define NL80211_CMD_MAX below */ 770 /* used to define NL80211_CMD_MAX below */
@@ -958,7 +987,7 @@ enum nl80211_commands {
958 * @NL80211_ATTR_USE_MFP: Whether management frame protection (IEEE 802.11w) is 987 * @NL80211_ATTR_USE_MFP: Whether management frame protection (IEEE 802.11w) is
959 * used for the association (&enum nl80211_mfp, represented as a u32); 988 * used for the association (&enum nl80211_mfp, represented as a u32);
960 * this attribute can be used 989 * this attribute can be used
961 * with %NL80211_CMD_ASSOCIATE request 990 * with %NL80211_CMD_ASSOCIATE and %NL80211_CMD_CONNECT requests
962 * 991 *
963 * @NL80211_ATTR_STA_FLAGS2: Attribute containing a 992 * @NL80211_ATTR_STA_FLAGS2: Attribute containing a
964 * &struct nl80211_sta_flag_update. 993 * &struct nl80211_sta_flag_update.
@@ -1310,6 +1339,35 @@ enum nl80211_commands {
1310 * if not given in START_AP 0 is assumed, if not given in SET_BSS 1339 * if not given in START_AP 0 is assumed, if not given in SET_BSS
1311 * no change is made. 1340 * no change is made.
1312 * 1341 *
1342 * @NL80211_ATTR_LOCAL_MESH_POWER_MODE: local mesh STA link-specific power mode
1343 * defined in &enum nl80211_mesh_power_mode.
1344 *
1345 * @NL80211_ATTR_ACL_POLICY: ACL policy, see &enum nl80211_acl_policy,
1346 * carried in a u32 attribute
1347 *
1348 * @NL80211_ATTR_MAC_ADDRS: Array of nested MAC addresses, used for
1349 * MAC ACL.
1350 *
1351 * @NL80211_ATTR_MAC_ACL_MAX: u32 attribute to advertise the maximum
1352 * number of MAC addresses that a device can support for MAC
1353 * ACL.
1354 *
1355 * @NL80211_ATTR_RADAR_EVENT: Type of radar event for notification to userspace,
1356 * contains a value of enum nl80211_radar_event (u32).
1357 *
1358 * @NL80211_ATTR_EXT_CAPA: 802.11 extended capabilities that the kernel driver
1359 * has and handles. The format is the same as the IE contents. See
1360 * 802.11-2012 8.4.2.29 for more information.
1361 * @NL80211_ATTR_EXT_CAPA_MASK: Extended capabilities that the kernel driver
1362 * has set in the %NL80211_ATTR_EXT_CAPA value, for multibit fields.
1363 *
1364 * @NL80211_ATTR_STA_CAPABILITY: Station capabilities (u16) are advertised to
1365 * the driver, e.g., to enable TDLS power save (PU-APSD).
1366 *
1367 * @NL80211_ATTR_STA_EXT_CAPABILITY: Station extended capabilities are
1368 * advertised to the driver, e.g., to enable TDLS off channel operations
1369 * and PU-APSD.
1370 *
1313 * @NL80211_ATTR_MAX: highest attribute number currently defined 1371 * @NL80211_ATTR_MAX: highest attribute number currently defined
1314 * @__NL80211_ATTR_AFTER_LAST: internal use 1372 * @__NL80211_ATTR_AFTER_LAST: internal use
1315 */ 1373 */
@@ -1580,6 +1638,22 @@ enum nl80211_attrs {
1580 NL80211_ATTR_P2P_CTWINDOW, 1638 NL80211_ATTR_P2P_CTWINDOW,
1581 NL80211_ATTR_P2P_OPPPS, 1639 NL80211_ATTR_P2P_OPPPS,
1582 1640
1641 NL80211_ATTR_LOCAL_MESH_POWER_MODE,
1642
1643 NL80211_ATTR_ACL_POLICY,
1644
1645 NL80211_ATTR_MAC_ADDRS,
1646
1647 NL80211_ATTR_MAC_ACL_MAX,
1648
1649 NL80211_ATTR_RADAR_EVENT,
1650
1651 NL80211_ATTR_EXT_CAPA,
1652 NL80211_ATTR_EXT_CAPA_MASK,
1653
1654 NL80211_ATTR_STA_CAPABILITY,
1655 NL80211_ATTR_STA_EXT_CAPABILITY,
1656
1583 /* add attributes here, update the policy in nl80211.c */ 1657 /* add attributes here, update the policy in nl80211.c */
1584 1658
1585 __NL80211_ATTR_AFTER_LAST, 1659 __NL80211_ATTR_AFTER_LAST,
@@ -1697,6 +1771,9 @@ enum nl80211_iftype {
1697 * flag can't be changed, it is only valid while adding a station, and 1771 * flag can't be changed, it is only valid while adding a station, and
1698 * attempts to change it will silently be ignored (rather than rejected 1772 * attempts to change it will silently be ignored (rather than rejected
1699 * as errors.) 1773 * as errors.)
1774 * @NL80211_STA_FLAG_ASSOCIATED: station is associated; used with drivers
1775 * that support %NL80211_FEATURE_FULL_AP_CLIENT_STATE to transition a
1776 * previously added station into associated state
1700 * @NL80211_STA_FLAG_MAX: highest station flag number currently defined 1777 * @NL80211_STA_FLAG_MAX: highest station flag number currently defined
1701 * @__NL80211_STA_FLAG_AFTER_LAST: internal use 1778 * @__NL80211_STA_FLAG_AFTER_LAST: internal use
1702 */ 1779 */
@@ -1708,6 +1785,7 @@ enum nl80211_sta_flags {
1708 NL80211_STA_FLAG_MFP, 1785 NL80211_STA_FLAG_MFP,
1709 NL80211_STA_FLAG_AUTHENTICATED, 1786 NL80211_STA_FLAG_AUTHENTICATED,
1710 NL80211_STA_FLAG_TDLS_PEER, 1787 NL80211_STA_FLAG_TDLS_PEER,
1788 NL80211_STA_FLAG_ASSOCIATED,
1711 1789
1712 /* keep last */ 1790 /* keep last */
1713 __NL80211_STA_FLAG_AFTER_LAST, 1791 __NL80211_STA_FLAG_AFTER_LAST,
@@ -1813,6 +1891,8 @@ enum nl80211_sta_bss_param {
1813 * @NL80211_STA_INFO_INACTIVE_TIME: time since last activity (u32, msecs) 1891 * @NL80211_STA_INFO_INACTIVE_TIME: time since last activity (u32, msecs)
1814 * @NL80211_STA_INFO_RX_BYTES: total received bytes (u32, from this station) 1892 * @NL80211_STA_INFO_RX_BYTES: total received bytes (u32, from this station)
1815 * @NL80211_STA_INFO_TX_BYTES: total transmitted bytes (u32, to this station) 1893 * @NL80211_STA_INFO_TX_BYTES: total transmitted bytes (u32, to this station)
1894 * @NL80211_STA_INFO_RX_BYTES64: total received bytes (u64, from this station)
1895 * @NL80211_STA_INFO_TX_BYTES64: total transmitted bytes (u64, to this station)
1816 * @NL80211_STA_INFO_SIGNAL: signal strength of last received PPDU (u8, dBm) 1896 * @NL80211_STA_INFO_SIGNAL: signal strength of last received PPDU (u8, dBm)
1817 * @NL80211_STA_INFO_TX_BITRATE: current unicast tx rate, nested attribute 1897 * @NL80211_STA_INFO_TX_BITRATE: current unicast tx rate, nested attribute
1818 * containing info as possible, see &enum nl80211_rate_info 1898 * containing info as possible, see &enum nl80211_rate_info
@@ -1834,6 +1914,10 @@ enum nl80211_sta_bss_param {
1834 * @NL80211_STA_INFO_STA_FLAGS: Contains a struct nl80211_sta_flag_update. 1914 * @NL80211_STA_INFO_STA_FLAGS: Contains a struct nl80211_sta_flag_update.
1835 * @NL80211_STA_INFO_BEACON_LOSS: count of times beacon loss was detected (u32) 1915 * @NL80211_STA_INFO_BEACON_LOSS: count of times beacon loss was detected (u32)
1836 * @NL80211_STA_INFO_T_OFFSET: timing offset with respect to this STA (s64) 1916 * @NL80211_STA_INFO_T_OFFSET: timing offset with respect to this STA (s64)
1917 * @NL80211_STA_INFO_LOCAL_PM: local mesh STA link-specific power mode
1918 * @NL80211_STA_INFO_PEER_PM: peer mesh STA link-specific power mode
1919 * @NL80211_STA_INFO_NONPEER_PM: neighbor mesh STA power save mode towards
1920 * non-peer STA
1837 * @__NL80211_STA_INFO_AFTER_LAST: internal 1921 * @__NL80211_STA_INFO_AFTER_LAST: internal
1838 * @NL80211_STA_INFO_MAX: highest possible station info attribute 1922 * @NL80211_STA_INFO_MAX: highest possible station info attribute
1839 */ 1923 */
@@ -1858,6 +1942,11 @@ enum nl80211_sta_info {
1858 NL80211_STA_INFO_STA_FLAGS, 1942 NL80211_STA_INFO_STA_FLAGS,
1859 NL80211_STA_INFO_BEACON_LOSS, 1943 NL80211_STA_INFO_BEACON_LOSS,
1860 NL80211_STA_INFO_T_OFFSET, 1944 NL80211_STA_INFO_T_OFFSET,
1945 NL80211_STA_INFO_LOCAL_PM,
1946 NL80211_STA_INFO_PEER_PM,
1947 NL80211_STA_INFO_NONPEER_PM,
1948 NL80211_STA_INFO_RX_BYTES64,
1949 NL80211_STA_INFO_TX_BYTES64,
1861 1950
1862 /* keep last */ 1951 /* keep last */
1863 __NL80211_STA_INFO_AFTER_LAST, 1952 __NL80211_STA_INFO_AFTER_LAST,
@@ -1967,6 +2056,20 @@ enum nl80211_band_attr {
1967 * on this channel in current regulatory domain. 2056 * on this channel in current regulatory domain.
1968 * @NL80211_FREQUENCY_ATTR_MAX_TX_POWER: Maximum transmission power in mBm 2057 * @NL80211_FREQUENCY_ATTR_MAX_TX_POWER: Maximum transmission power in mBm
1969 * (100 * dBm). 2058 * (100 * dBm).
2059 * @NL80211_FREQUENCY_ATTR_DFS_STATE: current state for DFS
2060 * (enum nl80211_dfs_state)
2061 * @NL80211_FREQUENCY_ATTR_DFS_TIME: time in miliseconds for how long
2062 * this channel is in this DFS state.
2063 * @NL80211_FREQUENCY_ATTR_NO_HT40_MINUS: HT40- isn't possible with this
2064 * channel as the control channel
2065 * @NL80211_FREQUENCY_ATTR_NO_HT40_PLUS: HT40+ isn't possible with this
2066 * channel as the control channel
2067 * @NL80211_FREQUENCY_ATTR_NO_80MHZ: any 80 MHz channel using this channel
2068 * as the primary or any of the secondary channels isn't possible,
2069 * this includes 80+80 channels
2070 * @NL80211_FREQUENCY_ATTR_NO_160MHZ: any 160 MHz (but not 80+80) channel
2071 * using this channel as the primary or any of the secondary channels
2072 * isn't possible
1970 * @NL80211_FREQUENCY_ATTR_MAX: highest frequency attribute number 2073 * @NL80211_FREQUENCY_ATTR_MAX: highest frequency attribute number
1971 * currently defined 2074 * currently defined
1972 * @__NL80211_FREQUENCY_ATTR_AFTER_LAST: internal use 2075 * @__NL80211_FREQUENCY_ATTR_AFTER_LAST: internal use
@@ -1979,6 +2082,12 @@ enum nl80211_frequency_attr {
1979 NL80211_FREQUENCY_ATTR_NO_IBSS, 2082 NL80211_FREQUENCY_ATTR_NO_IBSS,
1980 NL80211_FREQUENCY_ATTR_RADAR, 2083 NL80211_FREQUENCY_ATTR_RADAR,
1981 NL80211_FREQUENCY_ATTR_MAX_TX_POWER, 2084 NL80211_FREQUENCY_ATTR_MAX_TX_POWER,
2085 NL80211_FREQUENCY_ATTR_DFS_STATE,
2086 NL80211_FREQUENCY_ATTR_DFS_TIME,
2087 NL80211_FREQUENCY_ATTR_NO_HT40_MINUS,
2088 NL80211_FREQUENCY_ATTR_NO_HT40_PLUS,
2089 NL80211_FREQUENCY_ATTR_NO_80MHZ,
2090 NL80211_FREQUENCY_ATTR_NO_160MHZ,
1982 2091
1983 /* keep last */ 2092 /* keep last */
1984 __NL80211_FREQUENCY_ATTR_AFTER_LAST, 2093 __NL80211_FREQUENCY_ATTR_AFTER_LAST,
@@ -2249,6 +2358,34 @@ enum nl80211_mntr_flags {
2249}; 2358};
2250 2359
2251/** 2360/**
2361 * enum nl80211_mesh_power_mode - mesh power save modes
2362 *
2363 * @NL80211_MESH_POWER_UNKNOWN: The mesh power mode of the mesh STA is
2364 * not known or has not been set yet.
2365 * @NL80211_MESH_POWER_ACTIVE: Active mesh power mode. The mesh STA is
2366 * in Awake state all the time.
2367 * @NL80211_MESH_POWER_LIGHT_SLEEP: Light sleep mode. The mesh STA will
2368 * alternate between Active and Doze states, but will wake up for
2369 * neighbor's beacons.
2370 * @NL80211_MESH_POWER_DEEP_SLEEP: Deep sleep mode. The mesh STA will
2371 * alternate between Active and Doze states, but may not wake up
2372 * for neighbor's beacons.
2373 *
2374 * @__NL80211_MESH_POWER_AFTER_LAST - internal use
2375 * @NL80211_MESH_POWER_MAX - highest possible power save level
2376 */
2377
2378enum nl80211_mesh_power_mode {
2379 NL80211_MESH_POWER_UNKNOWN,
2380 NL80211_MESH_POWER_ACTIVE,
2381 NL80211_MESH_POWER_LIGHT_SLEEP,
2382 NL80211_MESH_POWER_DEEP_SLEEP,
2383
2384 __NL80211_MESH_POWER_AFTER_LAST,
2385 NL80211_MESH_POWER_MAX = __NL80211_MESH_POWER_AFTER_LAST - 1
2386};
2387
2388/**
2252 * enum nl80211_meshconf_params - mesh configuration parameters 2389 * enum nl80211_meshconf_params - mesh configuration parameters
2253 * 2390 *
2254 * Mesh configuration parameters. These can be changed while the mesh is 2391 * Mesh configuration parameters. These can be changed while the mesh is
@@ -2342,6 +2479,11 @@ enum nl80211_mntr_flags {
2342 * (in TUs) during which a mesh STA can send only one Action frame 2479 * (in TUs) during which a mesh STA can send only one Action frame
2343 * containing a PREQ element for root path confirmation. 2480 * containing a PREQ element for root path confirmation.
2344 * 2481 *
2482 * @NL80211_MESHCONF_POWER_MODE: Default mesh power mode for new peer links.
2483 * type &enum nl80211_mesh_power_mode (u32)
2484 *
2485 * @NL80211_MESHCONF_AWAKE_WINDOW: awake window duration (in TUs)
2486 *
2345 * @__NL80211_MESHCONF_ATTR_AFTER_LAST: internal use 2487 * @__NL80211_MESHCONF_ATTR_AFTER_LAST: internal use
2346 */ 2488 */
2347enum nl80211_meshconf_params { 2489enum nl80211_meshconf_params {
@@ -2371,6 +2513,8 @@ enum nl80211_meshconf_params {
2371 NL80211_MESHCONF_HWMP_PATH_TO_ROOT_TIMEOUT, 2513 NL80211_MESHCONF_HWMP_PATH_TO_ROOT_TIMEOUT,
2372 NL80211_MESHCONF_HWMP_ROOT_INTERVAL, 2514 NL80211_MESHCONF_HWMP_ROOT_INTERVAL,
2373 NL80211_MESHCONF_HWMP_CONFIRMATION_INTERVAL, 2515 NL80211_MESHCONF_HWMP_CONFIRMATION_INTERVAL,
2516 NL80211_MESHCONF_POWER_MODE,
2517 NL80211_MESHCONF_AWAKE_WINDOW,
2374 2518
2375 /* keep last */ 2519 /* keep last */
2376 __NL80211_MESHCONF_ATTR_AFTER_LAST, 2520 __NL80211_MESHCONF_ATTR_AFTER_LAST,
@@ -2816,10 +2960,12 @@ enum nl80211_tx_power_setting {
2816 * corresponds to the lowest-order bit in the second byte of the mask. 2960 * corresponds to the lowest-order bit in the second byte of the mask.
2817 * For example: The match 00:xx:00:00:xx:00:00:00:00:xx:xx:xx (where 2961 * For example: The match 00:xx:00:00:xx:00:00:00:00:xx:xx:xx (where
2818 * xx indicates "don't care") would be represented by a pattern of 2962 * xx indicates "don't care") would be represented by a pattern of
2819 * twelve zero bytes, and a mask of "0xed,0x07". 2963 * twelve zero bytes, and a mask of "0xed,0x01".
2820 * Note that the pattern matching is done as though frames were not 2964 * Note that the pattern matching is done as though frames were not
2821 * 802.11 frames but 802.3 frames, i.e. the frame is fully unpacked 2965 * 802.11 frames but 802.3 frames, i.e. the frame is fully unpacked
2822 * first (including SNAP header unpacking) and then matched. 2966 * first (including SNAP header unpacking) and then matched.
2967 * @NL80211_WOWLAN_PKTPAT_OFFSET: packet offset, pattern is matched after
2968 * these fixed number of bytes of received packet
2823 * @NUM_NL80211_WOWLAN_PKTPAT: number of attributes 2969 * @NUM_NL80211_WOWLAN_PKTPAT: number of attributes
2824 * @MAX_NL80211_WOWLAN_PKTPAT: max attribute number 2970 * @MAX_NL80211_WOWLAN_PKTPAT: max attribute number
2825 */ 2971 */
@@ -2827,6 +2973,7 @@ enum nl80211_wowlan_packet_pattern_attr {
2827 __NL80211_WOWLAN_PKTPAT_INVALID, 2973 __NL80211_WOWLAN_PKTPAT_INVALID,
2828 NL80211_WOWLAN_PKTPAT_MASK, 2974 NL80211_WOWLAN_PKTPAT_MASK,
2829 NL80211_WOWLAN_PKTPAT_PATTERN, 2975 NL80211_WOWLAN_PKTPAT_PATTERN,
2976 NL80211_WOWLAN_PKTPAT_OFFSET,
2830 2977
2831 NUM_NL80211_WOWLAN_PKTPAT, 2978 NUM_NL80211_WOWLAN_PKTPAT,
2832 MAX_NL80211_WOWLAN_PKTPAT = NUM_NL80211_WOWLAN_PKTPAT - 1, 2979 MAX_NL80211_WOWLAN_PKTPAT = NUM_NL80211_WOWLAN_PKTPAT - 1,
@@ -2837,6 +2984,7 @@ enum nl80211_wowlan_packet_pattern_attr {
2837 * @max_patterns: maximum number of patterns supported 2984 * @max_patterns: maximum number of patterns supported
2838 * @min_pattern_len: minimum length of each pattern 2985 * @min_pattern_len: minimum length of each pattern
2839 * @max_pattern_len: maximum length of each pattern 2986 * @max_pattern_len: maximum length of each pattern
2987 * @max_pkt_offset: maximum Rx packet offset
2840 * 2988 *
2841 * This struct is carried in %NL80211_WOWLAN_TRIG_PKT_PATTERN when 2989 * This struct is carried in %NL80211_WOWLAN_TRIG_PKT_PATTERN when
2842 * that is part of %NL80211_ATTR_WOWLAN_TRIGGERS_SUPPORTED in the 2990 * that is part of %NL80211_ATTR_WOWLAN_TRIGGERS_SUPPORTED in the
@@ -2846,6 +2994,7 @@ struct nl80211_wowlan_pattern_support {
2846 __u32 max_patterns; 2994 __u32 max_patterns;
2847 __u32 min_pattern_len; 2995 __u32 min_pattern_len;
2848 __u32 max_pattern_len; 2996 __u32 max_pattern_len;
2997 __u32 max_pkt_offset;
2849} __attribute__((packed)); 2998} __attribute__((packed));
2850 2999
2851/** 3000/**
@@ -2861,12 +3010,17 @@ struct nl80211_wowlan_pattern_support {
2861 * @NL80211_WOWLAN_TRIG_PKT_PATTERN: wake up on the specified packet patterns 3010 * @NL80211_WOWLAN_TRIG_PKT_PATTERN: wake up on the specified packet patterns
2862 * which are passed in an array of nested attributes, each nested attribute 3011 * which are passed in an array of nested attributes, each nested attribute
2863 * defining a with attributes from &struct nl80211_wowlan_trig_pkt_pattern. 3012 * defining a with attributes from &struct nl80211_wowlan_trig_pkt_pattern.
2864 * Each pattern defines a wakeup packet. The matching is done on the MSDU, 3013 * Each pattern defines a wakeup packet. Packet offset is associated with
2865 * i.e. as though the packet was an 802.3 packet, so the pattern matching 3014 * each pattern which is used while matching the pattern. The matching is
2866 * is done after the packet is converted to the MSDU. 3015 * done on the MSDU, i.e. as though the packet was an 802.3 packet, so the
3016 * pattern matching is done after the packet is converted to the MSDU.
2867 * 3017 *
2868 * In %NL80211_ATTR_WOWLAN_TRIGGERS_SUPPORTED, it is a binary attribute 3018 * In %NL80211_ATTR_WOWLAN_TRIGGERS_SUPPORTED, it is a binary attribute
2869 * carrying a &struct nl80211_wowlan_pattern_support. 3019 * carrying a &struct nl80211_wowlan_pattern_support.
3020 *
3021 * When reporting wakeup. it is a u32 attribute containing the 0-based
3022 * index of the pattern that caused the wakeup, in the patterns passed
3023 * to the kernel when configuring.
2870 * @NL80211_WOWLAN_TRIG_GTK_REKEY_SUPPORTED: Not a real trigger, and cannot be 3024 * @NL80211_WOWLAN_TRIG_GTK_REKEY_SUPPORTED: Not a real trigger, and cannot be
2871 * used when setting, used only to indicate that GTK rekeying is supported 3025 * used when setting, used only to indicate that GTK rekeying is supported
2872 * by the device (flag) 3026 * by the device (flag)
@@ -2877,8 +3031,36 @@ struct nl80211_wowlan_pattern_support {
2877 * @NL80211_WOWLAN_TRIG_4WAY_HANDSHAKE: wake up on 4-way handshake (flag) 3031 * @NL80211_WOWLAN_TRIG_4WAY_HANDSHAKE: wake up on 4-way handshake (flag)
2878 * @NL80211_WOWLAN_TRIG_RFKILL_RELEASE: wake up when rfkill is released 3032 * @NL80211_WOWLAN_TRIG_RFKILL_RELEASE: wake up when rfkill is released
2879 * (on devices that have rfkill in the device) (flag) 3033 * (on devices that have rfkill in the device) (flag)
3034 * @NL80211_WOWLAN_TRIG_WAKEUP_PKT_80211: For wakeup reporting only, contains
3035 * the 802.11 packet that caused the wakeup, e.g. a deauth frame. The frame
3036 * may be truncated, the @NL80211_WOWLAN_TRIG_WAKEUP_PKT_80211_LEN
3037 * attribute contains the original length.
3038 * @NL80211_WOWLAN_TRIG_WAKEUP_PKT_80211_LEN: Original length of the 802.11
3039 * packet, may be bigger than the @NL80211_WOWLAN_TRIG_WAKEUP_PKT_80211
3040 * attribute if the packet was truncated somewhere.
3041 * @NL80211_WOWLAN_TRIG_WAKEUP_PKT_8023: For wakeup reporting only, contains the
3042 * 802.11 packet that caused the wakeup, e.g. a magic packet. The frame may
3043 * be truncated, the @NL80211_WOWLAN_TRIG_WAKEUP_PKT_8023_LEN attribute
3044 * contains the original length.
3045 * @NL80211_WOWLAN_TRIG_WAKEUP_PKT_8023_LEN: Original length of the 802.3
3046 * packet, may be bigger than the @NL80211_WOWLAN_TRIG_WAKEUP_PKT_8023
3047 * attribute if the packet was truncated somewhere.
3048 * @NL80211_WOWLAN_TRIG_TCP_CONNECTION: TCP connection wake, see DOC section
3049 * "TCP connection wakeup" for more details. This is a nested attribute
3050 * containing the exact information for establishing and keeping alive
3051 * the TCP connection.
3052 * @NL80211_WOWLAN_TRIG_TCP_WAKEUP_MATCH: For wakeup reporting only, the
3053 * wakeup packet was received on the TCP connection
3054 * @NL80211_WOWLAN_TRIG_WAKEUP_TCP_CONNLOST: For wakeup reporting only, the
3055 * TCP connection was lost or failed to be established
3056 * @NL80211_WOWLAN_TRIG_WAKEUP_TCP_NOMORETOKENS: For wakeup reporting only,
3057 * the TCP connection ran out of tokens to use for data to send to the
3058 * service
2880 * @NUM_NL80211_WOWLAN_TRIG: number of wake on wireless triggers 3059 * @NUM_NL80211_WOWLAN_TRIG: number of wake on wireless triggers
2881 * @MAX_NL80211_WOWLAN_TRIG: highest wowlan trigger attribute number 3060 * @MAX_NL80211_WOWLAN_TRIG: highest wowlan trigger attribute number
3061 *
3062 * These nested attributes are used to configure the wakeup triggers and
3063 * to report the wakeup reason(s).
2882 */ 3064 */
2883enum nl80211_wowlan_triggers { 3065enum nl80211_wowlan_triggers {
2884 __NL80211_WOWLAN_TRIG_INVALID, 3066 __NL80211_WOWLAN_TRIG_INVALID,
@@ -2891,6 +3073,14 @@ enum nl80211_wowlan_triggers {
2891 NL80211_WOWLAN_TRIG_EAP_IDENT_REQUEST, 3073 NL80211_WOWLAN_TRIG_EAP_IDENT_REQUEST,
2892 NL80211_WOWLAN_TRIG_4WAY_HANDSHAKE, 3074 NL80211_WOWLAN_TRIG_4WAY_HANDSHAKE,
2893 NL80211_WOWLAN_TRIG_RFKILL_RELEASE, 3075 NL80211_WOWLAN_TRIG_RFKILL_RELEASE,
3076 NL80211_WOWLAN_TRIG_WAKEUP_PKT_80211,
3077 NL80211_WOWLAN_TRIG_WAKEUP_PKT_80211_LEN,
3078 NL80211_WOWLAN_TRIG_WAKEUP_PKT_8023,
3079 NL80211_WOWLAN_TRIG_WAKEUP_PKT_8023_LEN,
3080 NL80211_WOWLAN_TRIG_TCP_CONNECTION,
3081 NL80211_WOWLAN_TRIG_WAKEUP_TCP_MATCH,
3082 NL80211_WOWLAN_TRIG_WAKEUP_TCP_CONNLOST,
3083 NL80211_WOWLAN_TRIG_WAKEUP_TCP_NOMORETOKENS,
2894 3084
2895 /* keep last */ 3085 /* keep last */
2896 NUM_NL80211_WOWLAN_TRIG, 3086 NUM_NL80211_WOWLAN_TRIG,
@@ -2898,6 +3088,116 @@ enum nl80211_wowlan_triggers {
2898}; 3088};
2899 3089
2900/** 3090/**
3091 * DOC: TCP connection wakeup
3092 *
3093 * Some devices can establish a TCP connection in order to be woken up by a
3094 * packet coming in from outside their network segment, or behind NAT. If
3095 * configured, the device will establish a TCP connection to the given
3096 * service, and periodically send data to that service. The first data
3097 * packet is usually transmitted after SYN/ACK, also ACKing the SYN/ACK.
3098 * The data packets can optionally include a (little endian) sequence
3099 * number (in the TCP payload!) that is generated by the device, and, also
3100 * optionally, a token from a list of tokens. This serves as a keep-alive
3101 * with the service, and for NATed connections, etc.
3102 *
3103 * During this keep-alive period, the server doesn't send any data to the
3104 * client. When receiving data, it is compared against the wakeup pattern
3105 * (and mask) and if it matches, the host is woken up. Similarly, if the
3106 * connection breaks or cannot be established to start with, the host is
3107 * also woken up.
3108 *
3109 * Developer's note: ARP offload is required for this, otherwise TCP
3110 * response packets might not go through correctly.
3111 */
3112
3113/**
3114 * struct nl80211_wowlan_tcp_data_seq - WoWLAN TCP data sequence
3115 * @start: starting value
3116 * @offset: offset of sequence number in packet
3117 * @len: length of the sequence value to write, 1 through 4
3118 *
3119 * Note: don't confuse with the TCP sequence number(s), this is for the
3120 * keepalive packet payload. The actual value is written into the packet
3121 * in little endian.
3122 */
3123struct nl80211_wowlan_tcp_data_seq {
3124 __u32 start, offset, len;
3125};
3126
3127/**
3128 * struct nl80211_wowlan_tcp_data_token - WoWLAN TCP data token config
3129 * @offset: offset of token in packet
3130 * @len: length of each token
3131 * @token_stream: stream of data to be used for the tokens, the length must
3132 * be a multiple of @len for this to make sense
3133 */
3134struct nl80211_wowlan_tcp_data_token {
3135 __u32 offset, len;
3136 __u8 token_stream[];
3137};
3138
3139/**
3140 * struct nl80211_wowlan_tcp_data_token_feature - data token features
3141 * @min_len: minimum token length
3142 * @max_len: maximum token length
3143 * @bufsize: total available token buffer size (max size of @token_stream)
3144 */
3145struct nl80211_wowlan_tcp_data_token_feature {
3146 __u32 min_len, max_len, bufsize;
3147};
3148
3149/**
3150 * enum nl80211_wowlan_tcp_attrs - WoWLAN TCP connection parameters
3151 * @__NL80211_WOWLAN_TCP_INVALID: invalid number for nested attributes
3152 * @NL80211_WOWLAN_TCP_SRC_IPV4: source IPv4 address (in network byte order)
3153 * @NL80211_WOWLAN_TCP_DST_IPV4: destination IPv4 address
3154 * (in network byte order)
3155 * @NL80211_WOWLAN_TCP_DST_MAC: destination MAC address, this is given because
3156 * route lookup when configured might be invalid by the time we suspend,
3157 * and doing a route lookup when suspending is no longer possible as it
3158 * might require ARP querying.
3159 * @NL80211_WOWLAN_TCP_SRC_PORT: source port (u16); optional, if not given a
3160 * socket and port will be allocated
3161 * @NL80211_WOWLAN_TCP_DST_PORT: destination port (u16)
3162 * @NL80211_WOWLAN_TCP_DATA_PAYLOAD: data packet payload, at least one byte.
3163 * For feature advertising, a u32 attribute holding the maximum length
3164 * of the data payload.
3165 * @NL80211_WOWLAN_TCP_DATA_PAYLOAD_SEQ: data packet sequence configuration
3166 * (if desired), a &struct nl80211_wowlan_tcp_data_seq. For feature
3167 * advertising it is just a flag
3168 * @NL80211_WOWLAN_TCP_DATA_PAYLOAD_TOKEN: data packet token configuration,
3169 * see &struct nl80211_wowlan_tcp_data_token and for advertising see
3170 * &struct nl80211_wowlan_tcp_data_token_feature.
3171 * @NL80211_WOWLAN_TCP_DATA_INTERVAL: data interval in seconds, maximum
3172 * interval in feature advertising (u32)
3173 * @NL80211_WOWLAN_TCP_WAKE_PAYLOAD: wake packet payload, for advertising a
3174 * u32 attribute holding the maximum length
3175 * @NL80211_WOWLAN_TCP_WAKE_MASK: Wake packet payload mask, not used for
3176 * feature advertising. The mask works like @NL80211_WOWLAN_PKTPAT_MASK
3177 * but on the TCP payload only.
3178 * @NUM_NL80211_WOWLAN_TCP: number of TCP attributes
3179 * @MAX_NL80211_WOWLAN_TCP: highest attribute number
3180 */
3181enum nl80211_wowlan_tcp_attrs {
3182 __NL80211_WOWLAN_TCP_INVALID,
3183 NL80211_WOWLAN_TCP_SRC_IPV4,
3184 NL80211_WOWLAN_TCP_DST_IPV4,
3185 NL80211_WOWLAN_TCP_DST_MAC,
3186 NL80211_WOWLAN_TCP_SRC_PORT,
3187 NL80211_WOWLAN_TCP_DST_PORT,
3188 NL80211_WOWLAN_TCP_DATA_PAYLOAD,
3189 NL80211_WOWLAN_TCP_DATA_PAYLOAD_SEQ,
3190 NL80211_WOWLAN_TCP_DATA_PAYLOAD_TOKEN,
3191 NL80211_WOWLAN_TCP_DATA_INTERVAL,
3192 NL80211_WOWLAN_TCP_WAKE_PAYLOAD,
3193 NL80211_WOWLAN_TCP_WAKE_MASK,
3194
3195 /* keep last */
3196 NUM_NL80211_WOWLAN_TCP,
3197 MAX_NL80211_WOWLAN_TCP = NUM_NL80211_WOWLAN_TCP - 1
3198};
3199
3200/**
2901 * enum nl80211_iface_limit_attrs - limit attributes 3201 * enum nl80211_iface_limit_attrs - limit attributes
2902 * @NL80211_IFACE_LIMIT_UNSPEC: (reserved) 3202 * @NL80211_IFACE_LIMIT_UNSPEC: (reserved)
2903 * @NL80211_IFACE_LIMIT_MAX: maximum number of interfaces that 3203 * @NL80211_IFACE_LIMIT_MAX: maximum number of interfaces that
@@ -2933,6 +3233,8 @@ enum nl80211_iface_limit_attrs {
2933 * the infrastructure network's beacon interval. 3233 * the infrastructure network's beacon interval.
2934 * @NL80211_IFACE_COMB_NUM_CHANNELS: u32 attribute specifying how many 3234 * @NL80211_IFACE_COMB_NUM_CHANNELS: u32 attribute specifying how many
2935 * different channels may be used within this group. 3235 * different channels may be used within this group.
3236 * @NL80211_IFACE_COMB_RADAR_DETECT_WIDTHS: u32 attribute containing the bitmap
3237 * of supported channel widths for radar detection.
2936 * @NUM_NL80211_IFACE_COMB: number of attributes 3238 * @NUM_NL80211_IFACE_COMB: number of attributes
2937 * @MAX_NL80211_IFACE_COMB: highest attribute number 3239 * @MAX_NL80211_IFACE_COMB: highest attribute number
2938 * 3240 *
@@ -2965,6 +3267,7 @@ enum nl80211_if_combination_attrs {
2965 NL80211_IFACE_COMB_MAXNUM, 3267 NL80211_IFACE_COMB_MAXNUM,
2966 NL80211_IFACE_COMB_STA_AP_BI_MATCH, 3268 NL80211_IFACE_COMB_STA_AP_BI_MATCH,
2967 NL80211_IFACE_COMB_NUM_CHANNELS, 3269 NL80211_IFACE_COMB_NUM_CHANNELS,
3270 NL80211_IFACE_COMB_RADAR_DETECT_WIDTHS,
2968 3271
2969 /* keep last */ 3272 /* keep last */
2970 NUM_NL80211_IFACE_COMB, 3273 NUM_NL80211_IFACE_COMB,
@@ -3140,6 +3443,19 @@ enum nl80211_ap_sme_features {
3140 * setting 3443 * setting
3141 * @NL80211_FEATURE_P2P_GO_OPPPS: P2P GO implementation supports opportunistic 3444 * @NL80211_FEATURE_P2P_GO_OPPPS: P2P GO implementation supports opportunistic
3142 * powersave 3445 * powersave
3446 * @NL80211_FEATURE_FULL_AP_CLIENT_STATE: The driver supports full state
3447 * transitions for AP clients. Without this flag (and if the driver
3448 * doesn't have the AP SME in the device) the driver supports adding
3449 * stations only when they're associated and adds them in associated
3450 * state (to later be transitioned into authorized), with this flag
3451 * they should be added before even sending the authentication reply
3452 * and then transitioned into authenticated, associated and authorized
3453 * states using station flags.
3454 * Note that even for drivers that support this, the default is to add
3455 * stations in authenticated/associated state, so to add unauthenticated
3456 * stations the authenticated/associated bits have to be set in the mask.
3457 * @NL80211_FEATURE_ADVERTISE_CHAN_LIMITS: cfg80211 advertises channel limits
3458 * (HT40, VHT 80/160 MHz) if this flag is set
3143 */ 3459 */
3144enum nl80211_feature_flags { 3460enum nl80211_feature_flags {
3145 NL80211_FEATURE_SK_TX_STATUS = 1 << 0, 3461 NL80211_FEATURE_SK_TX_STATUS = 1 << 0,
@@ -3155,6 +3471,9 @@ enum nl80211_feature_flags {
3155 NL80211_FEATURE_NEED_OBSS_SCAN = 1 << 10, 3471 NL80211_FEATURE_NEED_OBSS_SCAN = 1 << 10,
3156 NL80211_FEATURE_P2P_GO_CTWIN = 1 << 11, 3472 NL80211_FEATURE_P2P_GO_CTWIN = 1 << 11,
3157 NL80211_FEATURE_P2P_GO_OPPPS = 1 << 12, 3473 NL80211_FEATURE_P2P_GO_OPPPS = 1 << 12,
3474 /* bit 13 is reserved */
3475 NL80211_FEATURE_ADVERTISE_CHAN_LIMITS = 1 << 14,
3476 NL80211_FEATURE_FULL_AP_CLIENT_STATE = 1 << 15,
3158}; 3477};
3159 3478
3160/** 3479/**
@@ -3182,7 +3501,7 @@ enum nl80211_probe_resp_offload_support_attr {
3182 * enum nl80211_connect_failed_reason - connection request failed reasons 3501 * enum nl80211_connect_failed_reason - connection request failed reasons
3183 * @NL80211_CONN_FAIL_MAX_CLIENTS: Maximum number of clients that can be 3502 * @NL80211_CONN_FAIL_MAX_CLIENTS: Maximum number of clients that can be
3184 * handled by the AP is reached. 3503 * handled by the AP is reached.
3185 * @NL80211_CONN_FAIL_BLOCKED_CLIENT: Client's MAC is in the AP's blocklist. 3504 * @NL80211_CONN_FAIL_BLOCKED_CLIENT: Connection request is rejected due to ACL.
3186 */ 3505 */
3187enum nl80211_connect_failed_reason { 3506enum nl80211_connect_failed_reason {
3188 NL80211_CONN_FAIL_MAX_CLIENTS, 3507 NL80211_CONN_FAIL_MAX_CLIENTS,
@@ -3210,4 +3529,62 @@ enum nl80211_scan_flags {
3210 NL80211_SCAN_FLAG_AP = 1<<2, 3529 NL80211_SCAN_FLAG_AP = 1<<2,
3211}; 3530};
3212 3531
3532/**
3533 * enum nl80211_acl_policy - access control policy
3534 *
3535 * Access control policy is applied on a MAC list set by
3536 * %NL80211_CMD_START_AP and %NL80211_CMD_SET_MAC_ACL, to
3537 * be used with %NL80211_ATTR_ACL_POLICY.
3538 *
3539 * @NL80211_ACL_POLICY_ACCEPT_UNLESS_LISTED: Deny stations which are
3540 * listed in ACL, i.e. allow all the stations which are not listed
3541 * in ACL to authenticate.
3542 * @NL80211_ACL_POLICY_DENY_UNLESS_LISTED: Allow the stations which are listed
3543 * in ACL, i.e. deny all the stations which are not listed in ACL.
3544 */
3545enum nl80211_acl_policy {
3546 NL80211_ACL_POLICY_ACCEPT_UNLESS_LISTED,
3547 NL80211_ACL_POLICY_DENY_UNLESS_LISTED,
3548};
3549
3550/**
3551 * enum nl80211_radar_event - type of radar event for DFS operation
3552 *
3553 * Type of event to be used with NL80211_ATTR_RADAR_EVENT to inform userspace
3554 * about detected radars or success of the channel available check (CAC)
3555 *
3556 * @NL80211_RADAR_DETECTED: A radar pattern has been detected. The channel is
3557 * now unusable.
3558 * @NL80211_RADAR_CAC_FINISHED: Channel Availability Check has been finished,
3559 * the channel is now available.
3560 * @NL80211_RADAR_CAC_ABORTED: Channel Availability Check has been aborted, no
3561 * change to the channel status.
3562 * @NL80211_RADAR_NOP_FINISHED: The Non-Occupancy Period for this channel is
3563 * over, channel becomes usable.
3564 */
3565enum nl80211_radar_event {
3566 NL80211_RADAR_DETECTED,
3567 NL80211_RADAR_CAC_FINISHED,
3568 NL80211_RADAR_CAC_ABORTED,
3569 NL80211_RADAR_NOP_FINISHED,
3570};
3571
3572/**
3573 * enum nl80211_dfs_state - DFS states for channels
3574 *
3575 * Channel states used by the DFS code.
3576 *
3577 * @IEEE80211_DFS_USABLE: The channel can be used, but channel availability
3578 * check (CAC) must be performed before using it for AP or IBSS.
3579 * @IEEE80211_DFS_UNAVAILABLE: A radar has been detected on this channel, it
3580 * is therefore marked as not available.
3581 * @IEEE80211_DFS_AVAILABLE: The channel has been CAC checked and is available.
3582 */
3583
3584enum nl80211_dfs_state {
3585 NL80211_DFS_USABLE,
3586 NL80211_DFS_UNAVAILABLE,
3587 NL80211_DFS_AVAILABLE,
3588};
3589
3213#endif /* __LINUX_NL80211_H */ 3590#endif /* __LINUX_NL80211_H */
diff --git a/include/uapi/linux/perf_event.h b/include/uapi/linux/perf_event.h
index 4f63c05d27c9..9fa9c622a7f4 100644
--- a/include/uapi/linux/perf_event.h
+++ b/include/uapi/linux/perf_event.h
@@ -579,7 +579,8 @@ enum perf_event_type {
579 * { u32 size; 579 * { u32 size;
580 * char data[size];}&& PERF_SAMPLE_RAW 580 * char data[size];}&& PERF_SAMPLE_RAW
581 * 581 *
582 * { u64 from, to, flags } lbr[nr];} && PERF_SAMPLE_BRANCH_STACK 582 * { u64 nr;
583 * { u64 from, to, flags } lbr[nr];} && PERF_SAMPLE_BRANCH_STACK
583 * 584 *
584 * { u64 abi; # enum perf_sample_regs_abi 585 * { u64 abi; # enum perf_sample_regs_abi
585 * u64 regs[weight(mask)]; } && PERF_SAMPLE_REGS_USER 586 * u64 regs[weight(mask)]; } && PERF_SAMPLE_REGS_USER
diff --git a/include/uapi/linux/rtnetlink.h b/include/uapi/linux/rtnetlink.h
index 7a5eb196ade9..7a2144e1afae 100644
--- a/include/uapi/linux/rtnetlink.h
+++ b/include/uapi/linux/rtnetlink.h
@@ -630,6 +630,7 @@ struct tcamsg {
630 630
631/* New extended info filters for IFLA_EXT_MASK */ 631/* New extended info filters for IFLA_EXT_MASK */
632#define RTEXT_FILTER_VF (1 << 0) 632#define RTEXT_FILTER_VF (1 << 0)
633#define RTEXT_FILTER_BRVLAN (1 << 1)
633 634
634/* End of information exported to user level */ 635/* End of information exported to user level */
635 636
diff --git a/include/uapi/linux/serial_core.h b/include/uapi/linux/serial_core.h
index 2c6c85f18ea0..b6a23a483d74 100644
--- a/include/uapi/linux/serial_core.h
+++ b/include/uapi/linux/serial_core.h
@@ -50,7 +50,7 @@
50#define PORT_LPC3220 22 /* NXP LPC32xx SoC "Standard" UART */ 50#define PORT_LPC3220 22 /* NXP LPC32xx SoC "Standard" UART */
51#define PORT_8250_CIR 23 /* CIR infrared port, has its own driver */ 51#define PORT_8250_CIR 23 /* CIR infrared port, has its own driver */
52#define PORT_XR17V35X 24 /* Exar XR17V35x UARTs */ 52#define PORT_XR17V35X 24 /* Exar XR17V35x UARTs */
53#define PORT_BRCM_TRUMANAGE 24 53#define PORT_BRCM_TRUMANAGE 25
54#define PORT_MAX_8250 25 /* max port ID */ 54#define PORT_MAX_8250 25 /* max port ID */
55 55
56/* 56/*
@@ -220,4 +220,7 @@
220/* ARC (Synopsys) on-chip UART */ 220/* ARC (Synopsys) on-chip UART */
221#define PORT_ARC 101 221#define PORT_ARC 101
222 222
223/* Rocketport EXPRESS/INFINITY */
224#define PORT_RP2 102
225
223#endif /* _UAPILINUX_SERIAL_CORE_H */ 226#endif /* _UAPILINUX_SERIAL_CORE_H */
diff --git a/include/uapi/linux/snmp.h b/include/uapi/linux/snmp.h
index fdfba235f9f1..b49eab89c9fd 100644
--- a/include/uapi/linux/snmp.h
+++ b/include/uapi/linux/snmp.h
@@ -278,6 +278,7 @@ enum
278 LINUX_MIB_XFRMOUTPOLDEAD, /* XfrmOutPolDead */ 278 LINUX_MIB_XFRMOUTPOLDEAD, /* XfrmOutPolDead */
279 LINUX_MIB_XFRMOUTPOLERROR, /* XfrmOutPolError */ 279 LINUX_MIB_XFRMOUTPOLERROR, /* XfrmOutPolError */
280 LINUX_MIB_XFRMFWDHDRERROR, /* XfrmFwdHdrError*/ 280 LINUX_MIB_XFRMFWDHDRERROR, /* XfrmFwdHdrError*/
281 LINUX_MIB_XFRMOUTSTATEINVALID, /* XfrmOutStateInvalid */
281 __LINUX_MIB_XFRMMAX 282 __LINUX_MIB_XFRMMAX
282}; 283};
283 284
diff --git a/include/uapi/linux/tcp.h b/include/uapi/linux/tcp.h
index e962faa5ab0d..6b1ead0b0c9d 100644
--- a/include/uapi/linux/tcp.h
+++ b/include/uapi/linux/tcp.h
@@ -111,6 +111,7 @@ enum {
111#define TCP_QUEUE_SEQ 21 111#define TCP_QUEUE_SEQ 21
112#define TCP_REPAIR_OPTIONS 22 112#define TCP_REPAIR_OPTIONS 22
113#define TCP_FASTOPEN 23 /* Enable FastOpen on listeners */ 113#define TCP_FASTOPEN 23 /* Enable FastOpen on listeners */
114#define TCP_TIMESTAMP 24
114 115
115struct tcp_repair_opt { 116struct tcp_repair_opt {
116 __u32 opt_code; 117 __u32 opt_code;
diff --git a/include/uapi/linux/uhid.h b/include/uapi/linux/uhid.h
index 9c6974f16966..e9ed951e2b09 100644
--- a/include/uapi/linux/uhid.h
+++ b/include/uapi/linux/uhid.h
@@ -86,7 +86,7 @@ struct uhid_feature_answer_req {
86 __u16 err; 86 __u16 err;
87 __u16 size; 87 __u16 size;
88 __u8 data[UHID_DATA_MAX]; 88 __u8 data[UHID_DATA_MAX];
89}; 89} __attribute__((__packed__));
90 90
91struct uhid_event { 91struct uhid_event {
92 __u32 type; 92 __u32 type;
diff --git a/include/uapi/linux/usb/audio.h b/include/uapi/linux/usb/audio.h
index ac90037894d9..d2314be4f0c0 100644
--- a/include/uapi/linux/usb/audio.h
+++ b/include/uapi/linux/usb/audio.h
@@ -384,14 +384,16 @@ static inline __u8 uac_processing_unit_iProcessing(struct uac_processing_unit_de
384 int protocol) 384 int protocol)
385{ 385{
386 __u8 control_size = uac_processing_unit_bControlSize(desc, protocol); 386 __u8 control_size = uac_processing_unit_bControlSize(desc, protocol);
387 return desc->baSourceID[desc->bNrInPins + control_size]; 387 return *(uac_processing_unit_bmControls(desc, protocol)
388 + control_size);
388} 389}
389 390
390static inline __u8 *uac_processing_unit_specific(struct uac_processing_unit_descriptor *desc, 391static inline __u8 *uac_processing_unit_specific(struct uac_processing_unit_descriptor *desc,
391 int protocol) 392 int protocol)
392{ 393{
393 __u8 control_size = uac_processing_unit_bControlSize(desc, protocol); 394 __u8 control_size = uac_processing_unit_bControlSize(desc, protocol);
394 return &desc->baSourceID[desc->bNrInPins + control_size + 1]; 395 return uac_processing_unit_bmControls(desc, protocol)
396 + control_size + 1;
395} 397}
396 398
397/* 4.5.2 Class-Specific AS Interface Descriptor */ 399/* 4.5.2 Class-Specific AS Interface Descriptor */
diff --git a/include/uapi/linux/usb/ch9.h b/include/uapi/linux/usb/ch9.h
index 50598472dc41..f738e25377ff 100644
--- a/include/uapi/linux/usb/ch9.h
+++ b/include/uapi/linux/usb/ch9.h
@@ -152,6 +152,12 @@
152#define USB_INTRF_FUNC_SUSPEND_LP (1 << (8 + 0)) 152#define USB_INTRF_FUNC_SUSPEND_LP (1 << (8 + 0))
153#define USB_INTRF_FUNC_SUSPEND_RW (1 << (8 + 1)) 153#define USB_INTRF_FUNC_SUSPEND_RW (1 << (8 + 1))
154 154
155/*
156 * Interface status, Figure 9-5 USB 3.0 spec
157 */
158#define USB_INTRF_STAT_FUNC_RW_CAP 1
159#define USB_INTRF_STAT_FUNC_RW 2
160
155#define USB_ENDPOINT_HALT 0 /* IN/OUT will STALL */ 161#define USB_ENDPOINT_HALT 0 /* IN/OUT will STALL */
156 162
157/* Bit array elements as returned by the USB_REQ_GET_STATUS request. */ 163/* Bit array elements as returned by the USB_REQ_GET_STATUS request. */
diff --git a/include/uapi/linux/virtio_net.h b/include/uapi/linux/virtio_net.h
index 848e3584d7c8..a5a8c88753b9 100644
--- a/include/uapi/linux/virtio_net.h
+++ b/include/uapi/linux/virtio_net.h
@@ -53,6 +53,7 @@
53 * network */ 53 * network */
54#define VIRTIO_NET_F_MQ 22 /* Device supports Receive Flow 54#define VIRTIO_NET_F_MQ 22 /* Device supports Receive Flow
55 * Steering */ 55 * Steering */
56#define VIRTIO_NET_F_CTRL_MAC_ADDR 23 /* Set MAC address */
56 57
57#define VIRTIO_NET_S_LINK_UP 1 /* Link is up */ 58#define VIRTIO_NET_S_LINK_UP 1 /* Link is up */
58#define VIRTIO_NET_S_ANNOUNCE 2 /* Announcement is needed */ 59#define VIRTIO_NET_S_ANNOUNCE 2 /* Announcement is needed */
@@ -127,7 +128,7 @@ typedef __u8 virtio_net_ctrl_ack;
127 #define VIRTIO_NET_CTRL_RX_NOBCAST 5 128 #define VIRTIO_NET_CTRL_RX_NOBCAST 5
128 129
129/* 130/*
130 * Control the MAC filter table. 131 * Control the MAC
131 * 132 *
132 * The MAC filter table is managed by the hypervisor, the guest should 133 * The MAC filter table is managed by the hypervisor, the guest should
133 * assume the size is infinite. Filtering should be considered 134 * assume the size is infinite. Filtering should be considered
@@ -140,6 +141,10 @@ typedef __u8 virtio_net_ctrl_ack;
140 * first sg list contains unicast addresses, the second is for multicast. 141 * first sg list contains unicast addresses, the second is for multicast.
141 * This functionality is present if the VIRTIO_NET_F_CTRL_RX feature 142 * This functionality is present if the VIRTIO_NET_F_CTRL_RX feature
142 * is available. 143 * is available.
144 *
145 * The ADDR_SET command requests one out scatterlist, it contains a
146 * 6 bytes MAC address. This functionality is present if the
147 * VIRTIO_NET_F_CTRL_MAC_ADDR feature is available.
143 */ 148 */
144struct virtio_net_ctrl_mac { 149struct virtio_net_ctrl_mac {
145 __u32 entries; 150 __u32 entries;
@@ -148,6 +153,7 @@ struct virtio_net_ctrl_mac {
148 153
149#define VIRTIO_NET_CTRL_MAC 1 154#define VIRTIO_NET_CTRL_MAC 1
150 #define VIRTIO_NET_CTRL_MAC_TABLE_SET 0 155 #define VIRTIO_NET_CTRL_MAC_TABLE_SET 0
156 #define VIRTIO_NET_CTRL_MAC_ADDR_SET 1
151 157
152/* 158/*
153 * Control VLAN filtering 159 * Control VLAN filtering
diff --git a/include/uapi/linux/vm_sockets.h b/include/uapi/linux/vm_sockets.h
new file mode 100644
index 000000000000..df91301847ec
--- /dev/null
+++ b/include/uapi/linux/vm_sockets.h
@@ -0,0 +1,163 @@
1/*
2 * VMware vSockets Driver
3 *
4 * Copyright (C) 2007-2013 VMware, Inc. All rights reserved.
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 Free
8 * Software Foundation version 2 and no later version.
9 *
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 */
15
16#ifndef _VM_SOCKETS_H_
17#define _VM_SOCKETS_H_
18
19#if !defined(__KERNEL__)
20#include <sys/socket.h>
21#endif
22
23/* Option name for STREAM socket buffer size. Use as the option name in
24 * setsockopt(3) or getsockopt(3) to set or get an unsigned long long that
25 * specifies the size of the buffer underlying a vSockets STREAM socket.
26 * Value is clamped to the MIN and MAX.
27 */
28
29#define SO_VM_SOCKETS_BUFFER_SIZE 0
30
31/* Option name for STREAM socket minimum buffer size. Use as the option name
32 * in setsockopt(3) or getsockopt(3) to set or get an unsigned long long that
33 * specifies the minimum size allowed for the buffer underlying a vSockets
34 * STREAM socket.
35 */
36
37#define SO_VM_SOCKETS_BUFFER_MIN_SIZE 1
38
39/* Option name for STREAM socket maximum buffer size. Use as the option name
40 * in setsockopt(3) or getsockopt(3) to set or get an unsigned long long
41 * that specifies the maximum size allowed for the buffer underlying a
42 * vSockets STREAM socket.
43 */
44
45#define SO_VM_SOCKETS_BUFFER_MAX_SIZE 2
46
47/* Option name for socket peer's host-specific VM ID. Use as the option name
48 * in getsockopt(3) to get a host-specific identifier for the peer endpoint's
49 * VM. The identifier is a signed integer.
50 * Only available for hypervisor endpoints.
51 */
52
53#define SO_VM_SOCKETS_PEER_HOST_VM_ID 3
54
55/* Option name for determining if a socket is trusted. Use as the option name
56 * in getsockopt(3) to determine if a socket is trusted. The value is a
57 * signed integer.
58 */
59
60#define SO_VM_SOCKETS_TRUSTED 5
61
62/* Option name for STREAM socket connection timeout. Use as the option name
63 * in setsockopt(3) or getsockopt(3) to set or get the connection
64 * timeout for a STREAM socket.
65 */
66
67#define SO_VM_SOCKETS_CONNECT_TIMEOUT 6
68
69/* Option name for using non-blocking send/receive. Use as the option name
70 * for setsockopt(3) or getsockopt(3) to set or get the non-blocking
71 * transmit/receive flag for a STREAM socket. This flag determines whether
72 * send() and recv() can be called in non-blocking contexts for the given
73 * socket. The value is a signed integer.
74 *
75 * This option is only relevant to kernel endpoints, where descheduling the
76 * thread of execution is not allowed, for example, while holding a spinlock.
77 * It is not to be confused with conventional non-blocking socket operations.
78 *
79 * Only available for hypervisor endpoints.
80 */
81
82#define SO_VM_SOCKETS_NONBLOCK_TXRX 7
83
84/* The vSocket equivalent of INADDR_ANY. This works for the svm_cid field of
85 * sockaddr_vm and indicates the context ID of the current endpoint.
86 */
87
88#define VMADDR_CID_ANY -1U
89
90/* Bind to any available port. Works for the svm_port field of
91 * sockaddr_vm.
92 */
93
94#define VMADDR_PORT_ANY -1U
95
96/* Use this as the destination CID in an address when referring to the
97 * hypervisor. VMCI relies on it being 0, but this would be useful for other
98 * transports too.
99 */
100
101#define VMADDR_CID_HYPERVISOR 0
102
103/* This CID is specific to VMCI and can be considered reserved (even VMCI
104 * doesn't use it anymore, it's a legacy value from an older release).
105 */
106
107#define VMADDR_CID_RESERVED 1
108
109/* Use this as the destination CID in an address when referring to the host
110 * (any process other than the hypervisor). VMCI relies on it being 2, but
111 * this would be useful for other transports too.
112 */
113
114#define VMADDR_CID_HOST 2
115
116/* Invalid vSockets version. */
117
118#define VM_SOCKETS_INVALID_VERSION -1U
119
120/* The epoch (first) component of the vSockets version. A single byte
121 * representing the epoch component of the vSockets version.
122 */
123
124#define VM_SOCKETS_VERSION_EPOCH(_v) (((_v) & 0xFF000000) >> 24)
125
126/* The major (second) component of the vSockets version. A single byte
127 * representing the major component of the vSockets version. Typically
128 * changes for every major release of a product.
129 */
130
131#define VM_SOCKETS_VERSION_MAJOR(_v) (((_v) & 0x00FF0000) >> 16)
132
133/* The minor (third) component of the vSockets version. Two bytes representing
134 * the minor component of the vSockets version.
135 */
136
137#define VM_SOCKETS_VERSION_MINOR(_v) (((_v) & 0x0000FFFF))
138
139/* Address structure for vSockets. The address family should be set to
140 * whatever vmci_sock_get_af_value_fd() returns. The structure members should
141 * all align on their natural boundaries without resorting to compiler packing
142 * directives. The total size of this structure should be exactly the same as
143 * that of struct sockaddr.
144 */
145
146struct sockaddr_vm {
147 sa_family_t svm_family;
148 unsigned short svm_reserved1;
149 unsigned int svm_port;
150 unsigned int svm_cid;
151 unsigned char svm_zero[sizeof(struct sockaddr) -
152 sizeof(sa_family_t) -
153 sizeof(unsigned short) -
154 sizeof(unsigned int) - sizeof(unsigned int)];
155};
156
157#define IOCTL_VM_SOCKETS_GET_LOCAL_CID _IO(7, 0xb9)
158
159#if defined(__KERNEL__)
160int vm_sockets_get_local_cid(void);
161#endif
162
163#endif
diff --git a/include/uapi/linux/wanrouter.h b/include/uapi/linux/wanrouter.h
index 7617df2833d5..498d6c12c666 100644
--- a/include/uapi/linux/wanrouter.h
+++ b/include/uapi/linux/wanrouter.h
@@ -1,363 +1,9 @@
1/*****************************************************************************
2* wanrouter.h Definitions for the WAN Multiprotocol Router Module.
3* This module provides API and common services for WAN Link
4* Drivers and is completely hardware-independent.
5*
6* Author: Nenad Corbic <ncorbic@sangoma.com>
7* Gideon Hack
8* Additions: Arnaldo Melo
9*
10* Copyright: (c) 1995-2000 Sangoma Technologies Inc.
11*
12* This program is free software; you can redistribute it and/or
13* modify it under the terms of the GNU General Public License
14* as published by the Free Software Foundation; either version
15* 2 of the License, or (at your option) any later version.
16* ============================================================================
17* Jul 21, 2000 Nenad Corbic Added WAN_FT1_READY State
18* Feb 24, 2000 Nenad Corbic Added support for socket based x25api
19* Jan 28, 2000 Nenad Corbic Added support for the ASYNC protocol.
20* Oct 04, 1999 Nenad Corbic Updated for 2.1.0 release
21* Jun 02, 1999 Gideon Hack Added support for the S514 adapter.
22* May 23, 1999 Arnaldo Melo Added local_addr to wanif_conf_t
23* WAN_DISCONNECTING state added
24* Jul 20, 1998 David Fong Added Inverse ARP options to 'wanif_conf_t'
25* Jun 12, 1998 David Fong Added Cisco HDLC support.
26* Dec 16, 1997 Jaspreet Singh Moved 'enable_IPX' and 'network_number' to
27* 'wanif_conf_t'
28* Dec 05, 1997 Jaspreet Singh Added 'pap', 'chap' to 'wanif_conf_t'
29* Added 'authenticator' to 'wan_ppp_conf_t'
30* Nov 06, 1997 Jaspreet Singh Changed Router Driver version to 1.1 from 1.0
31* Oct 20, 1997 Jaspreet Singh Added 'cir','bc','be' and 'mc' to 'wanif_conf_t'
32* Added 'enable_IPX' and 'network_number' to
33* 'wan_device_t'. Also added defines for
34* UDP PACKET TYPE, Interrupt test, critical values
35* for RACE conditions.
36* Oct 05, 1997 Jaspreet Singh Added 'dlci_num' and 'dlci[100]' to
37* 'wan_fr_conf_t' to configure a list of dlci(s)
38* for a NODE
39* Jul 07, 1997 Jaspreet Singh Added 'ttl' to 'wandev_conf_t' & 'wan_device_t'
40* May 29, 1997 Jaspreet Singh Added 'tx_int_enabled' to 'wan_device_t'
41* May 21, 1997 Jaspreet Singh Added 'udp_port' to 'wan_device_t'
42* Apr 25, 1997 Farhan Thawar Added 'udp_port' to 'wandev_conf_t'
43* Jan 16, 1997 Gene Kozin router_devlist made public
44* Jan 02, 1997 Gene Kozin Initial version (based on wanpipe.h).
45*****************************************************************************/
46
47#ifndef _UAPI_ROUTER_H
48#define _UAPI_ROUTER_H
49
50#define ROUTER_NAME "wanrouter" /* in case we ever change it */
51#define ROUTER_VERSION 1 /* version number */
52#define ROUTER_RELEASE 1 /* release (minor version) number */
53#define ROUTER_IOCTL 'W' /* for IOCTL calls */
54#define ROUTER_MAGIC 0x524D4157L /* signature: 'WANR' reversed */
55
56/* IOCTL codes for /proc/router/<device> entries (up to 255) */
57enum router_ioctls
58{
59 ROUTER_SETUP = ROUTER_IOCTL<<8, /* configure device */
60 ROUTER_DOWN, /* shut down device */
61 ROUTER_STAT, /* get device status */
62 ROUTER_IFNEW, /* add interface */
63 ROUTER_IFDEL, /* delete interface */
64 ROUTER_IFSTAT, /* get interface status */
65 ROUTER_USER = (ROUTER_IOCTL<<8)+16, /* driver-specific calls */
66 ROUTER_USER_MAX = (ROUTER_IOCTL<<8)+31
67};
68
69/* identifiers for displaying proc file data for dual port adapters */
70#define PROC_DATA_PORT_0 0x8000 /* the data is for port 0 */
71#define PROC_DATA_PORT_1 0x8001 /* the data is for port 1 */
72
73/* NLPID for packet encapsulation (ISO/IEC TR 9577) */
74#define NLPID_IP 0xCC /* Internet Protocol Datagram */
75#define NLPID_SNAP 0x80 /* IEEE Subnetwork Access Protocol */
76#define NLPID_CLNP 0x81 /* ISO/IEC 8473 */
77#define NLPID_ESIS 0x82 /* ISO/IEC 9542 */
78#define NLPID_ISIS 0x83 /* ISO/IEC ISIS */
79#define NLPID_Q933 0x08 /* CCITT Q.933 */
80
81/* Miscellaneous */
82#define WAN_IFNAME_SZ 15 /* max length of the interface name */
83#define WAN_DRVNAME_SZ 15 /* max length of the link driver name */
84#define WAN_ADDRESS_SZ 31 /* max length of the WAN media address */
85#define USED_BY_FIELD 8 /* max length of the used by field */
86
87/* Defines for UDP PACKET TYPE */
88#define UDP_PTPIPE_TYPE 0x01
89#define UDP_FPIPE_TYPE 0x02
90#define UDP_CPIPE_TYPE 0x03
91#define UDP_DRVSTATS_TYPE 0x04
92#define UDP_INVALID_TYPE 0x05
93
94/* Command return code */
95#define CMD_OK 0 /* normal firmware return code */
96#define CMD_TIMEOUT 0xFF /* firmware command timed out */
97
98/* UDP Packet Management */
99#define UDP_PKT_FRM_STACK 0x00
100#define UDP_PKT_FRM_NETWORK 0x01
101
102/* Maximum interrupt test counter */
103#define MAX_INTR_TEST_COUNTER 100
104
105/* Critical Values for RACE conditions*/
106#define CRITICAL_IN_ISR 0xA1
107#define CRITICAL_INTR_HANDLED 0xB1
108
109/****** Data Types **********************************************************/
110
111/*----------------------------------------------------------------------------
112 * X.25-specific link-level configuration.
113 */
114typedef struct wan_x25_conf
115{
116 unsigned lo_pvc; /* lowest permanent circuit number */
117 unsigned hi_pvc; /* highest permanent circuit number */
118 unsigned lo_svc; /* lowest switched circuit number */
119 unsigned hi_svc; /* highest switched circuit number */
120 unsigned hdlc_window; /* HDLC window size (1..7) */
121 unsigned pkt_window; /* X.25 packet window size (1..7) */
122 unsigned t1; /* HDLC timer T1, sec (1..30) */
123 unsigned t2; /* HDLC timer T2, sec (0..29) */
124 unsigned t4; /* HDLC supervisory frame timer = T4 * T1 */
125 unsigned n2; /* HDLC retransmission limit (1..30) */
126 unsigned t10_t20; /* X.25 RESTART timeout, sec (1..255) */
127 unsigned t11_t21; /* X.25 CALL timeout, sec (1..255) */
128 unsigned t12_t22; /* X.25 RESET timeout, sec (1..255) */
129 unsigned t13_t23; /* X.25 CLEAR timeout, sec (1..255) */
130 unsigned t16_t26; /* X.25 INTERRUPT timeout, sec (1..255) */
131 unsigned t28; /* X.25 REGISTRATION timeout, sec (1..255) */
132 unsigned r10_r20; /* RESTART retransmission limit (0..250) */
133 unsigned r12_r22; /* RESET retransmission limit (0..250) */
134 unsigned r13_r23; /* CLEAR retransmission limit (0..250) */
135 unsigned ccitt_compat; /* compatibility mode: 1988/1984/1980 */
136 unsigned x25_conf_opt; /* User defined x25 config optoins */
137 unsigned char LAPB_hdlc_only; /* Run in HDLC only mode */
138 unsigned char logging; /* Control connection logging */
139 unsigned char oob_on_modem; /* Whether to send modem status to the user app */
140} wan_x25_conf_t;
141
142/*----------------------------------------------------------------------------
143 * Frame relay specific link-level configuration.
144 */
145typedef struct wan_fr_conf
146{
147 unsigned signalling; /* local in-channel signalling type */
148 unsigned t391; /* link integrity verification timer */
149 unsigned t392; /* polling verification timer */
150 unsigned n391; /* full status polling cycle counter */
151 unsigned n392; /* error threshold counter */
152 unsigned n393; /* monitored events counter */
153 unsigned dlci_num; /* number of DLCs (access node) */
154 unsigned dlci[100]; /* List of all DLCIs */
155} wan_fr_conf_t;
156
157/*----------------------------------------------------------------------------
158 * PPP-specific link-level configuration.
159 */
160typedef struct wan_ppp_conf
161{
162 unsigned restart_tmr; /* restart timer */
163 unsigned auth_rsrt_tmr; /* authentication timer */
164 unsigned auth_wait_tmr; /* authentication timer */
165 unsigned mdm_fail_tmr; /* modem failure timer */
166 unsigned dtr_drop_tmr; /* DTR drop timer */
167 unsigned connect_tmout; /* connection timeout */
168 unsigned conf_retry; /* max. retry */
169 unsigned term_retry; /* max. retry */
170 unsigned fail_retry; /* max. retry */
171 unsigned auth_retry; /* max. retry */
172 unsigned auth_options; /* authentication opt. */
173 unsigned ip_options; /* IP options */
174 char authenticator; /* AUTHENTICATOR or not */
175 char ip_mode; /* Static/Host/Peer */
176} wan_ppp_conf_t;
177
178/*----------------------------------------------------------------------------
179 * CHDLC-specific link-level configuration.
180 */
181typedef struct wan_chdlc_conf
182{
183 unsigned char ignore_dcd; /* Protocol options: */
184 unsigned char ignore_cts; /* Ignore these to determine */
185 unsigned char ignore_keepalive; /* link status (Yes or No) */
186 unsigned char hdlc_streaming; /* hdlc_streaming mode (Y/N) */
187 unsigned char receive_only; /* no transmit buffering (Y/N) */
188 unsigned keepalive_tx_tmr; /* transmit keepalive timer */
189 unsigned keepalive_rx_tmr; /* receive keepalive timer */
190 unsigned keepalive_err_margin; /* keepalive_error_tolerance */
191 unsigned slarp_timer; /* SLARP request timer */
192} wan_chdlc_conf_t;
193
194
195/*----------------------------------------------------------------------------
196 * WAN device configuration. Passed to ROUTER_SETUP IOCTL.
197 */
198typedef struct wandev_conf
199{
200 unsigned magic; /* magic number (for verification) */
201 unsigned config_id; /* configuration structure identifier */
202 /****** hardware configuration ******/
203 unsigned ioport; /* adapter I/O port base */
204 unsigned long maddr; /* dual-port memory address */
205 unsigned msize; /* dual-port memory size */
206 int irq; /* interrupt request level */
207 int dma; /* DMA request level */
208 char S514_CPU_no[1]; /* S514 PCI adapter CPU number ('A' or 'B') */
209 unsigned PCI_slot_no; /* S514 PCI adapter slot number */
210 char auto_pci_cfg; /* S515 PCI automatic slot detection */
211 char comm_port; /* Communication Port (PRI=0, SEC=1) */
212 unsigned bps; /* data transfer rate */
213 unsigned mtu; /* maximum transmit unit size */
214 unsigned udp_port; /* UDP port for management */
215 unsigned char ttl; /* Time To Live for UDP security */
216 unsigned char ft1; /* FT1 Configurator Option */
217 char interface; /* RS-232/V.35, etc. */
218 char clocking; /* external/internal */
219 char line_coding; /* NRZ/NRZI/FM0/FM1, etc. */
220 char station; /* DTE/DCE, primary/secondary, etc. */
221 char connection; /* permanent/switched/on-demand */
222 char read_mode; /* read mode: Polling or interrupt */
223 char receive_only; /* disable tx buffers */
224 char tty; /* Create a fake tty device */
225 unsigned tty_major; /* Major number for wanpipe tty device */
226 unsigned tty_minor; /* Minor number for wanpipe tty device */
227 unsigned tty_mode; /* TTY operation mode SYNC or ASYNC */
228 char backup; /* Backup Mode */
229 unsigned hw_opt[4]; /* other hardware options */
230 unsigned reserved[4];
231 /****** arbitrary data ***************/
232 unsigned data_size; /* data buffer size */
233 void* data; /* data buffer, e.g. firmware */
234 union /****** protocol-specific ************/
235 {
236 wan_x25_conf_t x25; /* X.25 configuration */
237 wan_ppp_conf_t ppp; /* PPP configuration */
238 wan_fr_conf_t fr; /* frame relay configuration */
239 wan_chdlc_conf_t chdlc; /* Cisco HDLC configuration */
240 } u;
241} wandev_conf_t;
242
243/* 'config_id' definitions */
244#define WANCONFIG_X25 101 /* X.25 link */
245#define WANCONFIG_FR 102 /* frame relay link */
246#define WANCONFIG_PPP 103 /* synchronous PPP link */
247#define WANCONFIG_CHDLC 104 /* Cisco HDLC Link */
248#define WANCONFIG_BSC 105 /* BiSync Streaming */
249#define WANCONFIG_HDLC 106 /* HDLC Support */
250#define WANCONFIG_MPPP 107 /* Multi Port PPP over RAW CHDLC */
251
252/* 1/*
253 * Configuration options defines. 2 * wanrouter.h Legacy declarations kept around until X25 is removed
254 */ 3 */
255/* general options */
256#define WANOPT_OFF 0
257#define WANOPT_ON 1
258#define WANOPT_NO 0
259#define WANOPT_YES 1
260
261/* intercace options */
262#define WANOPT_RS232 0
263#define WANOPT_V35 1
264
265/* data encoding options */
266#define WANOPT_NRZ 0
267#define WANOPT_NRZI 1
268#define WANOPT_FM0 2
269#define WANOPT_FM1 3
270
271/* link type options */
272#define WANOPT_POINTTOPOINT 0 /* RTS always active */
273#define WANOPT_MULTIDROP 1 /* RTS is active when transmitting */
274
275/* clocking options */
276#define WANOPT_EXTERNAL 0
277#define WANOPT_INTERNAL 1
278
279/* station options */
280#define WANOPT_DTE 0
281#define WANOPT_DCE 1
282#define WANOPT_CPE 0
283#define WANOPT_NODE 1
284#define WANOPT_SECONDARY 0
285#define WANOPT_PRIMARY 1
286
287/* connection options */
288#define WANOPT_PERMANENT 0 /* DTR always active */
289#define WANOPT_SWITCHED 1 /* use DTR to setup link (dial-up) */
290#define WANOPT_ONDEMAND 2 /* activate DTR only before sending */
291
292/* frame relay in-channel signalling */
293#define WANOPT_FR_ANSI 1 /* ANSI T1.617 Annex D */
294#define WANOPT_FR_Q933 2 /* ITU Q.933A */
295#define WANOPT_FR_LMI 3 /* LMI */
296
297/* PPP IP Mode Options */
298#define WANOPT_PPP_STATIC 0
299#define WANOPT_PPP_HOST 1
300#define WANOPT_PPP_PEER 2
301
302/* ASY Mode Options */
303#define WANOPT_ONE 1
304#define WANOPT_TWO 2
305#define WANOPT_ONE_AND_HALF 3
306
307#define WANOPT_NONE 0
308#define WANOPT_ODD 1
309#define WANOPT_EVEN 2
310
311/* CHDLC Protocol Options */
312/* DF Commented out for now.
313
314#define WANOPT_CHDLC_NO_DCD IGNORE_DCD_FOR_LINK_STAT
315#define WANOPT_CHDLC_NO_CTS IGNORE_CTS_FOR_LINK_STAT
316#define WANOPT_CHDLC_NO_KEEPALIVE IGNORE_KPALV_FOR_LINK_STAT
317*/
318
319/* Port options */
320#define WANOPT_PRI 0
321#define WANOPT_SEC 1
322/* read mode */
323#define WANOPT_INTR 0
324#define WANOPT_POLL 1
325 4
326 5#ifndef _UAPI_ROUTER_H
327#define WANOPT_TTY_SYNC 0 6#define _UAPI_ROUTER_H
328#define WANOPT_TTY_ASYNC 1
329/*----------------------------------------------------------------------------
330 * WAN Link Status Info (for ROUTER_STAT IOCTL).
331 */
332typedef struct wandev_stat
333{
334 unsigned state; /* link state */
335 unsigned ndev; /* number of configured interfaces */
336
337 /* link/interface configuration */
338 unsigned connection; /* permanent/switched/on-demand */
339 unsigned media_type; /* Frame relay/PPP/X.25/SDLC, etc. */
340 unsigned mtu; /* max. transmit unit for this device */
341
342 /* physical level statistics */
343 unsigned modem_status; /* modem status */
344 unsigned rx_frames; /* received frames count */
345 unsigned rx_overruns; /* receiver overrun error count */
346 unsigned rx_crc_err; /* receive CRC error count */
347 unsigned rx_aborts; /* received aborted frames count */
348 unsigned rx_bad_length; /* unexpetedly long/short frames count */
349 unsigned rx_dropped; /* frames discarded at device level */
350 unsigned tx_frames; /* transmitted frames count */
351 unsigned tx_underruns; /* aborted transmissions (underruns) count */
352 unsigned tx_timeouts; /* transmission timeouts */
353 unsigned tx_rejects; /* other transmit errors */
354
355 /* media level statistics */
356 unsigned rx_bad_format; /* frames with invalid format */
357 unsigned rx_bad_addr; /* frames with invalid media address */
358 unsigned tx_retries; /* frames re-transmitted */
359 unsigned reserved[16]; /* reserved for future use */
360} wandev_stat_t;
361 7
362/* 'state' defines */ 8/* 'state' defines */
363enum wan_states 9enum wan_states
@@ -365,88 +11,7 @@ enum wan_states
365 WAN_UNCONFIGURED, /* link/channel is not configured */ 11 WAN_UNCONFIGURED, /* link/channel is not configured */
366 WAN_DISCONNECTED, /* link/channel is disconnected */ 12 WAN_DISCONNECTED, /* link/channel is disconnected */
367 WAN_CONNECTING, /* connection is in progress */ 13 WAN_CONNECTING, /* connection is in progress */
368 WAN_CONNECTED, /* link/channel is operational */ 14 WAN_CONNECTED /* link/channel is operational */
369 WAN_LIMIT, /* for verification only */
370 WAN_DUALPORT, /* for Dual Port cards */
371 WAN_DISCONNECTING,
372 WAN_FT1_READY /* FT1 Configurator Ready */
373}; 15};
374 16
375enum {
376 WAN_LOCAL_IP,
377 WAN_POINTOPOINT_IP,
378 WAN_NETMASK_IP,
379 WAN_BROADCAST_IP
380};
381
382/* 'modem_status' masks */
383#define WAN_MODEM_CTS 0x0001 /* CTS line active */
384#define WAN_MODEM_DCD 0x0002 /* DCD line active */
385#define WAN_MODEM_DTR 0x0010 /* DTR line active */
386#define WAN_MODEM_RTS 0x0020 /* RTS line active */
387
388/*----------------------------------------------------------------------------
389 * WAN interface (logical channel) configuration (for ROUTER_IFNEW IOCTL).
390 */
391typedef struct wanif_conf
392{
393 unsigned magic; /* magic number */
394 unsigned config_id; /* configuration identifier */
395 char name[WAN_IFNAME_SZ+1]; /* interface name, ASCIIZ */
396 char addr[WAN_ADDRESS_SZ+1]; /* media address, ASCIIZ */
397 char usedby[USED_BY_FIELD]; /* used by API or WANPIPE */
398 unsigned idle_timeout; /* sec, before disconnecting */
399 unsigned hold_timeout; /* sec, before re-connecting */
400 unsigned cir; /* Committed Information Rate fwd,bwd*/
401 unsigned bc; /* Committed Burst Size fwd, bwd */
402 unsigned be; /* Excess Burst Size fwd, bwd */
403 unsigned char enable_IPX; /* Enable or Disable IPX */
404 unsigned char inarp; /* Send Inverse ARP requests Y/N */
405 unsigned inarp_interval; /* sec, between InARP requests */
406 unsigned long network_number; /* Network Number for IPX */
407 char mc; /* Multicast on or off */
408 char local_addr[WAN_ADDRESS_SZ+1];/* local media address, ASCIIZ */
409 unsigned char port; /* board port */
410 unsigned char protocol; /* prococol used in this channel (TCPOX25 or X25) */
411 char pap; /* PAP enabled or disabled */
412 char chap; /* CHAP enabled or disabled */
413 unsigned char userid[511]; /* List of User Id */
414 unsigned char passwd[511]; /* List of passwords */
415 unsigned char sysname[31]; /* Name of the system */
416 unsigned char ignore_dcd; /* Protocol options: */
417 unsigned char ignore_cts; /* Ignore these to determine */
418 unsigned char ignore_keepalive; /* link status (Yes or No) */
419 unsigned char hdlc_streaming; /* Hdlc streaming mode (Y/N) */
420 unsigned keepalive_tx_tmr; /* transmit keepalive timer */
421 unsigned keepalive_rx_tmr; /* receive keepalive timer */
422 unsigned keepalive_err_margin; /* keepalive_error_tolerance */
423 unsigned slarp_timer; /* SLARP request timer */
424 unsigned char ttl; /* Time To Live for UDP security */
425 char interface; /* RS-232/V.35, etc. */
426 char clocking; /* external/internal */
427 unsigned bps; /* data transfer rate */
428 unsigned mtu; /* maximum transmit unit size */
429 unsigned char if_down; /* brind down interface when disconnected */
430 unsigned char gateway; /* Is this interface a gateway */
431 unsigned char true_if_encoding; /* Set the dev->type to true board protocol */
432
433 unsigned char asy_data_trans; /* async API options */
434 unsigned char rts_hs_for_receive; /* async Protocol options */
435 unsigned char xon_xoff_hs_for_receive;
436 unsigned char xon_xoff_hs_for_transmit;
437 unsigned char dcd_hs_for_transmit;
438 unsigned char cts_hs_for_transmit;
439 unsigned char async_mode;
440 unsigned tx_bits_per_char;
441 unsigned rx_bits_per_char;
442 unsigned stop_bits;
443 unsigned char parity;
444 unsigned break_timer;
445 unsigned inter_char_timer;
446 unsigned rx_complete_length;
447 unsigned xon_char;
448 unsigned xoff_char;
449 unsigned char receive_only; /* no transmit buffering (Y/N) */
450} wanif_conf_t;
451
452#endif /* _UAPI_ROUTER_H */ 17#endif /* _UAPI_ROUTER_H */
diff --git a/include/uapi/sound/compress_offload.h b/include/uapi/sound/compress_offload.h
index 05341a43fedf..d630163b9a2e 100644
--- a/include/uapi/sound/compress_offload.h
+++ b/include/uapi/sound/compress_offload.h
@@ -30,7 +30,7 @@
30#include <sound/compress_params.h> 30#include <sound/compress_params.h>
31 31
32 32
33#define SNDRV_COMPRESS_VERSION SNDRV_PROTOCOL_VERSION(0, 1, 0) 33#define SNDRV_COMPRESS_VERSION SNDRV_PROTOCOL_VERSION(0, 1, 1)
34/** 34/**
35 * struct snd_compressed_buffer: compressed buffer 35 * struct snd_compressed_buffer: compressed buffer
36 * @fragment_size: size of buffer fragment in bytes 36 * @fragment_size: size of buffer fragment in bytes
@@ -122,6 +122,27 @@ struct snd_compr_codec_caps {
122}; 122};
123 123
124/** 124/**
125 * @SNDRV_COMPRESS_ENCODER_PADDING: no of samples appended by the encoder at the
126 * end of the track
127 * @SNDRV_COMPRESS_ENCODER_DELAY: no of samples inserted by the encoder at the
128 * beginning of the track
129 */
130enum {
131 SNDRV_COMPRESS_ENCODER_PADDING = 1,
132 SNDRV_COMPRESS_ENCODER_DELAY = 2,
133};
134
135/**
136 * struct snd_compr_metadata: compressed stream metadata
137 * @key: key id
138 * @value: key value
139 */
140struct snd_compr_metadata {
141 __u32 key;
142 __u32 value[8];
143};
144
145/**
125 * compress path ioctl definitions 146 * compress path ioctl definitions
126 * SNDRV_COMPRESS_GET_CAPS: Query capability of DSP 147 * SNDRV_COMPRESS_GET_CAPS: Query capability of DSP
127 * SNDRV_COMPRESS_GET_CODEC_CAPS: Query capability of a codec 148 * SNDRV_COMPRESS_GET_CODEC_CAPS: Query capability of a codec
@@ -145,6 +166,10 @@ struct snd_compr_codec_caps {
145 struct snd_compr_codec_caps) 166 struct snd_compr_codec_caps)
146#define SNDRV_COMPRESS_SET_PARAMS _IOW('C', 0x12, struct snd_compr_params) 167#define SNDRV_COMPRESS_SET_PARAMS _IOW('C', 0x12, struct snd_compr_params)
147#define SNDRV_COMPRESS_GET_PARAMS _IOR('C', 0x13, struct snd_codec) 168#define SNDRV_COMPRESS_GET_PARAMS _IOR('C', 0x13, struct snd_codec)
169#define SNDRV_COMPRESS_SET_METADATA _IOW('C', 0x14,\
170 struct snd_compr_metadata)
171#define SNDRV_COMPRESS_GET_METADATA _IOWR('C', 0x15,\
172 struct snd_compr_metadata)
148#define SNDRV_COMPRESS_TSTAMP _IOR('C', 0x20, struct snd_compr_tstamp) 173#define SNDRV_COMPRESS_TSTAMP _IOR('C', 0x20, struct snd_compr_tstamp)
149#define SNDRV_COMPRESS_AVAIL _IOR('C', 0x21, struct snd_compr_avail) 174#define SNDRV_COMPRESS_AVAIL _IOR('C', 0x21, struct snd_compr_avail)
150#define SNDRV_COMPRESS_PAUSE _IO('C', 0x30) 175#define SNDRV_COMPRESS_PAUSE _IO('C', 0x30)
@@ -152,10 +177,14 @@ struct snd_compr_codec_caps {
152#define SNDRV_COMPRESS_START _IO('C', 0x32) 177#define SNDRV_COMPRESS_START _IO('C', 0x32)
153#define SNDRV_COMPRESS_STOP _IO('C', 0x33) 178#define SNDRV_COMPRESS_STOP _IO('C', 0x33)
154#define SNDRV_COMPRESS_DRAIN _IO('C', 0x34) 179#define SNDRV_COMPRESS_DRAIN _IO('C', 0x34)
180#define SNDRV_COMPRESS_NEXT_TRACK _IO('C', 0x35)
181#define SNDRV_COMPRESS_PARTIAL_DRAIN _IO('C', 0x36)
155/* 182/*
156 * TODO 183 * TODO
157 * 1. add mmap support 184 * 1. add mmap support
158 * 185 *
159 */ 186 */
160#define SND_COMPR_TRIGGER_DRAIN 7 /*FIXME move this to pcm.h */ 187#define SND_COMPR_TRIGGER_DRAIN 7 /*FIXME move this to pcm.h */
188#define SND_COMPR_TRIGGER_NEXT_TRACK 8
189#define SND_COMPR_TRIGGER_PARTIAL_DRAIN 9
161#endif 190#endif
diff --git a/include/video/exynos_mipi_dsim.h b/include/video/exynos_mipi_dsim.h
index 83ce5e667d47..89dc88a171af 100644
--- a/include/video/exynos_mipi_dsim.h
+++ b/include/video/exynos_mipi_dsim.h
@@ -220,7 +220,6 @@ struct mipi_dsim_config {
220struct mipi_dsim_device { 220struct mipi_dsim_device {
221 struct device *dev; 221 struct device *dev;
222 int id; 222 int id;
223 struct resource *res;
224 struct clk *clock; 223 struct clk *clock;
225 unsigned int irq; 224 unsigned int irq;
226 void __iomem *reg_base; 225 void __iomem *reg_base;
diff --git a/include/video/mmp_disp.h b/include/video/mmp_disp.h
new file mode 100644
index 000000000000..b9dd1fbb0082
--- /dev/null
+++ b/include/video/mmp_disp.h
@@ -0,0 +1,352 @@
1/*
2 * linux/include/video/mmp_disp.h
3 * Header file for Marvell MMP Display Controller
4 *
5 * Copyright (C) 2012 Marvell Technology Group Ltd.
6 * Authors: Zhou Zhu <zzhu3@marvell.com>
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful, but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 * more details.
17 *
18 * You should have received a copy of the GNU General Public License along with
19 * this program. If not, see <http://www.gnu.org/licenses/>.
20 *
21 */
22
23#ifndef _MMP_DISP_H_
24#define _MMP_DISP_H_
25#include <linux/kthread.h>
26
27enum {
28 PIXFMT_UYVY = 0,
29 PIXFMT_VYUY,
30 PIXFMT_YUYV,
31 PIXFMT_YUV422P,
32 PIXFMT_YVU422P,
33 PIXFMT_YUV420P,
34 PIXFMT_YVU420P,
35 PIXFMT_RGB565 = 0x100,
36 PIXFMT_BGR565,
37 PIXFMT_RGB1555,
38 PIXFMT_BGR1555,
39 PIXFMT_RGB888PACK,
40 PIXFMT_BGR888PACK,
41 PIXFMT_RGB888UNPACK,
42 PIXFMT_BGR888UNPACK,
43 PIXFMT_RGBA888,
44 PIXFMT_BGRA888,
45 PIXFMT_RGB666, /* for output usage */
46 PIXFMT_PSEUDOCOLOR = 0x200,
47};
48
49static inline int pixfmt_to_stride(int pix_fmt)
50{
51 switch (pix_fmt) {
52 case PIXFMT_RGB565:
53 case PIXFMT_BGR565:
54 case PIXFMT_RGB1555:
55 case PIXFMT_BGR1555:
56 case PIXFMT_UYVY:
57 case PIXFMT_VYUY:
58 case PIXFMT_YUYV:
59 return 2;
60 case PIXFMT_RGB888UNPACK:
61 case PIXFMT_BGR888UNPACK:
62 case PIXFMT_RGBA888:
63 case PIXFMT_BGRA888:
64 return 4;
65 case PIXFMT_RGB888PACK:
66 case PIXFMT_BGR888PACK:
67 return 3;
68 case PIXFMT_YUV422P:
69 case PIXFMT_YVU422P:
70 case PIXFMT_YUV420P:
71 case PIXFMT_YVU420P:
72 case PIXFMT_PSEUDOCOLOR:
73 return 1;
74 default:
75 return 0;
76 }
77}
78
79/* parameters used by path/overlay */
80/* overlay related para: win/addr */
81struct mmp_win {
82 /* position/size of window */
83 u16 xsrc;
84 u16 ysrc;
85 u16 xdst;
86 u16 ydst;
87 u16 xpos;
88 u16 ypos;
89 u16 left_crop;
90 u16 right_crop;
91 u16 up_crop;
92 u16 bottom_crop;
93 int pix_fmt;
94};
95
96struct mmp_addr {
97 /* phys address */
98 u32 phys[6];
99};
100
101/* path related para: mode */
102struct mmp_mode {
103 const char *name;
104 u32 refresh;
105 u32 xres;
106 u32 yres;
107 u32 left_margin;
108 u32 right_margin;
109 u32 upper_margin;
110 u32 lower_margin;
111 u32 hsync_len;
112 u32 vsync_len;
113 u32 hsync_invert;
114 u32 vsync_invert;
115 u32 invert_pixclock;
116 u32 pixclock_freq;
117 int pix_fmt_out;
118};
119
120/* main structures */
121struct mmp_path;
122struct mmp_overlay;
123struct mmp_panel;
124
125/* status types */
126enum {
127 MMP_OFF = 0,
128 MMP_ON,
129};
130
131static inline const char *stat_name(int stat)
132{
133 switch (stat) {
134 case MMP_OFF:
135 return "OFF";
136 case MMP_ON:
137 return "ON";
138 default:
139 return "UNKNOWNSTAT";
140 }
141}
142
143struct mmp_overlay_ops {
144 /* should be provided by driver */
145 void (*set_fetch)(struct mmp_overlay *overlay, int fetch_id);
146 void (*set_onoff)(struct mmp_overlay *overlay, int status);
147 void (*set_win)(struct mmp_overlay *overlay, struct mmp_win *win);
148 int (*set_addr)(struct mmp_overlay *overlay, struct mmp_addr *addr);
149};
150
151/* overlay describes a z-order indexed slot in each path. */
152struct mmp_overlay {
153 int id;
154 const char *name;
155 struct mmp_path *path;
156
157 /* overlay info: private data */
158 int dmafetch_id;
159 struct mmp_addr addr;
160 struct mmp_win win;
161
162 /* state */
163 int open_count;
164 int status;
165 struct mutex access_ok;
166
167 struct mmp_overlay_ops *ops;
168};
169
170/* panel type */
171enum {
172 PANELTYPE_ACTIVE = 0,
173 PANELTYPE_SMART,
174 PANELTYPE_TV,
175 PANELTYPE_DSI_CMD,
176 PANELTYPE_DSI_VIDEO,
177};
178
179struct mmp_panel {
180 /* use node to register to list */
181 struct list_head node;
182 const char *name;
183 /* path name used to connect to proper path configed */
184 const char *plat_path_name;
185 struct device *dev;
186 int panel_type;
187 void *plat_data;
188 int (*get_modelist)(struct mmp_panel *panel,
189 struct mmp_mode **modelist);
190 void (*set_mode)(struct mmp_panel *panel,
191 struct mmp_mode *mode);
192 void (*set_onoff)(struct mmp_panel *panel,
193 int status);
194};
195
196struct mmp_path_ops {
197 int (*check_status)(struct mmp_path *path);
198 struct mmp_overlay *(*get_overlay)(struct mmp_path *path,
199 int overlay_id);
200 int (*get_modelist)(struct mmp_path *path,
201 struct mmp_mode **modelist);
202
203 /* follow ops should be provided by driver */
204 void (*set_mode)(struct mmp_path *path, struct mmp_mode *mode);
205 void (*set_onoff)(struct mmp_path *path, int status);
206 /* todo: add query */
207};
208
209/* path output types */
210enum {
211 PATH_OUT_PARALLEL,
212 PATH_OUT_DSI,
213 PATH_OUT_HDMI,
214};
215
216/* path is main part of mmp-disp */
217struct mmp_path {
218 /* use node to register to list */
219 struct list_head node;
220
221 /* init data */
222 struct device *dev;
223
224 int id;
225 const char *name;
226 int output_type;
227 struct mmp_panel *panel;
228 void *plat_data;
229
230 /* dynamic use */
231 struct mmp_mode mode;
232
233 /* state */
234 int open_count;
235 int status;
236 struct mutex access_ok;
237
238 struct mmp_path_ops ops;
239
240 /* layers */
241 int overlay_num;
242 struct mmp_overlay overlays[0];
243};
244
245extern struct mmp_path *mmp_get_path(const char *name);
246static inline void mmp_path_set_mode(struct mmp_path *path,
247 struct mmp_mode *mode)
248{
249 if (path)
250 path->ops.set_mode(path, mode);
251}
252static inline void mmp_path_set_onoff(struct mmp_path *path, int status)
253{
254 if (path)
255 path->ops.set_onoff(path, status);
256}
257static inline int mmp_path_get_modelist(struct mmp_path *path,
258 struct mmp_mode **modelist)
259{
260 if (path)
261 return path->ops.get_modelist(path, modelist);
262 return 0;
263}
264static inline struct mmp_overlay *mmp_path_get_overlay(
265 struct mmp_path *path, int overlay_id)
266{
267 if (path)
268 return path->ops.get_overlay(path, overlay_id);
269 return NULL;
270}
271static inline void mmp_overlay_set_fetch(struct mmp_overlay *overlay,
272 int fetch_id)
273{
274 if (overlay)
275 overlay->ops->set_fetch(overlay, fetch_id);
276}
277static inline void mmp_overlay_set_onoff(struct mmp_overlay *overlay,
278 int status)
279{
280 if (overlay)
281 overlay->ops->set_onoff(overlay, status);
282}
283static inline void mmp_overlay_set_win(struct mmp_overlay *overlay,
284 struct mmp_win *win)
285{
286 if (overlay)
287 overlay->ops->set_win(overlay, win);
288}
289static inline int mmp_overlay_set_addr(struct mmp_overlay *overlay,
290 struct mmp_addr *addr)
291{
292 if (overlay)
293 return overlay->ops->set_addr(overlay, addr);
294 return 0;
295}
296
297/*
298 * driver data is set from each detailed ctrl driver for path usage
299 * it defined a common interface that plat driver need to implement
300 */
301struct mmp_path_info {
302 /* driver data, set when registed*/
303 const char *name;
304 struct device *dev;
305 int id;
306 int output_type;
307 int overlay_num;
308 void (*set_mode)(struct mmp_path *path, struct mmp_mode *mode);
309 void (*set_onoff)(struct mmp_path *path, int status);
310 struct mmp_overlay_ops *overlay_ops;
311 void *plat_data;
312};
313
314extern struct mmp_path *mmp_register_path(
315 struct mmp_path_info *info);
316extern void mmp_unregister_path(struct mmp_path *path);
317extern void mmp_register_panel(struct mmp_panel *panel);
318extern void mmp_unregister_panel(struct mmp_panel *panel);
319
320/* defintions for platform data */
321/* interface for buffer driver */
322struct mmp_buffer_driver_mach_info {
323 const char *name;
324 const char *path_name;
325 int overlay_id;
326 int dmafetch_id;
327 int default_pixfmt;
328};
329
330/* interface for controllers driver */
331struct mmp_mach_path_config {
332 const char *name;
333 int overlay_num;
334 int output_type;
335 u32 path_config;
336 u32 link_config;
337};
338
339struct mmp_mach_plat_info {
340 const char *name;
341 const char *clk_name;
342 int path_num;
343 struct mmp_mach_path_config *paths;
344};
345
346/* interface for panel drivers */
347struct mmp_mach_panel_info {
348 const char *name;
349 void (*plat_set_onoff)(int status);
350 const char *plat_path_name;
351};
352#endif /* _MMP_DISP_H_ */
diff --git a/include/video/samsung_fimd.h b/include/video/samsung_fimd.h
index e7554486a2b7..b0393209679b 100644
--- a/include/video/samsung_fimd.h
+++ b/include/video/samsung_fimd.h
@@ -8,12 +8,8 @@
8 * S3C Platform - new-style fimd and framebuffer register definitions 8 * S3C Platform - new-style fimd and framebuffer register definitions
9 * 9 *
10 * This is the register set for the fimd and new style framebuffer interface 10 * This is the register set for the fimd and new style framebuffer interface
11 * found from the S3C2443 onwards into the S3C2416, S3C2450 and the 11 * found from the S3C2443 onwards into the S3C2416, S3C2450, the
12 * S3C64XX series such as the S3C6400 and S3C6410. 12 * S3C64XX series such as the S3C6400 and S3C6410, and EXYNOS series.
13 *
14 * The file does not contain the cpu specific items which are based on
15 * whichever architecture is selected, it only contains the core of the
16 * register set. See <mach/regs-fb.h> to get the specifics.
17 * 13 *
18 * This program is free software; you can redistribute it and/or modify 14 * This program is free software; you can redistribute it and/or modify
19 * it under the terms of the GNU General Public License version 2 as 15 * it under the terms of the GNU General Public License version 2 as
@@ -22,10 +18,10 @@
22 18
23/* VIDCON0 */ 19/* VIDCON0 */
24 20
25#define VIDCON0 (0x00) 21#define VIDCON0 0x00
26#define VIDCON0_INTERLACE (1 << 29) 22#define VIDCON0_INTERLACE (1 << 29)
27#define VIDCON0_VIDOUT_MASK (0x7 << 26) 23#define VIDCON0_VIDOUT_MASK (0x7 << 26)
28#define VIDCON0_VIDOUT_SHIFT (26) 24#define VIDCON0_VIDOUT_SHIFT 26
29#define VIDCON0_VIDOUT_RGB (0x0 << 26) 25#define VIDCON0_VIDOUT_RGB (0x0 << 26)
30#define VIDCON0_VIDOUT_TV (0x1 << 26) 26#define VIDCON0_VIDOUT_TV (0x1 << 26)
31#define VIDCON0_VIDOUT_I80_LDI0 (0x2 << 26) 27#define VIDCON0_VIDOUT_I80_LDI0 (0x2 << 26)
@@ -35,7 +31,7 @@
35#define VIDCON0_VIDOUT_WB_I80_LDI1 (0x7 << 26) 31#define VIDCON0_VIDOUT_WB_I80_LDI1 (0x7 << 26)
36 32
37#define VIDCON0_L1_DATA_MASK (0x7 << 23) 33#define VIDCON0_L1_DATA_MASK (0x7 << 23)
38#define VIDCON0_L1_DATA_SHIFT (23) 34#define VIDCON0_L1_DATA_SHIFT 23
39#define VIDCON0_L1_DATA_16BPP (0x0 << 23) 35#define VIDCON0_L1_DATA_16BPP (0x0 << 23)
40#define VIDCON0_L1_DATA_18BPP16 (0x1 << 23) 36#define VIDCON0_L1_DATA_18BPP16 (0x1 << 23)
41#define VIDCON0_L1_DATA_18BPP9 (0x2 << 23) 37#define VIDCON0_L1_DATA_18BPP9 (0x2 << 23)
@@ -44,7 +40,7 @@
44#define VIDCON0_L1_DATA_16BPP8 (0x5 << 23) 40#define VIDCON0_L1_DATA_16BPP8 (0x5 << 23)
45 41
46#define VIDCON0_L0_DATA_MASK (0x7 << 20) 42#define VIDCON0_L0_DATA_MASK (0x7 << 20)
47#define VIDCON0_L0_DATA_SHIFT (20) 43#define VIDCON0_L0_DATA_SHIFT 20
48#define VIDCON0_L0_DATA_16BPP (0x0 << 20) 44#define VIDCON0_L0_DATA_16BPP (0x0 << 20)
49#define VIDCON0_L0_DATA_18BPP16 (0x1 << 20) 45#define VIDCON0_L0_DATA_18BPP16 (0x1 << 20)
50#define VIDCON0_L0_DATA_18BPP9 (0x2 << 20) 46#define VIDCON0_L0_DATA_18BPP9 (0x2 << 20)
@@ -53,7 +49,7 @@
53#define VIDCON0_L0_DATA_16BPP8 (0x5 << 20) 49#define VIDCON0_L0_DATA_16BPP8 (0x5 << 20)
54 50
55#define VIDCON0_PNRMODE_MASK (0x3 << 17) 51#define VIDCON0_PNRMODE_MASK (0x3 << 17)
56#define VIDCON0_PNRMODE_SHIFT (17) 52#define VIDCON0_PNRMODE_SHIFT 17
57#define VIDCON0_PNRMODE_RGB (0x0 << 17) 53#define VIDCON0_PNRMODE_RGB (0x0 << 17)
58#define VIDCON0_PNRMODE_BGR (0x1 << 17) 54#define VIDCON0_PNRMODE_BGR (0x1 << 17)
59#define VIDCON0_PNRMODE_SERIAL_RGB (0x2 << 17) 55#define VIDCON0_PNRMODE_SERIAL_RGB (0x2 << 17)
@@ -61,14 +57,14 @@
61 57
62#define VIDCON0_CLKVALUP (1 << 16) 58#define VIDCON0_CLKVALUP (1 << 16)
63#define VIDCON0_CLKVAL_F_MASK (0xff << 6) 59#define VIDCON0_CLKVAL_F_MASK (0xff << 6)
64#define VIDCON0_CLKVAL_F_SHIFT (6) 60#define VIDCON0_CLKVAL_F_SHIFT 6
65#define VIDCON0_CLKVAL_F_LIMIT (0xff) 61#define VIDCON0_CLKVAL_F_LIMIT 0xff
66#define VIDCON0_CLKVAL_F(_x) ((_x) << 6) 62#define VIDCON0_CLKVAL_F(_x) ((_x) << 6)
67#define VIDCON0_VLCKFREE (1 << 5) 63#define VIDCON0_VLCKFREE (1 << 5)
68#define VIDCON0_CLKDIR (1 << 4) 64#define VIDCON0_CLKDIR (1 << 4)
69 65
70#define VIDCON0_CLKSEL_MASK (0x3 << 2) 66#define VIDCON0_CLKSEL_MASK (0x3 << 2)
71#define VIDCON0_CLKSEL_SHIFT (2) 67#define VIDCON0_CLKSEL_SHIFT 2
72#define VIDCON0_CLKSEL_HCLK (0x0 << 2) 68#define VIDCON0_CLKSEL_HCLK (0x0 << 2)
73#define VIDCON0_CLKSEL_LCD (0x1 << 2) 69#define VIDCON0_CLKSEL_LCD (0x1 << 2)
74#define VIDCON0_CLKSEL_27M (0x3 << 2) 70#define VIDCON0_CLKSEL_27M (0x3 << 2)
@@ -76,17 +72,17 @@
76#define VIDCON0_ENVID (1 << 1) 72#define VIDCON0_ENVID (1 << 1)
77#define VIDCON0_ENVID_F (1 << 0) 73#define VIDCON0_ENVID_F (1 << 0)
78 74
79#define VIDCON1 (0x04) 75#define VIDCON1 0x04
80#define VIDCON1_LINECNT_MASK (0x7ff << 16) 76#define VIDCON1_LINECNT_MASK (0x7ff << 16)
81#define VIDCON1_LINECNT_SHIFT (16) 77#define VIDCON1_LINECNT_SHIFT 16
82#define VIDCON1_LINECNT_GET(_v) (((_v) >> 16) & 0x7ff) 78#define VIDCON1_LINECNT_GET(_v) (((_v) >> 16) & 0x7ff)
83#define VIDCON1_FSTATUS_EVEN (1 << 15) 79#define VIDCON1_FSTATUS_EVEN (1 << 15)
84#define VIDCON1_VSTATUS_MASK (0x3 << 13) 80#define VIDCON1_VSTATUS_MASK (0x3 << 13)
85#define VIDCON1_VSTATUS_SHIFT (13) 81#define VIDCON1_VSTATUS_SHIFT 13
86#define VIDCON1_VSTATUS_VSYNC (0x0 << 13) 82#define VIDCON1_VSTATUS_VSYNC (0x0 << 13)
87#define VIDCON1_VSTATUS_BACKPORCH (0x1 << 13) 83#define VIDCON1_VSTATUS_BACKPORCH (0x1 << 13)
88#define VIDCON1_VSTATUS_ACTIVE (0x2 << 13) 84#define VIDCON1_VSTATUS_ACTIVE (0x2 << 13)
89#define VIDCON1_VSTATUS_FRONTPORCH (0x0 << 13) 85#define VIDCON1_VSTATUS_FRONTPORCH (0x3 << 13)
90#define VIDCON1_VCLK_MASK (0x3 << 9) 86#define VIDCON1_VCLK_MASK (0x3 << 9)
91#define VIDCON1_VCLK_HOLD (0x0 << 9) 87#define VIDCON1_VCLK_HOLD (0x0 << 9)
92#define VIDCON1_VCLK_RUN (0x1 << 9) 88#define VIDCON1_VCLK_RUN (0x1 << 9)
@@ -98,12 +94,12 @@
98 94
99/* VIDCON2 */ 95/* VIDCON2 */
100 96
101#define VIDCON2 (0x08) 97#define VIDCON2 0x08
102#define VIDCON2_EN601 (1 << 23) 98#define VIDCON2_EN601 (1 << 23)
103#define VIDCON2_TVFMTSEL_SW (1 << 14) 99#define VIDCON2_TVFMTSEL_SW (1 << 14)
104 100
105#define VIDCON2_TVFMTSEL1_MASK (0x3 << 12) 101#define VIDCON2_TVFMTSEL1_MASK (0x3 << 12)
106#define VIDCON2_TVFMTSEL1_SHIFT (12) 102#define VIDCON2_TVFMTSEL1_SHIFT 12
107#define VIDCON2_TVFMTSEL1_RGB (0x0 << 12) 103#define VIDCON2_TVFMTSEL1_RGB (0x0 << 12)
108#define VIDCON2_TVFMTSEL1_YUV422 (0x1 << 12) 104#define VIDCON2_TVFMTSEL1_YUV422 (0x1 << 12)
109#define VIDCON2_TVFMTSEL1_YUV444 (0x2 << 12) 105#define VIDCON2_TVFMTSEL1_YUV444 (0x2 << 12)
@@ -115,74 +111,75 @@
115 * Might not be present in the S3C6410 documentation, 111 * Might not be present in the S3C6410 documentation,
116 * but tests prove it's there almost for sure; shouldn't hurt in any case. 112 * but tests prove it's there almost for sure; shouldn't hurt in any case.
117 */ 113 */
118#define PRTCON (0x0c) 114#define PRTCON 0x0c
119#define PRTCON_PROTECT (1 << 11) 115#define PRTCON_PROTECT (1 << 11)
120 116
121/* VIDTCON0 */ 117/* VIDTCON0 */
122 118
123#define VIDTCON0 (0x10) 119#define VIDTCON0 0x10
124#define VIDTCON0_VBPDE_MASK (0xff << 24) 120#define VIDTCON0_VBPDE_MASK (0xff << 24)
125#define VIDTCON0_VBPDE_SHIFT (24) 121#define VIDTCON0_VBPDE_SHIFT 24
126#define VIDTCON0_VBPDE_LIMIT (0xff) 122#define VIDTCON0_VBPDE_LIMIT 0xff
127#define VIDTCON0_VBPDE(_x) ((_x) << 24) 123#define VIDTCON0_VBPDE(_x) ((_x) << 24)
128 124
129#define VIDTCON0_VBPD_MASK (0xff << 16) 125#define VIDTCON0_VBPD_MASK (0xff << 16)
130#define VIDTCON0_VBPD_SHIFT (16) 126#define VIDTCON0_VBPD_SHIFT 16
131#define VIDTCON0_VBPD_LIMIT (0xff) 127#define VIDTCON0_VBPD_LIMIT 0xff
132#define VIDTCON0_VBPD(_x) ((_x) << 16) 128#define VIDTCON0_VBPD(_x) ((_x) << 16)
133 129
134#define VIDTCON0_VFPD_MASK (0xff << 8) 130#define VIDTCON0_VFPD_MASK (0xff << 8)
135#define VIDTCON0_VFPD_SHIFT (8) 131#define VIDTCON0_VFPD_SHIFT 8
136#define VIDTCON0_VFPD_LIMIT (0xff) 132#define VIDTCON0_VFPD_LIMIT 0xff
137#define VIDTCON0_VFPD(_x) ((_x) << 8) 133#define VIDTCON0_VFPD(_x) ((_x) << 8)
138 134
139#define VIDTCON0_VSPW_MASK (0xff << 0) 135#define VIDTCON0_VSPW_MASK (0xff << 0)
140#define VIDTCON0_VSPW_SHIFT (0) 136#define VIDTCON0_VSPW_SHIFT 0
141#define VIDTCON0_VSPW_LIMIT (0xff) 137#define VIDTCON0_VSPW_LIMIT 0xff
142#define VIDTCON0_VSPW(_x) ((_x) << 0) 138#define VIDTCON0_VSPW(_x) ((_x) << 0)
143 139
144/* VIDTCON1 */ 140/* VIDTCON1 */
145 141
146#define VIDTCON1 (0x14) 142#define VIDTCON1 0x14
147#define VIDTCON1_VFPDE_MASK (0xff << 24) 143#define VIDTCON1_VFPDE_MASK (0xff << 24)
148#define VIDTCON1_VFPDE_SHIFT (24) 144#define VIDTCON1_VFPDE_SHIFT 24
149#define VIDTCON1_VFPDE_LIMIT (0xff) 145#define VIDTCON1_VFPDE_LIMIT 0xff
150#define VIDTCON1_VFPDE(_x) ((_x) << 24) 146#define VIDTCON1_VFPDE(_x) ((_x) << 24)
151 147
152#define VIDTCON1_HBPD_MASK (0xff << 16) 148#define VIDTCON1_HBPD_MASK (0xff << 16)
153#define VIDTCON1_HBPD_SHIFT (16) 149#define VIDTCON1_HBPD_SHIFT 16
154#define VIDTCON1_HBPD_LIMIT (0xff) 150#define VIDTCON1_HBPD_LIMIT 0xff
155#define VIDTCON1_HBPD(_x) ((_x) << 16) 151#define VIDTCON1_HBPD(_x) ((_x) << 16)
156 152
157#define VIDTCON1_HFPD_MASK (0xff << 8) 153#define VIDTCON1_HFPD_MASK (0xff << 8)
158#define VIDTCON1_HFPD_SHIFT (8) 154#define VIDTCON1_HFPD_SHIFT 8
159#define VIDTCON1_HFPD_LIMIT (0xff) 155#define VIDTCON1_HFPD_LIMIT 0xff
160#define VIDTCON1_HFPD(_x) ((_x) << 8) 156#define VIDTCON1_HFPD(_x) ((_x) << 8)
161 157
162#define VIDTCON1_HSPW_MASK (0xff << 0) 158#define VIDTCON1_HSPW_MASK (0xff << 0)
163#define VIDTCON1_HSPW_SHIFT (0) 159#define VIDTCON1_HSPW_SHIFT 0
164#define VIDTCON1_HSPW_LIMIT (0xff) 160#define VIDTCON1_HSPW_LIMIT 0xff
165#define VIDTCON1_HSPW(_x) ((_x) << 0) 161#define VIDTCON1_HSPW(_x) ((_x) << 0)
166 162
167#define VIDTCON2 (0x18) 163#define VIDTCON2 0x18
168#define VIDTCON2 (0x18)
169#define VIDTCON2_LINEVAL_E(_x) ((((_x) & 0x800) >> 11) << 23) 164#define VIDTCON2_LINEVAL_E(_x) ((((_x) & 0x800) >> 11) << 23)
170#define VIDTCON2_LINEVAL_MASK (0x7ff << 11) 165#define VIDTCON2_LINEVAL_MASK (0x7ff << 11)
171#define VIDTCON2_LINEVAL_SHIFT (11) 166#define VIDTCON2_LINEVAL_SHIFT 11
172#define VIDTCON2_LINEVAL_LIMIT (0x7ff) 167#define VIDTCON2_LINEVAL_LIMIT 0x7ff
173#define VIDTCON2_LINEVAL(_x) (((_x) & 0x7ff) << 11) 168#define VIDTCON2_LINEVAL(_x) (((_x) & 0x7ff) << 11)
174 169
175#define VIDTCON2_HOZVAL_E(_x) ((((_x) & 0x800) >> 11) << 22) 170#define VIDTCON2_HOZVAL_E(_x) ((((_x) & 0x800) >> 11) << 22)
176#define VIDTCON2_HOZVAL_MASK (0x7ff << 0) 171#define VIDTCON2_HOZVAL_MASK (0x7ff << 0)
177#define VIDTCON2_HOZVAL_SHIFT (0) 172#define VIDTCON2_HOZVAL_SHIFT 0
178#define VIDTCON2_HOZVAL_LIMIT (0x7ff) 173#define VIDTCON2_HOZVAL_LIMIT 0x7ff
179#define VIDTCON2_HOZVAL(_x) (((_x) & 0x7ff) << 0) 174#define VIDTCON2_HOZVAL(_x) (((_x) & 0x7ff) << 0)
180 175
181/* WINCONx */ 176/* WINCONx */
182 177
183#define WINCON(_win) (0x20 + ((_win) * 4)) 178#define WINCON(_win) (0x20 + ((_win) * 4))
179#define WINCONx_CSCCON_EQ601 (0x0 << 28)
180#define WINCONx_CSCCON_EQ709 (0x1 << 28)
184#define WINCONx_CSCWIDTH_MASK (0x3 << 26) 181#define WINCONx_CSCWIDTH_MASK (0x3 << 26)
185#define WINCONx_CSCWIDTH_SHIFT (26) 182#define WINCONx_CSCWIDTH_SHIFT 26
186#define WINCONx_CSCWIDTH_WIDE (0x0 << 26) 183#define WINCONx_CSCWIDTH_WIDE (0x0 << 26)
187#define WINCONx_CSCWIDTH_NARROW (0x3 << 26) 184#define WINCONx_CSCWIDTH_NARROW (0x3 << 26)
188#define WINCONx_ENLOCAL (1 << 22) 185#define WINCONx_ENLOCAL (1 << 22)
@@ -195,14 +192,14 @@
195#define WINCONx_WSWP (1 << 15) 192#define WINCONx_WSWP (1 << 15)
196#define WINCONx_YCbCr (1 << 13) 193#define WINCONx_YCbCr (1 << 13)
197#define WINCONx_BURSTLEN_MASK (0x3 << 9) 194#define WINCONx_BURSTLEN_MASK (0x3 << 9)
198#define WINCONx_BURSTLEN_SHIFT (9) 195#define WINCONx_BURSTLEN_SHIFT 9
199#define WINCONx_BURSTLEN_16WORD (0x0 << 9) 196#define WINCONx_BURSTLEN_16WORD (0x0 << 9)
200#define WINCONx_BURSTLEN_8WORD (0x1 << 9) 197#define WINCONx_BURSTLEN_8WORD (0x1 << 9)
201#define WINCONx_BURSTLEN_4WORD (0x2 << 9) 198#define WINCONx_BURSTLEN_4WORD (0x2 << 9)
202#define WINCONx_ENWIN (1 << 0) 199#define WINCONx_ENWIN (1 << 0)
203 200
204#define WINCON0_BPPMODE_MASK (0xf << 2) 201#define WINCON0_BPPMODE_MASK (0xf << 2)
205#define WINCON0_BPPMODE_SHIFT (2) 202#define WINCON0_BPPMODE_SHIFT 2
206#define WINCON0_BPPMODE_1BPP (0x0 << 2) 203#define WINCON0_BPPMODE_1BPP (0x0 << 2)
207#define WINCON0_BPPMODE_2BPP (0x1 << 2) 204#define WINCON0_BPPMODE_2BPP (0x1 << 2)
208#define WINCON0_BPPMODE_4BPP (0x2 << 2) 205#define WINCON0_BPPMODE_4BPP (0x2 << 2)
@@ -215,7 +212,7 @@
215#define WINCON1_LOCALSEL_CAMIF (1 << 23) 212#define WINCON1_LOCALSEL_CAMIF (1 << 23)
216#define WINCON1_BLD_PIX (1 << 6) 213#define WINCON1_BLD_PIX (1 << 6)
217#define WINCON1_BPPMODE_MASK (0xf << 2) 214#define WINCON1_BPPMODE_MASK (0xf << 2)
218#define WINCON1_BPPMODE_SHIFT (2) 215#define WINCON1_BPPMODE_SHIFT 2
219#define WINCON1_BPPMODE_1BPP (0x0 << 2) 216#define WINCON1_BPPMODE_1BPP (0x0 << 2)
220#define WINCON1_BPPMODE_2BPP (0x1 << 2) 217#define WINCON1_BPPMODE_2BPP (0x1 << 2)
221#define WINCON1_BPPMODE_4BPP (0x2 << 2) 218#define WINCON1_BPPMODE_4BPP (0x2 << 2)
@@ -234,7 +231,7 @@
234#define WINCON1_ALPHA_SEL (1 << 1) 231#define WINCON1_ALPHA_SEL (1 << 1)
235 232
236/* S5PV210 */ 233/* S5PV210 */
237#define SHADOWCON (0x34) 234#define SHADOWCON 0x34
238#define SHADOWCON_WINx_PROTECT(_win) (1 << (10 + (_win))) 235#define SHADOWCON_WINx_PROTECT(_win) (1 << (10 + (_win)))
239/* DMA channels (all windows) */ 236/* DMA channels (all windows) */
240#define SHADOWCON_CHx_ENABLE(_win) (1 << (_win)) 237#define SHADOWCON_CHx_ENABLE(_win) (1 << (_win))
@@ -243,52 +240,52 @@
243 240
244/* VIDOSDx */ 241/* VIDOSDx */
245 242
246#define VIDOSD_BASE (0x40) 243#define VIDOSD_BASE 0x40
247#define VIDOSDxA_TOPLEFT_X_E(_x) ((((_x) & 0x800) >> 11) << 23) 244#define VIDOSDxA_TOPLEFT_X_E(_x) ((((_x) & 0x800) >> 11) << 23)
248#define VIDOSDxA_TOPLEFT_X_MASK (0x7ff << 11) 245#define VIDOSDxA_TOPLEFT_X_MASK (0x7ff << 11)
249#define VIDOSDxA_TOPLEFT_X_SHIFT (11) 246#define VIDOSDxA_TOPLEFT_X_SHIFT 11
250#define VIDOSDxA_TOPLEFT_X_LIMIT (0x7ff) 247#define VIDOSDxA_TOPLEFT_X_LIMIT 0x7ff
251#define VIDOSDxA_TOPLEFT_X(_x) (((_x) & 0x7ff) << 11) 248#define VIDOSDxA_TOPLEFT_X(_x) (((_x) & 0x7ff) << 11)
252 249
253#define VIDOSDxA_TOPLEFT_Y_E(_x) ((((_x) & 0x800) >> 11) << 22) 250#define VIDOSDxA_TOPLEFT_Y_E(_x) ((((_x) & 0x800) >> 11) << 22)
254#define VIDOSDxA_TOPLEFT_Y_MASK (0x7ff << 0) 251#define VIDOSDxA_TOPLEFT_Y_MASK (0x7ff << 0)
255#define VIDOSDxA_TOPLEFT_Y_SHIFT (0) 252#define VIDOSDxA_TOPLEFT_Y_SHIFT 0
256#define VIDOSDxA_TOPLEFT_Y_LIMIT (0x7ff) 253#define VIDOSDxA_TOPLEFT_Y_LIMIT 0x7ff
257#define VIDOSDxA_TOPLEFT_Y(_x) (((_x) & 0x7ff) << 0) 254#define VIDOSDxA_TOPLEFT_Y(_x) (((_x) & 0x7ff) << 0)
258 255
259#define VIDOSDxB_BOTRIGHT_X_E(_x) ((((_x) & 0x800) >> 11) << 23) 256#define VIDOSDxB_BOTRIGHT_X_E(_x) ((((_x) & 0x800) >> 11) << 23)
260#define VIDOSDxB_BOTRIGHT_X_MASK (0x7ff << 11) 257#define VIDOSDxB_BOTRIGHT_X_MASK (0x7ff << 11)
261#define VIDOSDxB_BOTRIGHT_X_SHIFT (11) 258#define VIDOSDxB_BOTRIGHT_X_SHIFT 11
262#define VIDOSDxB_BOTRIGHT_X_LIMIT (0x7ff) 259#define VIDOSDxB_BOTRIGHT_X_LIMIT 0x7ff
263#define VIDOSDxB_BOTRIGHT_X(_x) (((_x) & 0x7ff) << 11) 260#define VIDOSDxB_BOTRIGHT_X(_x) (((_x) & 0x7ff) << 11)
264 261
265#define VIDOSDxB_BOTRIGHT_Y_E(_x) ((((_x) & 0x800) >> 11) << 22) 262#define VIDOSDxB_BOTRIGHT_Y_E(_x) ((((_x) & 0x800) >> 11) << 22)
266#define VIDOSDxB_BOTRIGHT_Y_MASK (0x7ff << 0) 263#define VIDOSDxB_BOTRIGHT_Y_MASK (0x7ff << 0)
267#define VIDOSDxB_BOTRIGHT_Y_SHIFT (0) 264#define VIDOSDxB_BOTRIGHT_Y_SHIFT 0
268#define VIDOSDxB_BOTRIGHT_Y_LIMIT (0x7ff) 265#define VIDOSDxB_BOTRIGHT_Y_LIMIT 0x7ff
269#define VIDOSDxB_BOTRIGHT_Y(_x) (((_x) & 0x7ff) << 0) 266#define VIDOSDxB_BOTRIGHT_Y(_x) (((_x) & 0x7ff) << 0)
270 267
271/* For VIDOSD[1..4]C */ 268/* For VIDOSD[1..4]C */
272#define VIDISD14C_ALPHA0_R(_x) ((_x) << 20) 269#define VIDISD14C_ALPHA0_R(_x) ((_x) << 20)
273#define VIDISD14C_ALPHA0_G_MASK (0xf << 16) 270#define VIDISD14C_ALPHA0_G_MASK (0xf << 16)
274#define VIDISD14C_ALPHA0_G_SHIFT (16) 271#define VIDISD14C_ALPHA0_G_SHIFT 16
275#define VIDISD14C_ALPHA0_G_LIMIT (0xf) 272#define VIDISD14C_ALPHA0_G_LIMIT 0xf
276#define VIDISD14C_ALPHA0_G(_x) ((_x) << 16) 273#define VIDISD14C_ALPHA0_G(_x) ((_x) << 16)
277#define VIDISD14C_ALPHA0_B_MASK (0xf << 12) 274#define VIDISD14C_ALPHA0_B_MASK (0xf << 12)
278#define VIDISD14C_ALPHA0_B_SHIFT (12) 275#define VIDISD14C_ALPHA0_B_SHIFT 12
279#define VIDISD14C_ALPHA0_B_LIMIT (0xf) 276#define VIDISD14C_ALPHA0_B_LIMIT 0xf
280#define VIDISD14C_ALPHA0_B(_x) ((_x) << 12) 277#define VIDISD14C_ALPHA0_B(_x) ((_x) << 12)
281#define VIDISD14C_ALPHA1_R_MASK (0xf << 8) 278#define VIDISD14C_ALPHA1_R_MASK (0xf << 8)
282#define VIDISD14C_ALPHA1_R_SHIFT (8) 279#define VIDISD14C_ALPHA1_R_SHIFT 8
283#define VIDISD14C_ALPHA1_R_LIMIT (0xf) 280#define VIDISD14C_ALPHA1_R_LIMIT 0xf
284#define VIDISD14C_ALPHA1_R(_x) ((_x) << 8) 281#define VIDISD14C_ALPHA1_R(_x) ((_x) << 8)
285#define VIDISD14C_ALPHA1_G_MASK (0xf << 4) 282#define VIDISD14C_ALPHA1_G_MASK (0xf << 4)
286#define VIDISD14C_ALPHA1_G_SHIFT (4) 283#define VIDISD14C_ALPHA1_G_SHIFT 4
287#define VIDISD14C_ALPHA1_G_LIMIT (0xf) 284#define VIDISD14C_ALPHA1_G_LIMIT 0xf
288#define VIDISD14C_ALPHA1_G(_x) ((_x) << 4) 285#define VIDISD14C_ALPHA1_G(_x) ((_x) << 4)
289#define VIDISD14C_ALPHA1_B_MASK (0xf << 0) 286#define VIDISD14C_ALPHA1_B_MASK (0xf << 0)
290#define VIDISD14C_ALPHA1_B_SHIFT (0) 287#define VIDISD14C_ALPHA1_B_SHIFT 0
291#define VIDISD14C_ALPHA1_B_LIMIT (0xf) 288#define VIDISD14C_ALPHA1_B_LIMIT 0xf
292#define VIDISD14C_ALPHA1_B(_x) ((_x) << 0) 289#define VIDISD14C_ALPHA1_B(_x) ((_x) << 0)
293 290
294/* Video buffer addresses */ 291/* Video buffer addresses */
@@ -300,22 +297,22 @@
300 297
301#define VIDW_BUF_SIZE_OFFSET_E(_x) ((((_x) & 0x2000) >> 13) << 27) 298#define VIDW_BUF_SIZE_OFFSET_E(_x) ((((_x) & 0x2000) >> 13) << 27)
302#define VIDW_BUF_SIZE_OFFSET_MASK (0x1fff << 13) 299#define VIDW_BUF_SIZE_OFFSET_MASK (0x1fff << 13)
303#define VIDW_BUF_SIZE_OFFSET_SHIFT (13) 300#define VIDW_BUF_SIZE_OFFSET_SHIFT 13
304#define VIDW_BUF_SIZE_OFFSET_LIMIT (0x1fff) 301#define VIDW_BUF_SIZE_OFFSET_LIMIT 0x1fff
305#define VIDW_BUF_SIZE_OFFSET(_x) (((_x) & 0x1fff) << 13) 302#define VIDW_BUF_SIZE_OFFSET(_x) (((_x) & 0x1fff) << 13)
306 303
307#define VIDW_BUF_SIZE_PAGEWIDTH_E(_x) ((((_x) & 0x2000) >> 13) << 26) 304#define VIDW_BUF_SIZE_PAGEWIDTH_E(_x) ((((_x) & 0x2000) >> 13) << 26)
308#define VIDW_BUF_SIZE_PAGEWIDTH_MASK (0x1fff << 0) 305#define VIDW_BUF_SIZE_PAGEWIDTH_MASK (0x1fff << 0)
309#define VIDW_BUF_SIZE_PAGEWIDTH_SHIFT (0) 306#define VIDW_BUF_SIZE_PAGEWIDTH_SHIFT 0
310#define VIDW_BUF_SIZE_PAGEWIDTH_LIMIT (0x1fff) 307#define VIDW_BUF_SIZE_PAGEWIDTH_LIMIT 0x1fff
311#define VIDW_BUF_SIZE_PAGEWIDTH(_x) (((_x) & 0x1fff) << 0) 308#define VIDW_BUF_SIZE_PAGEWIDTH(_x) (((_x) & 0x1fff) << 0)
312 309
313/* Interrupt controls and status */ 310/* Interrupt controls and status */
314 311
315#define VIDINTCON0 (0x130) 312#define VIDINTCON0 0x130
316#define VIDINTCON0_FIFOINTERVAL_MASK (0x3f << 20) 313#define VIDINTCON0_FIFOINTERVAL_MASK (0x3f << 20)
317#define VIDINTCON0_FIFOINTERVAL_SHIFT (20) 314#define VIDINTCON0_FIFOINTERVAL_SHIFT 20
318#define VIDINTCON0_FIFOINTERVAL_LIMIT (0x3f) 315#define VIDINTCON0_FIFOINTERVAL_LIMIT 0x3f
319#define VIDINTCON0_FIFOINTERVAL(_x) ((_x) << 20) 316#define VIDINTCON0_FIFOINTERVAL(_x) ((_x) << 20)
320 317
321#define VIDINTCON0_INT_SYSMAINCON (1 << 19) 318#define VIDINTCON0_INT_SYSMAINCON (1 << 19)
@@ -323,7 +320,7 @@
323#define VIDINTCON0_INT_I80IFDONE (1 << 17) 320#define VIDINTCON0_INT_I80IFDONE (1 << 17)
324 321
325#define VIDINTCON0_FRAMESEL0_MASK (0x3 << 15) 322#define VIDINTCON0_FRAMESEL0_MASK (0x3 << 15)
326#define VIDINTCON0_FRAMESEL0_SHIFT (15) 323#define VIDINTCON0_FRAMESEL0_SHIFT 15
327#define VIDINTCON0_FRAMESEL0_BACKPORCH (0x0 << 15) 324#define VIDINTCON0_FRAMESEL0_BACKPORCH (0x0 << 15)
328#define VIDINTCON0_FRAMESEL0_VSYNC (0x1 << 15) 325#define VIDINTCON0_FRAMESEL0_VSYNC (0x1 << 15)
329#define VIDINTCON0_FRAMESEL0_ACTIVE (0x2 << 15) 326#define VIDINTCON0_FRAMESEL0_ACTIVE (0x2 << 15)
@@ -338,7 +335,7 @@
338 335
339#define VIDINTCON0_INT_FRAME (1 << 12) 336#define VIDINTCON0_INT_FRAME (1 << 12)
340#define VIDINTCON0_FIFIOSEL_MASK (0x7f << 5) 337#define VIDINTCON0_FIFIOSEL_MASK (0x7f << 5)
341#define VIDINTCON0_FIFIOSEL_SHIFT (5) 338#define VIDINTCON0_FIFIOSEL_SHIFT 5
342#define VIDINTCON0_FIFIOSEL_WINDOW0 (0x1 << 5) 339#define VIDINTCON0_FIFIOSEL_WINDOW0 (0x1 << 5)
343#define VIDINTCON0_FIFIOSEL_WINDOW1 (0x2 << 5) 340#define VIDINTCON0_FIFIOSEL_WINDOW1 (0x2 << 5)
344#define VIDINTCON0_FIFIOSEL_WINDOW2 (0x10 << 5) 341#define VIDINTCON0_FIFIOSEL_WINDOW2 (0x10 << 5)
@@ -346,7 +343,7 @@
346#define VIDINTCON0_FIFIOSEL_WINDOW4 (0x40 << 5) 343#define VIDINTCON0_FIFIOSEL_WINDOW4 (0x40 << 5)
347 344
348#define VIDINTCON0_FIFOLEVEL_MASK (0x7 << 2) 345#define VIDINTCON0_FIFOLEVEL_MASK (0x7 << 2)
349#define VIDINTCON0_FIFOLEVEL_SHIFT (2) 346#define VIDINTCON0_FIFOLEVEL_SHIFT 2
350#define VIDINTCON0_FIFOLEVEL_TO25PC (0x0 << 2) 347#define VIDINTCON0_FIFOLEVEL_TO25PC (0x0 << 2)
351#define VIDINTCON0_FIFOLEVEL_TO50PC (0x1 << 2) 348#define VIDINTCON0_FIFOLEVEL_TO50PC (0x1 << 2)
352#define VIDINTCON0_FIFOLEVEL_TO75PC (0x2 << 2) 349#define VIDINTCON0_FIFOLEVEL_TO75PC (0x2 << 2)
@@ -354,46 +351,46 @@
354#define VIDINTCON0_FIFOLEVEL_FULL (0x4 << 2) 351#define VIDINTCON0_FIFOLEVEL_FULL (0x4 << 2)
355 352
356#define VIDINTCON0_INT_FIFO_MASK (0x3 << 0) 353#define VIDINTCON0_INT_FIFO_MASK (0x3 << 0)
357#define VIDINTCON0_INT_FIFO_SHIFT (0) 354#define VIDINTCON0_INT_FIFO_SHIFT 0
358#define VIDINTCON0_INT_ENABLE (1 << 0) 355#define VIDINTCON0_INT_ENABLE (1 << 0)
359 356
360#define VIDINTCON1 (0x134) 357#define VIDINTCON1 0x134
361#define VIDINTCON1_INT_I180 (1 << 2) 358#define VIDINTCON1_INT_I180 (1 << 2)
362#define VIDINTCON1_INT_FRAME (1 << 1) 359#define VIDINTCON1_INT_FRAME (1 << 1)
363#define VIDINTCON1_INT_FIFO (1 << 0) 360#define VIDINTCON1_INT_FIFO (1 << 0)
364 361
365/* Window colour-key control registers */ 362/* Window colour-key control registers */
366#define WKEYCON (0x140) /* 6410,V210 */ 363#define WKEYCON 0x140
367 364
368#define WKEYCON0 (0x00) 365#define WKEYCON0 0x00
369#define WKEYCON1 (0x04) 366#define WKEYCON1 0x04
370 367
371#define WxKEYCON0_KEYBL_EN (1 << 26) 368#define WxKEYCON0_KEYBL_EN (1 << 26)
372#define WxKEYCON0_KEYEN_F (1 << 25) 369#define WxKEYCON0_KEYEN_F (1 << 25)
373#define WxKEYCON0_DIRCON (1 << 24) 370#define WxKEYCON0_DIRCON (1 << 24)
374#define WxKEYCON0_COMPKEY_MASK (0xffffff << 0) 371#define WxKEYCON0_COMPKEY_MASK (0xffffff << 0)
375#define WxKEYCON0_COMPKEY_SHIFT (0) 372#define WxKEYCON0_COMPKEY_SHIFT 0
376#define WxKEYCON0_COMPKEY_LIMIT (0xffffff) 373#define WxKEYCON0_COMPKEY_LIMIT 0xffffff
377#define WxKEYCON0_COMPKEY(_x) ((_x) << 0) 374#define WxKEYCON0_COMPKEY(_x) ((_x) << 0)
378#define WxKEYCON1_COLVAL_MASK (0xffffff << 0) 375#define WxKEYCON1_COLVAL_MASK (0xffffff << 0)
379#define WxKEYCON1_COLVAL_SHIFT (0) 376#define WxKEYCON1_COLVAL_SHIFT 0
380#define WxKEYCON1_COLVAL_LIMIT (0xffffff) 377#define WxKEYCON1_COLVAL_LIMIT 0xffffff
381#define WxKEYCON1_COLVAL(_x) ((_x) << 0) 378#define WxKEYCON1_COLVAL(_x) ((_x) << 0)
382 379
383/* Dithering control */ 380/* Dithering control */
384#define DITHMODE (0x170) 381#define DITHMODE 0x170
385#define DITHMODE_R_POS_MASK (0x3 << 5) 382#define DITHMODE_R_POS_MASK (0x3 << 5)
386#define DITHMODE_R_POS_SHIFT (5) 383#define DITHMODE_R_POS_SHIFT 5
387#define DITHMODE_R_POS_8BIT (0x0 << 5) 384#define DITHMODE_R_POS_8BIT (0x0 << 5)
388#define DITHMODE_R_POS_6BIT (0x1 << 5) 385#define DITHMODE_R_POS_6BIT (0x1 << 5)
389#define DITHMODE_R_POS_5BIT (0x2 << 5) 386#define DITHMODE_R_POS_5BIT (0x2 << 5)
390#define DITHMODE_G_POS_MASK (0x3 << 3) 387#define DITHMODE_G_POS_MASK (0x3 << 3)
391#define DITHMODE_G_POS_SHIFT (3) 388#define DITHMODE_G_POS_SHIFT 3
392#define DITHMODE_G_POS_8BIT (0x0 << 3) 389#define DITHMODE_G_POS_8BIT (0x0 << 3)
393#define DITHMODE_G_POS_6BIT (0x1 << 3) 390#define DITHMODE_G_POS_6BIT (0x1 << 3)
394#define DITHMODE_G_POS_5BIT (0x2 << 3) 391#define DITHMODE_G_POS_5BIT (0x2 << 3)
395#define DITHMODE_B_POS_MASK (0x3 << 1) 392#define DITHMODE_B_POS_MASK (0x3 << 1)
396#define DITHMODE_B_POS_SHIFT (1) 393#define DITHMODE_B_POS_SHIFT 1
397#define DITHMODE_B_POS_8BIT (0x0 << 1) 394#define DITHMODE_B_POS_8BIT (0x0 << 1)
398#define DITHMODE_B_POS_6BIT (0x1 << 1) 395#define DITHMODE_B_POS_6BIT (0x1 << 1)
399#define DITHMODE_B_POS_5BIT (0x2 << 1) 396#define DITHMODE_B_POS_5BIT (0x2 << 1)
@@ -403,18 +400,18 @@
403#define WINxMAP(_win) (0x180 + ((_win) * 4)) 400#define WINxMAP(_win) (0x180 + ((_win) * 4))
404#define WINxMAP_MAP (1 << 24) 401#define WINxMAP_MAP (1 << 24)
405#define WINxMAP_MAP_COLOUR_MASK (0xffffff << 0) 402#define WINxMAP_MAP_COLOUR_MASK (0xffffff << 0)
406#define WINxMAP_MAP_COLOUR_SHIFT (0) 403#define WINxMAP_MAP_COLOUR_SHIFT 0
407#define WINxMAP_MAP_COLOUR_LIMIT (0xffffff) 404#define WINxMAP_MAP_COLOUR_LIMIT 0xffffff
408#define WINxMAP_MAP_COLOUR(_x) ((_x) << 0) 405#define WINxMAP_MAP_COLOUR(_x) ((_x) << 0)
409 406
410/* Winodw palette control */ 407/* Winodw palette control */
411#define WPALCON (0x1A0) 408#define WPALCON 0x1A0
412#define WPALCON_PAL_UPDATE (1 << 9) 409#define WPALCON_PAL_UPDATE (1 << 9)
413#define WPALCON_W4PAL_16BPP_A555 (1 << 8) 410#define WPALCON_W4PAL_16BPP_A555 (1 << 8)
414#define WPALCON_W3PAL_16BPP_A555 (1 << 7) 411#define WPALCON_W3PAL_16BPP_A555 (1 << 7)
415#define WPALCON_W2PAL_16BPP_A555 (1 << 6) 412#define WPALCON_W2PAL_16BPP_A555 (1 << 6)
416#define WPALCON_W1PAL_MASK (0x7 << 3) 413#define WPALCON_W1PAL_MASK (0x7 << 3)
417#define WPALCON_W1PAL_SHIFT (3) 414#define WPALCON_W1PAL_SHIFT 3
418#define WPALCON_W1PAL_25BPP_A888 (0x0 << 3) 415#define WPALCON_W1PAL_25BPP_A888 (0x0 << 3)
419#define WPALCON_W1PAL_24BPP (0x1 << 3) 416#define WPALCON_W1PAL_24BPP (0x1 << 3)
420#define WPALCON_W1PAL_19BPP_A666 (0x2 << 3) 417#define WPALCON_W1PAL_19BPP_A666 (0x2 << 3)
@@ -423,7 +420,7 @@
423#define WPALCON_W1PAL_16BPP_A555 (0x5 << 3) 420#define WPALCON_W1PAL_16BPP_A555 (0x5 << 3)
424#define WPALCON_W1PAL_16BPP_565 (0x6 << 3) 421#define WPALCON_W1PAL_16BPP_565 (0x6 << 3)
425#define WPALCON_W0PAL_MASK (0x7 << 0) 422#define WPALCON_W0PAL_MASK (0x7 << 0)
426#define WPALCON_W0PAL_SHIFT (0) 423#define WPALCON_W0PAL_SHIFT 0
427#define WPALCON_W0PAL_25BPP_A888 (0x0 << 0) 424#define WPALCON_W0PAL_25BPP_A888 (0x0 << 0)
428#define WPALCON_W0PAL_24BPP (0x1 << 0) 425#define WPALCON_W0PAL_24BPP (0x1 << 0)
429#define WPALCON_W0PAL_19BPP_A666 (0x2 << 0) 426#define WPALCON_W0PAL_19BPP_A666 (0x2 << 0)
@@ -433,13 +430,11 @@
433#define WPALCON_W0PAL_16BPP_565 (0x6 << 0) 430#define WPALCON_W0PAL_16BPP_565 (0x6 << 0)
434 431
435/* Blending equation control */ 432/* Blending equation control */
436#define BLENDCON (0x260) 433#define BLENDCON 0x260
437#define BLENDCON_NEW_MASK (1 << 0) 434#define BLENDCON_NEW_MASK (1 << 0)
438#define BLENDCON_NEW_8BIT_ALPHA_VALUE (1 << 0) 435#define BLENDCON_NEW_8BIT_ALPHA_VALUE (1 << 0)
439#define BLENDCON_NEW_4BIT_ALPHA_VALUE (0 << 0) 436#define BLENDCON_NEW_4BIT_ALPHA_VALUE (0 << 0)
440 437
441#define S3C_FB_MAX_WIN (5) /* number of hardware windows available. */
442
443/* Notes on per-window bpp settings 438/* Notes on per-window bpp settings
444 * 439 *
445 * Value Win0 Win1 Win2 Win3 Win 4 440 * Value Win0 Win1 Win2 Win3 Win 4
@@ -462,8 +457,8 @@
462*/ 457*/
463 458
464/* FIMD Version 8 register offset definitions */ 459/* FIMD Version 8 register offset definitions */
465#define FIMD_V8_VIDTCON0 (0x20010) 460#define FIMD_V8_VIDTCON0 0x20010
466#define FIMD_V8_VIDTCON1 (0x20014) 461#define FIMD_V8_VIDTCON1 0x20014
467#define FIMD_V8_VIDTCON2 (0x20018) 462#define FIMD_V8_VIDTCON2 0x20018
468#define FIMD_V8_VIDTCON3 (0x2001C) 463#define FIMD_V8_VIDTCON3 0x2001C
469#define FIMD_V8_VIDCON1 (0x20004) 464#define FIMD_V8_VIDCON1 0x20004