Merge branch 'master' of /home/davem/src/GIT/linux-2.6/
This commit is contained in:
@@ -118,6 +118,7 @@ header-y += mtio.h
|
||||
header-y += ncp_no.h
|
||||
header-y += neighbour.h
|
||||
header-y += net_dropmon.h
|
||||
header-y += net_tstamp.h
|
||||
header-y += netfilter_arp.h
|
||||
header-y += netrom.h
|
||||
header-y += nfs2.h
|
||||
|
||||
+24
-6
@@ -80,7 +80,7 @@ char * __acpi_map_table (unsigned long phys_addr, unsigned long size);
|
||||
void __acpi_unmap_table(char *map, unsigned long size);
|
||||
int early_acpi_boot_init(void);
|
||||
int acpi_boot_init (void);
|
||||
int acpi_boot_table_init (void);
|
||||
void acpi_boot_table_init (void);
|
||||
int acpi_mps_check (void);
|
||||
int acpi_numa_init (void);
|
||||
|
||||
@@ -240,7 +240,7 @@ extern int pnpacpi_disabled;
|
||||
#define PXM_INVAL (-1)
|
||||
#define NID_INVAL (-1)
|
||||
|
||||
int acpi_check_resource_conflict(struct resource *res);
|
||||
int acpi_check_resource_conflict(const struct resource *res);
|
||||
|
||||
int acpi_check_region(resource_size_t start, resource_size_t n,
|
||||
const char *name);
|
||||
@@ -251,12 +251,19 @@ int acpi_check_mem_region(resource_size_t start, resource_size_t n,
|
||||
void __init acpi_no_s4_hw_signature(void);
|
||||
void __init acpi_old_suspend_ordering(void);
|
||||
void __init acpi_s4_no_nvs(void);
|
||||
void __init acpi_set_sci_en_on_resume(void);
|
||||
#endif /* CONFIG_PM_SLEEP */
|
||||
|
||||
struct acpi_osc_context {
|
||||
char *uuid_str; /* uuid string */
|
||||
int rev;
|
||||
struct acpi_buffer cap; /* arg2/arg3 */
|
||||
struct acpi_buffer ret; /* free by caller if success */
|
||||
};
|
||||
|
||||
#define OSC_QUERY_TYPE 0
|
||||
#define OSC_SUPPORT_TYPE 1
|
||||
#define OSC_CONTROL_TYPE 2
|
||||
#define OSC_SUPPORT_MASKS 0x1f
|
||||
|
||||
/* _OSC DW0 Definition */
|
||||
#define OSC_QUERY_ENABLE 1
|
||||
@@ -265,12 +272,23 @@ void __init acpi_s4_no_nvs(void);
|
||||
#define OSC_INVALID_REVISION_ERROR 8
|
||||
#define OSC_CAPABILITIES_MASK_ERROR 16
|
||||
|
||||
acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context);
|
||||
|
||||
/* platform-wide _OSC bits */
|
||||
#define OSC_SB_PAD_SUPPORT 1
|
||||
#define OSC_SB_PPC_OST_SUPPORT 2
|
||||
#define OSC_SB_PR3_SUPPORT 4
|
||||
#define OSC_SB_CPUHP_OST_SUPPORT 8
|
||||
#define OSC_SB_APEI_SUPPORT 16
|
||||
|
||||
/* PCI defined _OSC bits */
|
||||
/* _OSC DW1 Definition (OS Support Fields) */
|
||||
#define OSC_EXT_PCI_CONFIG_SUPPORT 1
|
||||
#define OSC_ACTIVE_STATE_PWR_SUPPORT 2
|
||||
#define OSC_CLOCK_PWR_CAPABILITY_SUPPORT 4
|
||||
#define OSC_PCI_SEGMENT_GROUPS_SUPPORT 8
|
||||
#define OSC_MSI_SUPPORT 16
|
||||
#define OSC_PCI_SUPPORT_MASKS 0x1f
|
||||
|
||||
/* _OSC DW1 Definition (OS Control Fields) */
|
||||
#define OSC_PCI_EXPRESS_NATIVE_HP_CONTROL 1
|
||||
@@ -279,7 +297,7 @@ void __init acpi_s4_no_nvs(void);
|
||||
#define OSC_PCI_EXPRESS_AER_CONTROL 8
|
||||
#define OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL 16
|
||||
|
||||
#define OSC_CONTROL_MASKS (OSC_PCI_EXPRESS_NATIVE_HP_CONTROL | \
|
||||
#define OSC_PCI_CONTROL_MASKS (OSC_PCI_EXPRESS_NATIVE_HP_CONTROL | \
|
||||
OSC_SHPC_NATIVE_HP_CONTROL | \
|
||||
OSC_PCI_EXPRESS_PME_CONTROL | \
|
||||
OSC_PCI_EXPRESS_AER_CONTROL | \
|
||||
@@ -303,9 +321,9 @@ static inline int acpi_boot_init(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int acpi_boot_table_init(void)
|
||||
static inline void acpi_boot_table_init(void)
|
||||
{
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
static inline int acpi_mps_check(void)
|
||||
|
||||
@@ -102,7 +102,6 @@ struct kiocb {
|
||||
} ki_obj;
|
||||
|
||||
__u64 ki_user_data; /* user's data for completion */
|
||||
wait_queue_t ki_wait;
|
||||
loff_t ki_pos;
|
||||
|
||||
void *private;
|
||||
@@ -140,7 +139,6 @@ struct kiocb {
|
||||
(x)->ki_dtor = NULL; \
|
||||
(x)->ki_obj.tsk = tsk; \
|
||||
(x)->ki_user_data = 0; \
|
||||
init_wait((&(x)->ki_wait)); \
|
||||
} while (0)
|
||||
|
||||
#define AIO_RING_MAGIC 0xa10a10a1
|
||||
@@ -223,8 +221,6 @@ struct mm_struct;
|
||||
static inline void exit_aio(struct mm_struct *mm) { }
|
||||
#endif /* CONFIG_AIO */
|
||||
|
||||
#define io_wait_to_kiocb(wait) container_of(wait, struct kiocb, ki_wait)
|
||||
|
||||
static inline struct kiocb *list_kiocb(struct list_head *h)
|
||||
{
|
||||
return list_entry(h, struct kiocb, ki_list);
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
|
||||
#define ATMEL_MCI_MAX_NR_SLOTS 2
|
||||
|
||||
#include <linux/dw_dmac.h>
|
||||
|
||||
/**
|
||||
* struct mci_slot_pdata - board-specific per-slot configuration
|
||||
* @bus_width: Number of data lines wired up the slot
|
||||
@@ -34,7 +32,7 @@ struct mci_slot_pdata {
|
||||
* @slot: Per-slot configuration data.
|
||||
*/
|
||||
struct mci_platform_data {
|
||||
struct dw_dma_slave dma_slave;
|
||||
struct mci_dma_data *dma_slave;
|
||||
struct mci_slot_pdata slot[ATMEL_MCI_MAX_NR_SLOTS];
|
||||
};
|
||||
|
||||
|
||||
@@ -36,18 +36,18 @@ struct backlight_device;
|
||||
struct fb_info;
|
||||
|
||||
struct backlight_ops {
|
||||
unsigned int options;
|
||||
const unsigned int options;
|
||||
|
||||
#define BL_CORE_SUSPENDRESUME (1 << 0)
|
||||
|
||||
/* Notify the backlight driver some property has changed */
|
||||
int (*update_status)(struct backlight_device *);
|
||||
int (* const update_status)(struct backlight_device *);
|
||||
/* Return the current backlight brightness (accounting for power,
|
||||
fb_blank etc.) */
|
||||
int (*get_brightness)(struct backlight_device *);
|
||||
int (* const get_brightness)(struct backlight_device *);
|
||||
/* Check if given framebuffer device is the one bound to this backlight;
|
||||
return 0 if not, !=0 if it is. If NULL, backlight always matches the fb. */
|
||||
int (*check_fb)(struct fb_info *);
|
||||
int (* const check_fb)(struct fb_info *);
|
||||
};
|
||||
|
||||
/* This structure defines all the properties of a backlight */
|
||||
@@ -86,7 +86,7 @@ struct backlight_device {
|
||||
registered this device has been unloaded, and if class_get_devdata()
|
||||
points to something in the body of that driver, it is also invalid. */
|
||||
struct mutex ops_lock;
|
||||
struct backlight_ops *ops;
|
||||
const struct backlight_ops *ops;
|
||||
|
||||
/* The framebuffer notifier block */
|
||||
struct notifier_block fb_notif;
|
||||
@@ -103,7 +103,7 @@ static inline void backlight_update_status(struct backlight_device *bd)
|
||||
}
|
||||
|
||||
extern struct backlight_device *backlight_device_register(const char *name,
|
||||
struct device *dev, void *devdata, struct backlight_ops *ops);
|
||||
struct device *dev, void *devdata, const struct backlight_ops *ops);
|
||||
extern void backlight_device_unregister(struct backlight_device *bd);
|
||||
extern void backlight_force_update(struct backlight_device *bd,
|
||||
enum backlight_update_reason reason);
|
||||
|
||||
@@ -68,6 +68,14 @@ struct linux_binprm{
|
||||
|
||||
#define BINPRM_MAX_RECURSION 4
|
||||
|
||||
/* Function parameter for binfmt->coredump */
|
||||
struct coredump_params {
|
||||
long signr;
|
||||
struct pt_regs *regs;
|
||||
struct file *file;
|
||||
unsigned long limit;
|
||||
};
|
||||
|
||||
/*
|
||||
* This structure defines the functions that are used to load the binary formats that
|
||||
* linux accepts.
|
||||
@@ -77,7 +85,7 @@ struct linux_binfmt {
|
||||
struct module *module;
|
||||
int (*load_binary)(struct linux_binprm *, struct pt_regs * regs);
|
||||
int (*load_shlib)(struct file *);
|
||||
int (*core_dump)(long signr, struct pt_regs *regs, struct file *file, unsigned long limit);
|
||||
int (*core_dump)(struct coredump_params *cprm);
|
||||
unsigned long min_coredump; /* minimal dump size */
|
||||
int hasvdso;
|
||||
};
|
||||
|
||||
@@ -42,6 +42,9 @@
|
||||
* bitmap_empty(src, nbits) Are all bits zero in *src?
|
||||
* bitmap_full(src, nbits) Are all bits set in *src?
|
||||
* bitmap_weight(src, nbits) Hamming Weight: number set bits
|
||||
* bitmap_set(dst, pos, nbits) Set specified bit area
|
||||
* bitmap_clear(dst, pos, nbits) Clear specified bit area
|
||||
* bitmap_find_next_zero_area(buf, len, pos, n, mask) Find bit free area
|
||||
* bitmap_shift_right(dst, src, n, nbits) *dst = *src >> n
|
||||
* bitmap_shift_left(dst, src, n, nbits) *dst = *src << n
|
||||
* bitmap_remap(dst, src, old, new, nbits) *dst = map(old, new)(src)
|
||||
@@ -108,6 +111,14 @@ extern int __bitmap_subset(const unsigned long *bitmap1,
|
||||
const unsigned long *bitmap2, int bits);
|
||||
extern int __bitmap_weight(const unsigned long *bitmap, int bits);
|
||||
|
||||
extern void bitmap_set(unsigned long *map, int i, int len);
|
||||
extern void bitmap_clear(unsigned long *map, int start, int nr);
|
||||
extern unsigned long bitmap_find_next_zero_area(unsigned long *map,
|
||||
unsigned long size,
|
||||
unsigned long start,
|
||||
unsigned int nr,
|
||||
unsigned long align_mask);
|
||||
|
||||
extern int bitmap_scnprintf(char *buf, unsigned int len,
|
||||
const unsigned long *src, int nbits);
|
||||
extern int __bitmap_parse(const char *buf, unsigned int buflen, int is_user,
|
||||
|
||||
+16
-10
@@ -845,7 +845,6 @@ static inline struct request_queue *bdev_get_queue(struct block_device *bdev)
|
||||
* blk_rq_err_bytes() : bytes left till the next error boundary
|
||||
* blk_rq_sectors() : sectors left in the entire request
|
||||
* blk_rq_cur_sectors() : sectors left in the current segment
|
||||
* blk_rq_err_sectors() : sectors left till the next error boundary
|
||||
*/
|
||||
static inline sector_t blk_rq_pos(const struct request *rq)
|
||||
{
|
||||
@@ -874,11 +873,6 @@ static inline unsigned int blk_rq_cur_sectors(const struct request *rq)
|
||||
return blk_rq_cur_bytes(rq) >> 9;
|
||||
}
|
||||
|
||||
static inline unsigned int blk_rq_err_sectors(const struct request *rq)
|
||||
{
|
||||
return blk_rq_err_bytes(rq) >> 9;
|
||||
}
|
||||
|
||||
/*
|
||||
* Request issue related functions.
|
||||
*/
|
||||
@@ -944,6 +938,8 @@ extern void blk_queue_io_opt(struct request_queue *q, unsigned int opt);
|
||||
extern void blk_set_default_limits(struct queue_limits *lim);
|
||||
extern int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,
|
||||
sector_t offset);
|
||||
extern int bdev_stack_limits(struct queue_limits *t, struct block_device *bdev,
|
||||
sector_t offset);
|
||||
extern void disk_stack_limits(struct gendisk *disk, struct block_device *bdev,
|
||||
sector_t offset);
|
||||
extern void blk_queue_stack_limits(struct request_queue *t, struct request_queue *b);
|
||||
@@ -1116,11 +1112,18 @@ static inline int queue_alignment_offset(struct request_queue *q)
|
||||
return q->limits.alignment_offset;
|
||||
}
|
||||
|
||||
static inline int queue_limit_alignment_offset(struct queue_limits *lim, sector_t offset)
|
||||
{
|
||||
unsigned int granularity = max(lim->physical_block_size, lim->io_min);
|
||||
|
||||
offset &= granularity - 1;
|
||||
return (granularity + lim->alignment_offset - offset) & (granularity - 1);
|
||||
}
|
||||
|
||||
static inline int queue_sector_alignment_offset(struct request_queue *q,
|
||||
sector_t sector)
|
||||
{
|
||||
return ((sector << 9) - q->limits.alignment_offset)
|
||||
& (q->limits.io_min - 1);
|
||||
return queue_limit_alignment_offset(&q->limits, sector << 9);
|
||||
}
|
||||
|
||||
static inline int bdev_alignment_offset(struct block_device *bdev)
|
||||
@@ -1147,8 +1150,11 @@ static inline int queue_discard_alignment(struct request_queue *q)
|
||||
static inline int queue_sector_discard_alignment(struct request_queue *q,
|
||||
sector_t sector)
|
||||
{
|
||||
return ((sector << 9) - q->limits.discard_alignment)
|
||||
& (q->limits.discard_granularity - 1);
|
||||
struct queue_limits *lim = &q->limits;
|
||||
unsigned int alignment = (sector << 9) & (lim->discard_granularity - 1);
|
||||
|
||||
return (lim->discard_granularity + lim->discard_alignment - alignment)
|
||||
& (lim->discard_granularity - 1);
|
||||
}
|
||||
|
||||
static inline unsigned int queue_discard_zeroes_data(struct request_queue *q)
|
||||
|
||||
@@ -43,6 +43,8 @@ extern int sched_create_sysfs_power_savings_entries(struct sysdev_class *cls);
|
||||
|
||||
#ifdef CONFIG_HOTPLUG_CPU
|
||||
extern void unregister_cpu(struct cpu *cpu);
|
||||
extern ssize_t arch_cpu_probe(const char *, size_t);
|
||||
extern ssize_t arch_cpu_release(const char *, size_t);
|
||||
#endif
|
||||
struct notifier_block;
|
||||
|
||||
@@ -115,6 +117,19 @@ extern void put_online_cpus(void);
|
||||
#define unregister_hotcpu_notifier(nb) unregister_cpu_notifier(nb)
|
||||
int cpu_down(unsigned int cpu);
|
||||
|
||||
#ifdef CONFIG_ARCH_CPU_PROBE_RELEASE
|
||||
extern void cpu_hotplug_driver_lock(void);
|
||||
extern void cpu_hotplug_driver_unlock(void);
|
||||
#else
|
||||
static inline void cpu_hotplug_driver_lock(void)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void cpu_hotplug_driver_unlock(void)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
#else /* CONFIG_HOTPLUG_CPU */
|
||||
|
||||
#define get_online_cpus() do { } while (0)
|
||||
|
||||
@@ -84,6 +84,7 @@ extern const struct cpumask *const cpu_active_mask;
|
||||
#define num_online_cpus() cpumask_weight(cpu_online_mask)
|
||||
#define num_possible_cpus() cpumask_weight(cpu_possible_mask)
|
||||
#define num_present_cpus() cpumask_weight(cpu_present_mask)
|
||||
#define num_active_cpus() cpumask_weight(cpu_active_mask)
|
||||
#define cpu_online(cpu) cpumask_test_cpu((cpu), cpu_online_mask)
|
||||
#define cpu_possible(cpu) cpumask_test_cpu((cpu), cpu_possible_mask)
|
||||
#define cpu_present(cpu) cpumask_test_cpu((cpu), cpu_present_mask)
|
||||
@@ -92,6 +93,7 @@ extern const struct cpumask *const cpu_active_mask;
|
||||
#define num_online_cpus() 1
|
||||
#define num_possible_cpus() 1
|
||||
#define num_present_cpus() 1
|
||||
#define num_active_cpus() 1
|
||||
#define cpu_online(cpu) ((cpu) == 0)
|
||||
#define cpu_possible(cpu) ((cpu) == 0)
|
||||
#define cpu_present(cpu) ((cpu) == 0)
|
||||
|
||||
@@ -0,0 +1,172 @@
|
||||
/*
|
||||
* AMD CS5535/CS5536 definitions
|
||||
* Copyright (C) 2006 Advanced Micro Devices, Inc.
|
||||
* Copyright (C) 2009 Andres Salomon <dilinger@collabora.co.uk>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of version 2 of the GNU General Public License
|
||||
* as published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#ifndef _CS5535_H
|
||||
#define _CS5535_H
|
||||
|
||||
/* MSRs */
|
||||
#define MSR_GLIU_P2D_RO0 0x10000029
|
||||
|
||||
#define MSR_LX_GLD_MSR_CONFIG 0x48002001
|
||||
#define MSR_LX_MSR_PADSEL 0x48002011 /* NOT 0x48000011; the data
|
||||
* sheet has the wrong value */
|
||||
#define MSR_GLCP_SYS_RSTPLL 0x4C000014
|
||||
#define MSR_GLCP_DOTPLL 0x4C000015
|
||||
|
||||
#define MSR_LBAR_SMB 0x5140000B
|
||||
#define MSR_LBAR_GPIO 0x5140000C
|
||||
#define MSR_LBAR_MFGPT 0x5140000D
|
||||
#define MSR_LBAR_ACPI 0x5140000E
|
||||
#define MSR_LBAR_PMS 0x5140000F
|
||||
|
||||
#define MSR_DIVIL_SOFT_RESET 0x51400017
|
||||
|
||||
#define MSR_PIC_YSEL_LOW 0x51400020
|
||||
#define MSR_PIC_YSEL_HIGH 0x51400021
|
||||
#define MSR_PIC_ZSEL_LOW 0x51400022
|
||||
#define MSR_PIC_ZSEL_HIGH 0x51400023
|
||||
#define MSR_PIC_IRQM_LPC 0x51400025
|
||||
|
||||
#define MSR_MFGPT_IRQ 0x51400028
|
||||
#define MSR_MFGPT_NR 0x51400029
|
||||
#define MSR_MFGPT_SETUP 0x5140002B
|
||||
|
||||
#define MSR_LX_SPARE_MSR 0x80000011 /* DC-specific */
|
||||
|
||||
#define MSR_GX_GLD_MSR_CONFIG 0xC0002001
|
||||
#define MSR_GX_MSR_PADSEL 0xC0002011
|
||||
|
||||
/* resource sizes */
|
||||
#define LBAR_GPIO_SIZE 0xFF
|
||||
#define LBAR_MFGPT_SIZE 0x40
|
||||
#define LBAR_ACPI_SIZE 0x40
|
||||
#define LBAR_PMS_SIZE 0x80
|
||||
|
||||
/* VSA2 magic values */
|
||||
#define VSA_VRC_INDEX 0xAC1C
|
||||
#define VSA_VRC_DATA 0xAC1E
|
||||
#define VSA_VR_UNLOCK 0xFC53 /* unlock virtual register */
|
||||
#define VSA_VR_SIGNATURE 0x0003
|
||||
#define VSA_VR_MEM_SIZE 0x0200
|
||||
#define AMD_VSA_SIG 0x4132 /* signature is ascii 'VSA2' */
|
||||
#define GSW_VSA_SIG 0x534d /* General Software signature */
|
||||
|
||||
#include <linux/io.h>
|
||||
|
||||
static inline int cs5535_has_vsa2(void)
|
||||
{
|
||||
static int has_vsa2 = -1;
|
||||
|
||||
if (has_vsa2 == -1) {
|
||||
uint16_t val;
|
||||
|
||||
/*
|
||||
* The VSA has virtual registers that we can query for a
|
||||
* signature.
|
||||
*/
|
||||
outw(VSA_VR_UNLOCK, VSA_VRC_INDEX);
|
||||
outw(VSA_VR_SIGNATURE, VSA_VRC_INDEX);
|
||||
|
||||
val = inw(VSA_VRC_DATA);
|
||||
has_vsa2 = (val == AMD_VSA_SIG || val == GSW_VSA_SIG);
|
||||
}
|
||||
|
||||
return has_vsa2;
|
||||
}
|
||||
|
||||
/* GPIOs */
|
||||
#define GPIO_OUTPUT_VAL 0x00
|
||||
#define GPIO_OUTPUT_ENABLE 0x04
|
||||
#define GPIO_OUTPUT_OPEN_DRAIN 0x08
|
||||
#define GPIO_OUTPUT_INVERT 0x0C
|
||||
#define GPIO_OUTPUT_AUX1 0x10
|
||||
#define GPIO_OUTPUT_AUX2 0x14
|
||||
#define GPIO_PULL_UP 0x18
|
||||
#define GPIO_PULL_DOWN 0x1C
|
||||
#define GPIO_INPUT_ENABLE 0x20
|
||||
#define GPIO_INPUT_INVERT 0x24
|
||||
#define GPIO_INPUT_FILTER 0x28
|
||||
#define GPIO_INPUT_EVENT_COUNT 0x2C
|
||||
#define GPIO_READ_BACK 0x30
|
||||
#define GPIO_INPUT_AUX1 0x34
|
||||
#define GPIO_EVENTS_ENABLE 0x38
|
||||
#define GPIO_LOCK_ENABLE 0x3C
|
||||
#define GPIO_POSITIVE_EDGE_EN 0x40
|
||||
#define GPIO_NEGATIVE_EDGE_EN 0x44
|
||||
#define GPIO_POSITIVE_EDGE_STS 0x48
|
||||
#define GPIO_NEGATIVE_EDGE_STS 0x4C
|
||||
|
||||
#define GPIO_MAP_X 0xE0
|
||||
#define GPIO_MAP_Y 0xE4
|
||||
#define GPIO_MAP_Z 0xE8
|
||||
#define GPIO_MAP_W 0xEC
|
||||
|
||||
void cs5535_gpio_set(unsigned offset, unsigned int reg);
|
||||
void cs5535_gpio_clear(unsigned offset, unsigned int reg);
|
||||
int cs5535_gpio_isset(unsigned offset, unsigned int reg);
|
||||
|
||||
/* MFGPTs */
|
||||
|
||||
#define MFGPT_MAX_TIMERS 8
|
||||
#define MFGPT_TIMER_ANY (-1)
|
||||
|
||||
#define MFGPT_DOMAIN_WORKING 1
|
||||
#define MFGPT_DOMAIN_STANDBY 2
|
||||
#define MFGPT_DOMAIN_ANY (MFGPT_DOMAIN_WORKING | MFGPT_DOMAIN_STANDBY)
|
||||
|
||||
#define MFGPT_CMP1 0
|
||||
#define MFGPT_CMP2 1
|
||||
|
||||
#define MFGPT_EVENT_IRQ 0
|
||||
#define MFGPT_EVENT_NMI 1
|
||||
#define MFGPT_EVENT_RESET 3
|
||||
|
||||
#define MFGPT_REG_CMP1 0
|
||||
#define MFGPT_REG_CMP2 2
|
||||
#define MFGPT_REG_COUNTER 4
|
||||
#define MFGPT_REG_SETUP 6
|
||||
|
||||
#define MFGPT_SETUP_CNTEN (1 << 15)
|
||||
#define MFGPT_SETUP_CMP2 (1 << 14)
|
||||
#define MFGPT_SETUP_CMP1 (1 << 13)
|
||||
#define MFGPT_SETUP_SETUP (1 << 12)
|
||||
#define MFGPT_SETUP_STOPEN (1 << 11)
|
||||
#define MFGPT_SETUP_EXTEN (1 << 10)
|
||||
#define MFGPT_SETUP_REVEN (1 << 5)
|
||||
#define MFGPT_SETUP_CLKSEL (1 << 4)
|
||||
|
||||
struct cs5535_mfgpt_timer;
|
||||
|
||||
extern uint16_t cs5535_mfgpt_read(struct cs5535_mfgpt_timer *timer,
|
||||
uint16_t reg);
|
||||
extern void cs5535_mfgpt_write(struct cs5535_mfgpt_timer *timer, uint16_t reg,
|
||||
uint16_t value);
|
||||
|
||||
extern int cs5535_mfgpt_toggle_event(struct cs5535_mfgpt_timer *timer, int cmp,
|
||||
int event, int enable);
|
||||
extern int cs5535_mfgpt_set_irq(struct cs5535_mfgpt_timer *timer, int cmp,
|
||||
int *irq, int enable);
|
||||
extern struct cs5535_mfgpt_timer *cs5535_mfgpt_alloc_timer(int timer,
|
||||
int domain);
|
||||
extern void cs5535_mfgpt_free_timer(struct cs5535_mfgpt_timer *timer);
|
||||
|
||||
static inline int cs5535_mfgpt_setup_irq(struct cs5535_mfgpt_timer *timer,
|
||||
int cmp, int *irq)
|
||||
{
|
||||
return cs5535_mfgpt_set_irq(timer, cmp, irq, 1);
|
||||
}
|
||||
|
||||
static inline int cs5535_mfgpt_release_irq(struct cs5535_mfgpt_timer *timer,
|
||||
int cmp, int *irq)
|
||||
{
|
||||
return cs5535_mfgpt_set_irq(timer, cmp, irq, 0);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -15,7 +15,7 @@
|
||||
#define _X 0x40 /* hex digit */
|
||||
#define _SP 0x80 /* hard space (0x20) */
|
||||
|
||||
extern unsigned char _ctype[];
|
||||
extern const unsigned char _ctype[];
|
||||
|
||||
#define __ismask(x) (_ctype[(int)(unsigned char)(x)])
|
||||
|
||||
@@ -27,6 +27,7 @@ extern unsigned char _ctype[];
|
||||
#define islower(c) ((__ismask(c)&(_L)) != 0)
|
||||
#define isprint(c) ((__ismask(c)&(_P|_U|_L|_D|_SP)) != 0)
|
||||
#define ispunct(c) ((__ismask(c)&(_P)) != 0)
|
||||
/* Note: isspace() must return false for %NUL-terminator */
|
||||
#define isspace(c) ((__ismask(c)&(_S)) != 0)
|
||||
#define isupper(c) ((__ismask(c)&(_U)) != 0)
|
||||
#define isxdigit(c) ((__ismask(c)&(_D|_X)) != 0)
|
||||
|
||||
@@ -25,7 +25,7 @@ static void *malloc(int size)
|
||||
void *p;
|
||||
|
||||
if (size < 0)
|
||||
error("Malloc error");
|
||||
return NULL;
|
||||
if (!malloc_ptr)
|
||||
malloc_ptr = free_mem_ptr;
|
||||
|
||||
@@ -35,7 +35,7 @@ static void *malloc(int size)
|
||||
malloc_ptr += size;
|
||||
|
||||
if (free_mem_end_ptr && malloc_ptr >= free_mem_end_ptr)
|
||||
error("Out of memory");
|
||||
return NULL;
|
||||
|
||||
malloc_count++;
|
||||
return p;
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
#ifndef DECOMPRESS_UNLZO_H
|
||||
#define DECOMPRESS_UNLZO_H
|
||||
|
||||
int unlzo(unsigned char *inbuf, int len,
|
||||
int(*fill)(void*, unsigned int),
|
||||
int(*flush)(void*, unsigned int),
|
||||
unsigned char *output,
|
||||
int *pos,
|
||||
void(*error)(char *x));
|
||||
#endif
|
||||
@@ -235,7 +235,7 @@ void dm_uevent_add(struct mapped_device *md, struct list_head *elist);
|
||||
const char *dm_device_name(struct mapped_device *md);
|
||||
int dm_copy_name_and_uuid(struct mapped_device *md, char *name, char *uuid);
|
||||
struct gendisk *dm_disk(struct mapped_device *md);
|
||||
int dm_suspended(struct mapped_device *md);
|
||||
int dm_suspended(struct dm_target *ti);
|
||||
int dm_noflush_suspending(struct dm_target *ti);
|
||||
union map_info *dm_get_mapinfo(struct bio *bio);
|
||||
union map_info *dm_get_rq_mapinfo(struct request *rq);
|
||||
@@ -276,7 +276,7 @@ void dm_table_unplug_all(struct dm_table *t);
|
||||
/*
|
||||
* Table reference counting.
|
||||
*/
|
||||
struct dm_table *dm_get_table(struct mapped_device *md);
|
||||
struct dm_table *dm_get_live_table(struct mapped_device *md);
|
||||
void dm_table_get(struct dm_table *t);
|
||||
void dm_table_put(struct dm_table *t);
|
||||
|
||||
@@ -295,8 +295,10 @@ void dm_table_event(struct dm_table *t);
|
||||
|
||||
/*
|
||||
* The device must be suspended before calling this method.
|
||||
* Returns the previous table, which the caller must destroy.
|
||||
*/
|
||||
int dm_swap_table(struct mapped_device *md, struct dm_table *t);
|
||||
struct dm_table *dm_swap_table(struct mapped_device *md,
|
||||
struct dm_table *t);
|
||||
|
||||
/*
|
||||
* A wrapper around vmalloc.
|
||||
|
||||
@@ -166,9 +166,9 @@ struct driver_attribute driver_attr_##_name = \
|
||||
__ATTR(_name, _mode, _show, _store)
|
||||
|
||||
extern int __must_check driver_create_file(struct device_driver *driver,
|
||||
struct driver_attribute *attr);
|
||||
const struct driver_attribute *attr);
|
||||
extern void driver_remove_file(struct device_driver *driver,
|
||||
struct driver_attribute *attr);
|
||||
const struct driver_attribute *attr);
|
||||
|
||||
extern int __must_check driver_add_kobj(struct device_driver *drv,
|
||||
struct kobject *kobj,
|
||||
@@ -319,13 +319,13 @@ struct device_attribute {
|
||||
struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store)
|
||||
|
||||
extern int __must_check device_create_file(struct device *device,
|
||||
struct device_attribute *entry);
|
||||
const struct device_attribute *entry);
|
||||
extern void device_remove_file(struct device *dev,
|
||||
struct device_attribute *attr);
|
||||
const struct device_attribute *attr);
|
||||
extern int __must_check device_create_bin_file(struct device *dev,
|
||||
struct bin_attribute *attr);
|
||||
const struct bin_attribute *attr);
|
||||
extern void device_remove_bin_file(struct device *dev,
|
||||
struct bin_attribute *attr);
|
||||
const struct bin_attribute *attr);
|
||||
extern int device_schedule_callback_owner(struct device *dev,
|
||||
void (*func)(struct device *dev), struct module *owner);
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ struct dm_dirty_log_type;
|
||||
|
||||
struct dm_dirty_log {
|
||||
struct dm_dirty_log_type *type;
|
||||
int (*flush_callback_fn)(struct dm_target *ti);
|
||||
void *context;
|
||||
};
|
||||
|
||||
@@ -136,8 +137,9 @@ int dm_dirty_log_type_unregister(struct dm_dirty_log_type *type);
|
||||
* type->constructor/destructor() directly.
|
||||
*/
|
||||
struct dm_dirty_log *dm_dirty_log_create(const char *type_name,
|
||||
struct dm_target *ti,
|
||||
unsigned argc, char **argv);
|
||||
struct dm_target *ti,
|
||||
int (*flush_callback_fn)(struct dm_target *ti),
|
||||
unsigned argc, char **argv);
|
||||
void dm_dirty_log_destroy(struct dm_dirty_log *log);
|
||||
|
||||
#endif /* __KERNEL__ */
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (C) 2001 - 2003 Sistina Software (UK) Limited.
|
||||
* Copyright (C) 2004 - 2005 Red Hat, Inc. All rights reserved.
|
||||
* Copyright (C) 2004 - 2009 Red Hat, Inc. All rights reserved.
|
||||
*
|
||||
* This file is released under the LGPL.
|
||||
*/
|
||||
@@ -266,9 +266,9 @@ enum {
|
||||
#define DM_DEV_SET_GEOMETRY _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl)
|
||||
|
||||
#define DM_VERSION_MAJOR 4
|
||||
#define DM_VERSION_MINOR 15
|
||||
#define DM_VERSION_MINOR 16
|
||||
#define DM_VERSION_PATCHLEVEL 0
|
||||
#define DM_VERSION_EXTRA "-ioctl (2009-04-01)"
|
||||
#define DM_VERSION_EXTRA "-ioctl (2009-11-05)"
|
||||
|
||||
/* Status bits */
|
||||
#define DM_READONLY_FLAG (1 << 0) /* In/Out */
|
||||
@@ -309,4 +309,11 @@ enum {
|
||||
*/
|
||||
#define DM_NOFLUSH_FLAG (1 << 11) /* In */
|
||||
|
||||
/*
|
||||
* If set, any table information returned will relate to the inactive
|
||||
* table instead of the live one. Always check DM_INACTIVE_PRESENT_FLAG
|
||||
* is set before using the data returned.
|
||||
*/
|
||||
#define DM_QUERY_INACTIVE_TABLE_FLAG (1 << 12) /* In */
|
||||
|
||||
#endif /* _LINUX_DM_IOCTL_H */
|
||||
|
||||
@@ -78,8 +78,7 @@ void dm_rh_dec(struct dm_region_hash *rh, region_t region);
|
||||
/* Delay bios on regions. */
|
||||
void dm_rh_delay(struct dm_region_hash *rh, struct bio *bio);
|
||||
|
||||
void dm_rh_mark_nosync(struct dm_region_hash *rh,
|
||||
struct bio *bio, unsigned done, int error);
|
||||
void dm_rh_mark_nosync(struct dm_region_hash *rh, struct bio *bio);
|
||||
|
||||
/*
|
||||
* Region recovery control.
|
||||
|
||||
@@ -74,7 +74,7 @@ enum dma_transaction_type {
|
||||
* control completion, and communicate status.
|
||||
* @DMA_PREP_INTERRUPT - trigger an interrupt (callback) upon completion of
|
||||
* this transaction
|
||||
* @DMA_CTRL_ACK - the descriptor cannot be reused until the client
|
||||
* @DMA_CTRL_ACK - if clear, the descriptor cannot be reused until the client
|
||||
* acknowledges receipt, i.e. has has a chance to establish any dependency
|
||||
* chains
|
||||
* @DMA_COMPL_SKIP_SRC_UNMAP - set to disable dma-unmapping the source buffer(s)
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
|
||||
|
||||
extern const char *drbd_buildtag(void);
|
||||
#define REL_VERSION "8.3.6"
|
||||
#define REL_VERSION "8.3.7"
|
||||
#define API_VERSION 88
|
||||
#define PRO_VERSION_MIN 86
|
||||
#define PRO_VERSION_MAX 91
|
||||
|
||||
@@ -69,6 +69,7 @@ NL_PACKET(disconnect, 6, )
|
||||
|
||||
NL_PACKET(resize, 7,
|
||||
NL_INT64( 29, T_MAY_IGNORE, resize_size)
|
||||
NL_BIT( 68, T_MAY_IGNORE, resize_force)
|
||||
)
|
||||
|
||||
NL_PACKET(syncer_conf, 8,
|
||||
|
||||
@@ -1,587 +0,0 @@
|
||||
/*
|
||||
* 2007+ Copyright (c) Evgeniy Polyakov <johnpol@2ka.mipt.ru>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef __DST_H
|
||||
#define __DST_H
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/connector.h>
|
||||
|
||||
#define DST_NAMELEN 32
|
||||
#define DST_NAME "dst"
|
||||
|
||||
enum {
|
||||
/* Remove node with given id from storage */
|
||||
DST_DEL_NODE = 0,
|
||||
/* Add remote node with given id to the storage */
|
||||
DST_ADD_REMOTE,
|
||||
/* Add local node with given id to the storage to be exported and used by remote peers */
|
||||
DST_ADD_EXPORT,
|
||||
/* Crypto initialization command (hash/cipher used to protect the connection) */
|
||||
DST_CRYPTO,
|
||||
/* Security attributes for given connection (permissions for example) */
|
||||
DST_SECURITY,
|
||||
/* Register given node in the block layer subsystem */
|
||||
DST_START,
|
||||
DST_CMD_MAX
|
||||
};
|
||||
|
||||
struct dst_ctl
|
||||
{
|
||||
/* Storage name */
|
||||
char name[DST_NAMELEN];
|
||||
/* Command flags */
|
||||
__u32 flags;
|
||||
/* Command itself (see above) */
|
||||
__u32 cmd;
|
||||
/* Maximum number of pages per single request in this device */
|
||||
__u32 max_pages;
|
||||
/* Stale/error transaction scanning timeout in milliseconds */
|
||||
__u32 trans_scan_timeout;
|
||||
/* Maximum number of retry sends before completing transaction as broken */
|
||||
__u32 trans_max_retries;
|
||||
/* Storage size */
|
||||
__u64 size;
|
||||
};
|
||||
|
||||
/* Reply command carries completion status */
|
||||
struct dst_ctl_ack
|
||||
{
|
||||
struct cn_msg msg;
|
||||
int error;
|
||||
int unused[3];
|
||||
};
|
||||
|
||||
/*
|
||||
* Unfortunaltely socket address structure is not exported to userspace
|
||||
* and is redefined there.
|
||||
*/
|
||||
#define SADDR_MAX_DATA 128
|
||||
|
||||
struct saddr {
|
||||
/* address family, AF_xxx */
|
||||
unsigned short sa_family;
|
||||
/* 14 bytes of protocol address */
|
||||
char sa_data[SADDR_MAX_DATA];
|
||||
/* Number of bytes used in sa_data */
|
||||
unsigned short sa_data_len;
|
||||
};
|
||||
|
||||
/* Address structure */
|
||||
struct dst_network_ctl
|
||||
{
|
||||
/* Socket type: datagram, stream...*/
|
||||
unsigned int type;
|
||||
/* Let me guess, is it a Jupiter diameter? */
|
||||
unsigned int proto;
|
||||
/* Peer's address */
|
||||
struct saddr addr;
|
||||
};
|
||||
|
||||
struct dst_crypto_ctl
|
||||
{
|
||||
/* Cipher and hash names */
|
||||
char cipher_algo[DST_NAMELEN];
|
||||
char hash_algo[DST_NAMELEN];
|
||||
|
||||
/* Key sizes. Can be zero for digest for example */
|
||||
unsigned int cipher_keysize, hash_keysize;
|
||||
/* Alignment. Calculated by the DST itself. */
|
||||
unsigned int crypto_attached_size;
|
||||
/* Number of threads to perform crypto operations */
|
||||
int thread_num;
|
||||
};
|
||||
|
||||
/* Export security attributes have this bits checked in when client connects */
|
||||
#define DST_PERM_READ (1<<0)
|
||||
#define DST_PERM_WRITE (1<<1)
|
||||
|
||||
/*
|
||||
* Right now it is simple model, where each remote address
|
||||
* is assigned to set of permissions it is allowed to perform.
|
||||
* In real world block device does not know anything but
|
||||
* reading and writing, so it should be more than enough.
|
||||
*/
|
||||
struct dst_secure_user
|
||||
{
|
||||
unsigned int permissions;
|
||||
struct saddr addr;
|
||||
};
|
||||
|
||||
/*
|
||||
* Export control command: device to export and network address to accept
|
||||
* clients to work with given device
|
||||
*/
|
||||
struct dst_export_ctl
|
||||
{
|
||||
char device[DST_NAMELEN];
|
||||
struct dst_network_ctl ctl;
|
||||
};
|
||||
|
||||
enum {
|
||||
DST_CFG = 1, /* Request remote configuration */
|
||||
DST_IO, /* IO command */
|
||||
DST_IO_RESPONSE, /* IO response */
|
||||
DST_PING, /* Keepalive message */
|
||||
DST_NCMD_MAX,
|
||||
};
|
||||
|
||||
struct dst_cmd
|
||||
{
|
||||
/* Network command itself, see above */
|
||||
__u32 cmd;
|
||||
/*
|
||||
* Size of the attached data
|
||||
* (in most cases, for READ command it means how many bytes were requested)
|
||||
*/
|
||||
__u32 size;
|
||||
/* Crypto size: number of attached bytes with digest/hmac */
|
||||
__u32 csize;
|
||||
/* Here we can carry secret data */
|
||||
__u32 reserved;
|
||||
/* Read/write bits, see how they are encoded in bio structure */
|
||||
__u64 rw;
|
||||
/* BIO flags */
|
||||
__u64 flags;
|
||||
/* Unique command id (like transaction ID) */
|
||||
__u64 id;
|
||||
/* Sector to start IO from */
|
||||
__u64 sector;
|
||||
/* Hash data is placed after this header */
|
||||
__u8 hash[0];
|
||||
};
|
||||
|
||||
/*
|
||||
* Convert command to/from network byte order.
|
||||
* We do not use hton*() functions, since there is
|
||||
* no 64-bit implementation.
|
||||
*/
|
||||
static inline void dst_convert_cmd(struct dst_cmd *c)
|
||||
{
|
||||
c->cmd = __cpu_to_be32(c->cmd);
|
||||
c->csize = __cpu_to_be32(c->csize);
|
||||
c->size = __cpu_to_be32(c->size);
|
||||
c->sector = __cpu_to_be64(c->sector);
|
||||
c->id = __cpu_to_be64(c->id);
|
||||
c->flags = __cpu_to_be64(c->flags);
|
||||
c->rw = __cpu_to_be64(c->rw);
|
||||
}
|
||||
|
||||
/* Transaction id */
|
||||
typedef __u64 dst_gen_t;
|
||||
|
||||
#ifdef __KERNEL__
|
||||
|
||||
#include <linux/blkdev.h>
|
||||
#include <linux/bio.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/mempool.h>
|
||||
#include <linux/net.h>
|
||||
#include <linux/poll.h>
|
||||
#include <linux/rbtree.h>
|
||||
|
||||
#ifdef CONFIG_DST_DEBUG
|
||||
#define dprintk(f, a...) printk(KERN_NOTICE f, ##a)
|
||||
#else
|
||||
static inline void __attribute__ ((format (printf, 1, 2)))
|
||||
dprintk(const char *fmt, ...) {}
|
||||
#endif
|
||||
|
||||
struct dst_node;
|
||||
|
||||
struct dst_trans
|
||||
{
|
||||
/* DST node we are working with */
|
||||
struct dst_node *n;
|
||||
|
||||
/* Entry inside transaction tree */
|
||||
struct rb_node trans_entry;
|
||||
|
||||
/* Merlin kills this transaction when this memory cell equals zero */
|
||||
atomic_t refcnt;
|
||||
|
||||
/* How this transaction should be processed by crypto engine */
|
||||
short enc;
|
||||
/* How many times this transaction was resent */
|
||||
short retries;
|
||||
/* Completion status */
|
||||
int error;
|
||||
|
||||
/* When did we send it to the remote peer */
|
||||
long send_time;
|
||||
|
||||
/* My name is...
|
||||
* Well, computers does not speak, they have unique id instead */
|
||||
dst_gen_t gen;
|
||||
|
||||
/* Block IO we are working with */
|
||||
struct bio *bio;
|
||||
|
||||
/* Network command for above block IO request */
|
||||
struct dst_cmd cmd;
|
||||
};
|
||||
|
||||
struct dst_crypto_engine
|
||||
{
|
||||
/* What should we do with all block requests */
|
||||
struct crypto_hash *hash;
|
||||
struct crypto_ablkcipher *cipher;
|
||||
|
||||
/* Pool of pages used to encrypt data into before sending */
|
||||
int page_num;
|
||||
struct page **pages;
|
||||
|
||||
/* What to do with current request */
|
||||
int enc;
|
||||
/* Who we are and where do we go */
|
||||
struct scatterlist *src, *dst;
|
||||
|
||||
/* Maximum timeout waiting for encryption to be completed */
|
||||
long timeout;
|
||||
/* IV is a 64-bit sequential counter */
|
||||
u64 iv;
|
||||
|
||||
/* Secret data */
|
||||
void *private;
|
||||
|
||||
/* Cached temporary data lives here */
|
||||
int size;
|
||||
void *data;
|
||||
};
|
||||
|
||||
struct dst_state
|
||||
{
|
||||
/* The main state protection */
|
||||
struct mutex state_lock;
|
||||
|
||||
/* Polling machinery for sockets */
|
||||
wait_queue_t wait;
|
||||
wait_queue_head_t *whead;
|
||||
/* Most of events are being waited here */
|
||||
wait_queue_head_t thread_wait;
|
||||
|
||||
/* Who owns this? */
|
||||
struct dst_node *node;
|
||||
|
||||
/* Network address for this state */
|
||||
struct dst_network_ctl ctl;
|
||||
|
||||
/* Permissions to work with: read-only or rw connection */
|
||||
u32 permissions;
|
||||
|
||||
/* Called when we need to clean private data */
|
||||
void (* cleanup)(struct dst_state *st);
|
||||
|
||||
/* Used by the server: BIO completion queues BIOs here */
|
||||
struct list_head request_list;
|
||||
spinlock_t request_lock;
|
||||
|
||||
/* Guess what? No, it is not number of planets */
|
||||
atomic_t refcnt;
|
||||
|
||||
/* This flags is set when connection should be dropped */
|
||||
int need_exit;
|
||||
|
||||
/*
|
||||
* Socket to work with. Second pointer is used for
|
||||
* lockless check if socket was changed before performing
|
||||
* next action (like working with cached polling result)
|
||||
*/
|
||||
struct socket *socket, *read_socket;
|
||||
|
||||
/* Cached preallocated data */
|
||||
void *data;
|
||||
unsigned int size;
|
||||
|
||||
/* Currently processed command */
|
||||
struct dst_cmd cmd;
|
||||
};
|
||||
|
||||
struct dst_info
|
||||
{
|
||||
/* Device size */
|
||||
u64 size;
|
||||
|
||||
/* Local device name for export devices */
|
||||
char local[DST_NAMELEN];
|
||||
|
||||
/* Network setup */
|
||||
struct dst_network_ctl net;
|
||||
|
||||
/* Sysfs bits use this */
|
||||
struct device device;
|
||||
};
|
||||
|
||||
struct dst_node
|
||||
{
|
||||
struct list_head node_entry;
|
||||
|
||||
/* Hi, my name is stored here */
|
||||
char name[DST_NAMELEN];
|
||||
/* My cache name is stored here */
|
||||
char cache_name[DST_NAMELEN];
|
||||
|
||||
/* Block device attached to given node.
|
||||
* Only valid for exporting nodes */
|
||||
struct block_device *bdev;
|
||||
/* Network state machine for given peer */
|
||||
struct dst_state *state;
|
||||
|
||||
/* Block IO machinery */
|
||||
struct request_queue *queue;
|
||||
struct gendisk *disk;
|
||||
|
||||
/* Number of threads in processing pool */
|
||||
int thread_num;
|
||||
/* Maximum number of pages in single IO */
|
||||
int max_pages;
|
||||
|
||||
/* I'm that big in bytes */
|
||||
loff_t size;
|
||||
|
||||
/* Exported to userspace node information */
|
||||
struct dst_info *info;
|
||||
|
||||
/*
|
||||
* Security attribute list.
|
||||
* Used only by exporting node currently.
|
||||
*/
|
||||
struct list_head security_list;
|
||||
struct mutex security_lock;
|
||||
|
||||
/*
|
||||
* When this unerflows below zero, university collapses.
|
||||
* But this will not happen, since node will be freed,
|
||||
* when reference counter reaches zero.
|
||||
*/
|
||||
atomic_t refcnt;
|
||||
|
||||
/* How precisely should I be started? */
|
||||
int (*start)(struct dst_node *);
|
||||
|
||||
/* Crypto capabilities */
|
||||
struct dst_crypto_ctl crypto;
|
||||
u8 *hash_key;
|
||||
u8 *cipher_key;
|
||||
|
||||
/* Pool of processing thread */
|
||||
struct thread_pool *pool;
|
||||
|
||||
/* Transaction IDs live here */
|
||||
atomic_long_t gen;
|
||||
|
||||
/*
|
||||
* How frequently and how many times transaction
|
||||
* tree should be scanned to drop stale objects.
|
||||
*/
|
||||
long trans_scan_timeout;
|
||||
int trans_max_retries;
|
||||
|
||||
/* Small gnomes live here */
|
||||
struct rb_root trans_root;
|
||||
struct mutex trans_lock;
|
||||
|
||||
/*
|
||||
* Transaction cache/memory pool.
|
||||
* It is big enough to contain not only transaction
|
||||
* itself, but additional crypto data (digest/hmac).
|
||||
*/
|
||||
struct kmem_cache *trans_cache;
|
||||
mempool_t *trans_pool;
|
||||
|
||||
/* This entity scans transaction tree */
|
||||
struct delayed_work trans_work;
|
||||
|
||||
wait_queue_head_t wait;
|
||||
};
|
||||
|
||||
/* Kernel representation of the security attribute */
|
||||
struct dst_secure
|
||||
{
|
||||
struct list_head sec_entry;
|
||||
struct dst_secure_user sec;
|
||||
};
|
||||
|
||||
int dst_process_bio(struct dst_node *n, struct bio *bio);
|
||||
|
||||
int dst_node_init_connected(struct dst_node *n, struct dst_network_ctl *r);
|
||||
int dst_node_init_listened(struct dst_node *n, struct dst_export_ctl *le);
|
||||
|
||||
static inline struct dst_state *dst_state_get(struct dst_state *st)
|
||||
{
|
||||
BUG_ON(atomic_read(&st->refcnt) == 0);
|
||||
atomic_inc(&st->refcnt);
|
||||
return st;
|
||||
}
|
||||
|
||||
void dst_state_put(struct dst_state *st);
|
||||
|
||||
struct dst_state *dst_state_alloc(struct dst_node *n);
|
||||
int dst_state_socket_create(struct dst_state *st);
|
||||
void dst_state_socket_release(struct dst_state *st);
|
||||
|
||||
void dst_state_exit_connected(struct dst_state *st);
|
||||
|
||||
int dst_state_schedule_receiver(struct dst_state *st);
|
||||
|
||||
void dst_dump_addr(struct socket *sk, struct sockaddr *sa, char *str);
|
||||
|
||||
static inline void dst_state_lock(struct dst_state *st)
|
||||
{
|
||||
mutex_lock(&st->state_lock);
|
||||
}
|
||||
|
||||
static inline void dst_state_unlock(struct dst_state *st)
|
||||
{
|
||||
mutex_unlock(&st->state_lock);
|
||||
}
|
||||
|
||||
void dst_poll_exit(struct dst_state *st);
|
||||
int dst_poll_init(struct dst_state *st);
|
||||
|
||||
static inline unsigned int dst_state_poll(struct dst_state *st)
|
||||
{
|
||||
unsigned int revents = POLLHUP | POLLERR;
|
||||
|
||||
dst_state_lock(st);
|
||||
if (st->socket)
|
||||
revents = st->socket->ops->poll(NULL, st->socket, NULL);
|
||||
dst_state_unlock(st);
|
||||
|
||||
return revents;
|
||||
}
|
||||
|
||||
static inline int dst_thread_setup(void *private, void *data)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void dst_node_put(struct dst_node *n);
|
||||
|
||||
static inline struct dst_node *dst_node_get(struct dst_node *n)
|
||||
{
|
||||
atomic_inc(&n->refcnt);
|
||||
return n;
|
||||
}
|
||||
|
||||
int dst_data_recv(struct dst_state *st, void *data, unsigned int size);
|
||||
int dst_recv_cdata(struct dst_state *st, void *cdata);
|
||||
int dst_data_send_header(struct socket *sock,
|
||||
void *data, unsigned int size, int more);
|
||||
|
||||
int dst_send_bio(struct dst_state *st, struct dst_cmd *cmd, struct bio *bio);
|
||||
|
||||
int dst_process_io(struct dst_state *st);
|
||||
int dst_export_crypto(struct dst_node *n, struct bio *bio);
|
||||
int dst_export_send_bio(struct bio *bio);
|
||||
int dst_start_export(struct dst_node *n);
|
||||
|
||||
int __init dst_export_init(void);
|
||||
void dst_export_exit(void);
|
||||
|
||||
/* Private structure for export block IO requests */
|
||||
struct dst_export_priv
|
||||
{
|
||||
struct list_head request_entry;
|
||||
struct dst_state *state;
|
||||
struct bio *bio;
|
||||
struct dst_cmd cmd;
|
||||
};
|
||||
|
||||
static inline void dst_trans_get(struct dst_trans *t)
|
||||
{
|
||||
atomic_inc(&t->refcnt);
|
||||
}
|
||||
|
||||
struct dst_trans *dst_trans_search(struct dst_node *node, dst_gen_t gen);
|
||||
int dst_trans_remove(struct dst_trans *t);
|
||||
int dst_trans_remove_nolock(struct dst_trans *t);
|
||||
void dst_trans_put(struct dst_trans *t);
|
||||
|
||||
/*
|
||||
* Convert bio into network command.
|
||||
*/
|
||||
static inline void dst_bio_to_cmd(struct bio *bio, struct dst_cmd *cmd,
|
||||
u32 command, u64 id)
|
||||
{
|
||||
cmd->cmd = command;
|
||||
cmd->flags = (bio->bi_flags << BIO_POOL_BITS) >> BIO_POOL_BITS;
|
||||
cmd->rw = bio->bi_rw;
|
||||
cmd->size = bio->bi_size;
|
||||
cmd->csize = 0;
|
||||
cmd->id = id;
|
||||
cmd->sector = bio->bi_sector;
|
||||
};
|
||||
|
||||
int dst_trans_send(struct dst_trans *t);
|
||||
int dst_trans_crypto(struct dst_trans *t);
|
||||
|
||||
int dst_node_crypto_init(struct dst_node *n, struct dst_crypto_ctl *ctl);
|
||||
void dst_node_crypto_exit(struct dst_node *n);
|
||||
|
||||
static inline int dst_need_crypto(struct dst_node *n)
|
||||
{
|
||||
struct dst_crypto_ctl *c = &n->crypto;
|
||||
/*
|
||||
* Logical OR is appropriate here, but boolean one produces
|
||||
* more optimal code, so it is used instead.
|
||||
*/
|
||||
return (c->hash_algo[0] | c->cipher_algo[0]);
|
||||
}
|
||||
|
||||
int dst_node_trans_init(struct dst_node *n, unsigned int size);
|
||||
void dst_node_trans_exit(struct dst_node *n);
|
||||
|
||||
/*
|
||||
* Pool of threads.
|
||||
* Ready list contains threads currently free to be used,
|
||||
* active one contains threads with some work scheduled for them.
|
||||
* Caller can wait in given queue when thread is ready.
|
||||
*/
|
||||
struct thread_pool
|
||||
{
|
||||
int thread_num;
|
||||
struct mutex thread_lock;
|
||||
struct list_head ready_list, active_list;
|
||||
|
||||
wait_queue_head_t wait;
|
||||
};
|
||||
|
||||
void thread_pool_del_worker(struct thread_pool *p);
|
||||
void thread_pool_del_worker_id(struct thread_pool *p, unsigned int id);
|
||||
int thread_pool_add_worker(struct thread_pool *p,
|
||||
char *name,
|
||||
unsigned int id,
|
||||
void *(* init)(void *data),
|
||||
void (* cleanup)(void *data),
|
||||
void *data);
|
||||
|
||||
void thread_pool_destroy(struct thread_pool *p);
|
||||
struct thread_pool *thread_pool_create(int num, char *name,
|
||||
void *(* init)(void *data),
|
||||
void (* cleanup)(void *data),
|
||||
void *data);
|
||||
|
||||
int thread_pool_schedule(struct thread_pool *p,
|
||||
int (* setup)(void *stored_private, void *setup_data),
|
||||
int (* action)(void *stored_private, void *setup_data),
|
||||
void *setup_data, long timeout);
|
||||
int thread_pool_schedule_private(struct thread_pool *p,
|
||||
int (* setup)(void *private, void *data),
|
||||
int (* action)(void *private, void *data),
|
||||
void *data, long timeout, void *id);
|
||||
|
||||
#endif /* __KERNEL__ */
|
||||
#endif /* __DST_H */
|
||||
@@ -57,8 +57,7 @@ extern int ddebug_remove_module(char *mod_name);
|
||||
{ KBUILD_MODNAME, __func__, __FILE__, fmt, DEBUG_HASH, \
|
||||
DEBUG_HASH2, __LINE__, _DPRINTK_FLAGS_DEFAULT }; \
|
||||
if (__dynamic_dbg_enabled(descriptor)) \
|
||||
printk(KERN_DEBUG KBUILD_MODNAME ":" pr_fmt(fmt), \
|
||||
##__VA_ARGS__); \
|
||||
printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); \
|
||||
} while (0)
|
||||
|
||||
|
||||
@@ -69,9 +68,7 @@ extern int ddebug_remove_module(char *mod_name);
|
||||
{ KBUILD_MODNAME, __func__, __FILE__, fmt, DEBUG_HASH, \
|
||||
DEBUG_HASH2, __LINE__, _DPRINTK_FLAGS_DEFAULT }; \
|
||||
if (__dynamic_dbg_enabled(descriptor)) \
|
||||
dev_printk(KERN_DEBUG, dev, \
|
||||
KBUILD_MODNAME ": " fmt, \
|
||||
##__VA_ARGS__); \
|
||||
dev_printk(KERN_DEBUG, dev, fmt, ##__VA_ARGS__); \
|
||||
} while (0)
|
||||
|
||||
#else
|
||||
@@ -81,8 +78,10 @@ static inline int ddebug_remove_module(char *mod)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define dynamic_pr_debug(fmt, ...) do { } while (0)
|
||||
#define dynamic_dev_dbg(dev, format, ...) do { } while (0)
|
||||
#define dynamic_pr_debug(fmt, ...) \
|
||||
do { if (0) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); } while (0)
|
||||
#define dynamic_dev_dbg(dev, format, ...) \
|
||||
do { if (0) dev_printk(KERN_DEBUG, dev, fmt, ##__VA_ARGS__); } while (0)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
+1
-5
@@ -280,11 +280,7 @@ efi_guidcmp (efi_guid_t left, efi_guid_t right)
|
||||
static inline char *
|
||||
efi_guid_unparse(efi_guid_t *guid, char *out)
|
||||
{
|
||||
sprintf(out, "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
|
||||
guid->b[3], guid->b[2], guid->b[1], guid->b[0],
|
||||
guid->b[5], guid->b[4], guid->b[7], guid->b[6],
|
||||
guid->b[8], guid->b[9], guid->b[10], guid->b[11],
|
||||
guid->b[12], guid->b[13], guid->b[14], guid->b[15]);
|
||||
sprintf(out, "%pUl", guid->b);
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -361,7 +361,7 @@ typedef struct elf64_shdr {
|
||||
#define NT_PPC_VSX 0x102 /* PowerPC VSX registers */
|
||||
#define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */
|
||||
#define NT_386_IOPERM 0x201 /* x86 io permission bitmap (1=deny) */
|
||||
#define NT_PRXSTATUS 0x300 /* s390 upper register halves */
|
||||
#define NT_S390_HIGH_GPRS 0x300 /* s390 upper register halves */
|
||||
|
||||
|
||||
/* Note header in a PT_NOTE section */
|
||||
|
||||
@@ -42,6 +42,8 @@ enum enclosure_status {
|
||||
ENCLOSURE_STATUS_NOT_INSTALLED,
|
||||
ENCLOSURE_STATUS_UNKNOWN,
|
||||
ENCLOSURE_STATUS_UNAVAILABLE,
|
||||
/* last element for counting purposes */
|
||||
ENCLOSURE_STATUS_MAX
|
||||
};
|
||||
|
||||
/* SFF-8485 activity light settings */
|
||||
|
||||
@@ -34,6 +34,11 @@ static inline long IS_ERR(const void *ptr)
|
||||
return IS_ERR_VALUE((unsigned long)ptr);
|
||||
}
|
||||
|
||||
static inline long IS_ERR_OR_NULL(const void *ptr)
|
||||
{
|
||||
return !ptr || IS_ERR_VALUE((unsigned long)ptr);
|
||||
}
|
||||
|
||||
/**
|
||||
* ERR_CAST - Explicitly cast an error-valued pointer to another pointer type
|
||||
* @ptr: The pointer to cast.
|
||||
|
||||
@@ -97,7 +97,7 @@ struct fid {
|
||||
* @get_name: find the name for a given inode in a given directory
|
||||
* @get_parent: find the parent of a given directory
|
||||
*
|
||||
* See Documentation/filesystems/Exporting for details on how to use
|
||||
* See Documentation/filesystems/nfs/Exporting for details on how to use
|
||||
* this interface correctly.
|
||||
*
|
||||
* encode_fh:
|
||||
|
||||
@@ -72,6 +72,8 @@ struct ext3_sb_info {
|
||||
struct inode * s_journal_inode;
|
||||
struct journal_s * s_journal;
|
||||
struct list_head s_orphan;
|
||||
struct mutex s_orphan_lock;
|
||||
struct mutex s_resize_lock;
|
||||
unsigned long s_commit_interval;
|
||||
struct block_device *journal_bdev;
|
||||
#ifdef CONFIG_JBD_DEBUG
|
||||
|
||||
@@ -44,13 +44,13 @@
|
||||
|
||||
#define EXT3_DATA_TRANS_BLOCKS(sb) (EXT3_SINGLEDATA_TRANS_BLOCKS + \
|
||||
EXT3_XATTR_TRANS_BLOCKS - 2 + \
|
||||
2*EXT3_QUOTA_TRANS_BLOCKS(sb))
|
||||
EXT3_MAXQUOTAS_TRANS_BLOCKS(sb))
|
||||
|
||||
/* Delete operations potentially hit one directory's namespace plus an
|
||||
* entire inode, plus arbitrary amounts of bitmap/indirection data. Be
|
||||
* generous. We can grow the delete transaction later if necessary. */
|
||||
|
||||
#define EXT3_DELETE_TRANS_BLOCKS(sb) (2 * EXT3_DATA_TRANS_BLOCKS(sb) + 64)
|
||||
#define EXT3_DELETE_TRANS_BLOCKS(sb) (EXT3_MAXQUOTAS_TRANS_BLOCKS(sb) + 64)
|
||||
|
||||
/* Define an arbitrary limit for the amount of data we will anticipate
|
||||
* writing to any given transaction. For unbounded transactions such as
|
||||
@@ -86,6 +86,9 @@
|
||||
#define EXT3_QUOTA_INIT_BLOCKS(sb) 0
|
||||
#define EXT3_QUOTA_DEL_BLOCKS(sb) 0
|
||||
#endif
|
||||
#define EXT3_MAXQUOTAS_TRANS_BLOCKS(sb) (MAXQUOTAS*EXT3_QUOTA_TRANS_BLOCKS(sb))
|
||||
#define EXT3_MAXQUOTAS_INIT_BLOCKS(sb) (MAXQUOTAS*EXT3_QUOTA_INIT_BLOCKS(sb))
|
||||
#define EXT3_MAXQUOTAS_DEL_BLOCKS(sb) (MAXQUOTAS*EXT3_QUOTA_DEL_BLOCKS(sb))
|
||||
|
||||
int
|
||||
ext3_mark_iloc_dirty(handle_t *handle,
|
||||
|
||||
@@ -62,5 +62,7 @@ struct fiemap {
|
||||
#define FIEMAP_EXTENT_MERGED 0x00001000 /* File does not natively
|
||||
* support extents. Result
|
||||
* merged for efficiency. */
|
||||
#define FIEMAP_EXTENT_SHARED 0x00002000 /* Space shared with other
|
||||
* files. */
|
||||
|
||||
#endif /* _LINUX_FIEMAP_H */
|
||||
|
||||
@@ -18,11 +18,9 @@ extern void drop_file_write_access(struct file *file);
|
||||
struct file_operations;
|
||||
struct vfsmount;
|
||||
struct dentry;
|
||||
extern int init_file(struct file *, struct vfsmount *mnt,
|
||||
struct dentry *dentry, fmode_t mode,
|
||||
const struct file_operations *fop);
|
||||
extern struct file *alloc_file(struct vfsmount *, struct dentry *dentry,
|
||||
fmode_t mode, const struct file_operations *fop);
|
||||
struct path;
|
||||
extern struct file *alloc_file(struct path *, fmode_t mode,
|
||||
const struct file_operations *fop);
|
||||
|
||||
static inline void fput_light(struct file *file, int fput_needed)
|
||||
{
|
||||
|
||||
@@ -340,6 +340,9 @@ struct fw_cdev_send_response {
|
||||
* The @closure field is passed back to userspace in the response event.
|
||||
* The @handle field is an out parameter, returning a handle to the allocated
|
||||
* range to be used for later deallocation of the range.
|
||||
*
|
||||
* The address range is allocated on all local nodes. The address allocation
|
||||
* is exclusive except for the FCP command and response registers.
|
||||
*/
|
||||
struct fw_cdev_allocate {
|
||||
__u64 offset;
|
||||
|
||||
@@ -248,8 +248,8 @@ typedef void (*fw_transaction_callback_t)(struct fw_card *card, int rcode,
|
||||
void *data, size_t length,
|
||||
void *callback_data);
|
||||
/*
|
||||
* Important note: The callback must guarantee that either fw_send_response()
|
||||
* or kfree() is called on the @request.
|
||||
* Important note: Except for the FCP registers, the callback must guarantee
|
||||
* that either fw_send_response() or kfree() is called on the @request.
|
||||
*/
|
||||
typedef void (*fw_address_callback_t)(struct fw_card *card,
|
||||
struct fw_request *request,
|
||||
|
||||
+29
-41
@@ -152,6 +152,7 @@ struct inodes_stat_t {
|
||||
#define WRITE_SYNC_PLUG (WRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_NOIDLE))
|
||||
#define WRITE_SYNC (WRITE_SYNC_PLUG | (1 << BIO_RW_UNPLUG))
|
||||
#define WRITE_ODIRECT_PLUG (WRITE | (1 << BIO_RW_SYNCIO))
|
||||
#define WRITE_META (WRITE | (1 << BIO_RW_META))
|
||||
#define SWRITE_SYNC_PLUG \
|
||||
(SWRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_NOIDLE))
|
||||
#define SWRITE_SYNC (SWRITE_SYNC_PLUG | (1 << BIO_RW_UNPLUG))
|
||||
@@ -1094,10 +1095,6 @@ struct file_lock {
|
||||
|
||||
extern void send_sigio(struct fown_struct *fown, int fd, int band);
|
||||
|
||||
/* fs/sync.c */
|
||||
extern int do_sync_mapping_range(struct address_space *mapping, loff_t offset,
|
||||
loff_t endbyte, unsigned int flags);
|
||||
|
||||
#ifdef CONFIG_FILE_LOCKING
|
||||
extern int fcntl_getlk(struct file *, struct flock __user *);
|
||||
extern int fcntl_setlk(unsigned int, struct file *, unsigned int,
|
||||
@@ -1590,7 +1587,7 @@ struct super_operations {
|
||||
* until that flag is cleared. I_WILL_FREE, I_FREEING and I_CLEAR are set at
|
||||
* various stages of removing an inode.
|
||||
*
|
||||
* Two bits are used for locking and completion notification, I_LOCK and I_SYNC.
|
||||
* Two bits are used for locking and completion notification, I_NEW and I_SYNC.
|
||||
*
|
||||
* I_DIRTY_SYNC Inode is dirty, but doesn't have to be written on
|
||||
* fdatasync(). i_atime is the usual cause.
|
||||
@@ -1599,8 +1596,14 @@ struct super_operations {
|
||||
* don't have to write inode on fdatasync() when only
|
||||
* mtime has changed in it.
|
||||
* I_DIRTY_PAGES Inode has dirty pages. Inode itself may be clean.
|
||||
* I_NEW get_new_inode() sets i_state to I_LOCK|I_NEW. Both
|
||||
* are cleared by unlock_new_inode(), called from iget().
|
||||
* I_NEW Serves as both a mutex and completion notification.
|
||||
* New inodes set I_NEW. If two processes both create
|
||||
* the same inode, one of them will release its inode and
|
||||
* wait for I_NEW to be released before returning.
|
||||
* Inodes in I_WILL_FREE, I_FREEING or I_CLEAR state can
|
||||
* also cause waiting on I_NEW, without I_NEW actually
|
||||
* being set. find_inode() uses this to prevent returning
|
||||
* nearly-dead inodes.
|
||||
* I_WILL_FREE Must be set when calling write_inode_now() if i_count
|
||||
* is zero. I_FREEING must be set when I_WILL_FREE is
|
||||
* cleared.
|
||||
@@ -1614,35 +1617,23 @@ struct super_operations {
|
||||
* prohibited for many purposes. iget() must wait for
|
||||
* the inode to be completely released, then create it
|
||||
* anew. Other functions will just ignore such inodes,
|
||||
* if appropriate. I_LOCK is used for waiting.
|
||||
* if appropriate. I_NEW is used for waiting.
|
||||
*
|
||||
* I_LOCK Serves as both a mutex and completion notification.
|
||||
* New inodes set I_LOCK. If two processes both create
|
||||
* the same inode, one of them will release its inode and
|
||||
* wait for I_LOCK to be released before returning.
|
||||
* Inodes in I_WILL_FREE, I_FREEING or I_CLEAR state can
|
||||
* also cause waiting on I_LOCK, without I_LOCK actually
|
||||
* being set. find_inode() uses this to prevent returning
|
||||
* nearly-dead inodes.
|
||||
* I_SYNC Similar to I_LOCK, but limited in scope to writeback
|
||||
* of inode dirty data. Having a separate lock for this
|
||||
* purpose reduces latency and prevents some filesystem-
|
||||
* specific deadlocks.
|
||||
* I_SYNC Synchonized write of dirty inode data. The bits is
|
||||
* set during data writeback, and cleared with a wakeup
|
||||
* on the bit address once it is done.
|
||||
*
|
||||
* Q: What is the difference between I_WILL_FREE and I_FREEING?
|
||||
* Q: igrab() only checks on (I_FREEING|I_WILL_FREE). Should it also check on
|
||||
* I_CLEAR? If not, why?
|
||||
*/
|
||||
#define I_DIRTY_SYNC 1
|
||||
#define I_DIRTY_DATASYNC 2
|
||||
#define I_DIRTY_PAGES 4
|
||||
#define I_NEW 8
|
||||
#define __I_NEW 3
|
||||
#define I_NEW (1 << __I_NEW)
|
||||
#define I_WILL_FREE 16
|
||||
#define I_FREEING 32
|
||||
#define I_CLEAR 64
|
||||
#define __I_LOCK 7
|
||||
#define I_LOCK (1 << __I_LOCK)
|
||||
#define __I_SYNC 8
|
||||
#define __I_SYNC 7
|
||||
#define I_SYNC (1 << __I_SYNC)
|
||||
|
||||
#define I_DIRTY (I_DIRTY_SYNC | I_DIRTY_DATASYNC | I_DIRTY_PAGES)
|
||||
@@ -2189,7 +2180,6 @@ static inline void insert_inode_hash(struct inode *inode) {
|
||||
__insert_inode_hash(inode, inode->i_ino);
|
||||
}
|
||||
|
||||
extern struct file * get_empty_filp(void);
|
||||
extern void file_move(struct file *f, struct list_head *list);
|
||||
extern void file_kill(struct file *f);
|
||||
#ifdef CONFIG_BLOCK
|
||||
@@ -2264,9 +2254,11 @@ ssize_t __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode,
|
||||
int lock_type);
|
||||
|
||||
enum {
|
||||
DIO_LOCKING = 1, /* need locking between buffered and direct access */
|
||||
DIO_NO_LOCKING, /* bdev; no locking at all between buffered/direct */
|
||||
DIO_OWN_LOCKING, /* filesystem locks buffered and direct internally */
|
||||
/* need locking between buffered and direct access */
|
||||
DIO_LOCKING = 0x01,
|
||||
|
||||
/* filesystem does not support filling holes */
|
||||
DIO_SKIP_HOLES = 0x02,
|
||||
};
|
||||
|
||||
static inline ssize_t blockdev_direct_IO(int rw, struct kiocb *iocb,
|
||||
@@ -2275,7 +2267,8 @@ static inline ssize_t blockdev_direct_IO(int rw, struct kiocb *iocb,
|
||||
dio_iodone_t end_io)
|
||||
{
|
||||
return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset,
|
||||
nr_segs, get_block, end_io, DIO_LOCKING);
|
||||
nr_segs, get_block, end_io,
|
||||
DIO_LOCKING | DIO_SKIP_HOLES);
|
||||
}
|
||||
|
||||
static inline ssize_t blockdev_direct_IO_no_locking(int rw, struct kiocb *iocb,
|
||||
@@ -2284,16 +2277,7 @@ static inline ssize_t blockdev_direct_IO_no_locking(int rw, struct kiocb *iocb,
|
||||
dio_iodone_t end_io)
|
||||
{
|
||||
return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset,
|
||||
nr_segs, get_block, end_io, DIO_NO_LOCKING);
|
||||
}
|
||||
|
||||
static inline ssize_t blockdev_direct_IO_own_locking(int rw, struct kiocb *iocb,
|
||||
struct inode *inode, struct block_device *bdev, const struct iovec *iov,
|
||||
loff_t offset, unsigned long nr_segs, get_block_t get_block,
|
||||
dio_iodone_t end_io)
|
||||
{
|
||||
return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset,
|
||||
nr_segs, get_block, end_io, DIO_OWN_LOCKING);
|
||||
nr_segs, get_block, end_io, 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -2313,6 +2297,7 @@ extern const struct inode_operations page_symlink_inode_operations;
|
||||
extern int generic_readlink(struct dentry *, char __user *, int);
|
||||
extern void generic_fillattr(struct inode *, struct kstat *);
|
||||
extern int vfs_getattr(struct vfsmount *, struct dentry *, struct kstat *);
|
||||
void __inode_add_bytes(struct inode *inode, loff_t bytes);
|
||||
void inode_add_bytes(struct inode *inode, loff_t bytes);
|
||||
void inode_sub_bytes(struct inode *inode, loff_t bytes);
|
||||
loff_t inode_get_bytes(struct inode *inode);
|
||||
@@ -2478,5 +2463,8 @@ int proc_nr_files(struct ctl_table *table, int write,
|
||||
|
||||
int __init get_filesystem_list(char *buf);
|
||||
|
||||
#define ACC_MODE(x) ("\004\002\006\006"[(x)&O_ACCMODE])
|
||||
#define OPEN_FMODE(flag) ((__force fmode_t)((flag + 1) & O_ACCMODE))
|
||||
|
||||
#endif /* __KERNEL__ */
|
||||
#endif /* _LINUX_FS_H */
|
||||
|
||||
@@ -8,10 +8,8 @@
|
||||
#include <linux/fs.h>
|
||||
|
||||
/* externs for fs/stack.c */
|
||||
extern void fsstack_copy_attr_all(struct inode *dest, const struct inode *src,
|
||||
int (*get_nlinks)(struct inode *));
|
||||
|
||||
extern void fsstack_copy_inode_size(struct inode *dst, const struct inode *src);
|
||||
extern void fsstack_copy_attr_all(struct inode *dest, const struct inode *src);
|
||||
extern void fsstack_copy_inode_size(struct inode *dst, struct inode *src);
|
||||
|
||||
/* inlines */
|
||||
static inline void fsstack_copy_attr_atime(struct inode *dest,
|
||||
|
||||
@@ -74,7 +74,12 @@ struct spi_device;
|
||||
struct fsl_spi_platform_data {
|
||||
u32 initial_spmode; /* initial SPMODE value */
|
||||
s16 bus_num;
|
||||
bool qe_mode;
|
||||
unsigned int flags;
|
||||
#define SPI_QE_CPU_MODE (1 << 0) /* QE CPU ("PIO") mode */
|
||||
#define SPI_CPM_MODE (1 << 1) /* CPM/QE ("DMA") mode */
|
||||
#define SPI_CPM1 (1 << 2) /* SPI unit is in CPM1 block */
|
||||
#define SPI_CPM2 (1 << 3) /* SPI unit is in CPM2 block */
|
||||
#define SPI_QE (1 << 4) /* SPI unit is in QE block */
|
||||
/* board specific information */
|
||||
u16 max_chipselect;
|
||||
void (*cs_control)(struct spi_device *spi, bool on);
|
||||
@@ -90,6 +95,10 @@ struct mpc8xx_pcmcia_ops {
|
||||
* lead to a deep sleep (i.e. power removed from the core,
|
||||
* instead of just the clock).
|
||||
*/
|
||||
#if defined(CONFIG_PPC_83xx) && defined(CONFIG_SUSPEND)
|
||||
int fsl_deep_sleep(void);
|
||||
#else
|
||||
static inline int fsl_deep_sleep(void) { return 0; }
|
||||
#endif
|
||||
|
||||
#endif /* _FSL_DEVICE_H_ */
|
||||
|
||||
@@ -57,6 +57,7 @@ struct trace_iterator {
|
||||
/* The below is zeroed out in pipe_read */
|
||||
struct trace_seq seq;
|
||||
struct trace_entry *ent;
|
||||
int leftover;
|
||||
int cpu;
|
||||
u64 ts;
|
||||
|
||||
@@ -130,7 +131,7 @@ struct ftrace_event_call {
|
||||
void *mod;
|
||||
void *data;
|
||||
|
||||
atomic_t profile_count;
|
||||
int profile_count;
|
||||
int (*profile_enable)(struct ftrace_event_call *);
|
||||
void (*profile_disable)(struct ftrace_event_call *);
|
||||
};
|
||||
@@ -157,7 +158,7 @@ enum {
|
||||
FILTER_PTR_STRING,
|
||||
};
|
||||
|
||||
extern int trace_define_common_fields(struct ftrace_event_call *call);
|
||||
extern int trace_event_raw_init(struct ftrace_event_call *call);
|
||||
extern int trace_define_field(struct ftrace_event_call *call, const char *type,
|
||||
const char *name, int offset, int size,
|
||||
int is_signed, int filter_type);
|
||||
|
||||
+10
-31
@@ -1,36 +1,15 @@
|
||||
/*
|
||||
* include/linux/generic_acl.h
|
||||
*
|
||||
* (C) 2005 Andreas Gruenbacher <agruen@suse.de>
|
||||
*
|
||||
* This file is released under the GPL.
|
||||
*/
|
||||
#ifndef LINUX_GENERIC_ACL_H
|
||||
#define LINUX_GENERIC_ACL_H
|
||||
|
||||
#ifndef GENERIC_ACL_H
|
||||
#define GENERIC_ACL_H
|
||||
#include <linux/xattr.h>
|
||||
|
||||
#include <linux/posix_acl.h>
|
||||
#include <linux/posix_acl_xattr.h>
|
||||
struct inode;
|
||||
|
||||
/**
|
||||
* struct generic_acl_operations - filesystem operations
|
||||
*
|
||||
* Filesystems must make these operations available to the generic
|
||||
* operations.
|
||||
*/
|
||||
struct generic_acl_operations {
|
||||
struct posix_acl *(*getacl)(struct inode *, int);
|
||||
void (*setacl)(struct inode *, int, struct posix_acl *);
|
||||
};
|
||||
extern struct xattr_handler generic_acl_access_handler;
|
||||
extern struct xattr_handler generic_acl_default_handler;
|
||||
|
||||
size_t generic_acl_list(struct inode *, struct generic_acl_operations *, int,
|
||||
char *, size_t);
|
||||
int generic_acl_get(struct inode *, struct generic_acl_operations *, int,
|
||||
void *, size_t);
|
||||
int generic_acl_set(struct inode *, struct generic_acl_operations *, int,
|
||||
const void *, size_t);
|
||||
int generic_acl_init(struct inode *, struct inode *,
|
||||
struct generic_acl_operations *);
|
||||
int generic_acl_chmod(struct inode *, struct generic_acl_operations *);
|
||||
int generic_acl_init(struct inode *, struct inode *);
|
||||
int generic_acl_chmod(struct inode *);
|
||||
int generic_check_acl(struct inode *inode, int mask);
|
||||
|
||||
#endif
|
||||
#endif /* LINUX_GENERIC_ACL_H */
|
||||
|
||||
@@ -256,9 +256,9 @@ extern struct hd_struct *disk_map_sector_rcu(struct gendisk *disk,
|
||||
#define part_stat_read(part, field) \
|
||||
({ \
|
||||
typeof((part)->dkstats->field) res = 0; \
|
||||
int i; \
|
||||
for_each_possible_cpu(i) \
|
||||
res += per_cpu_ptr((part)->dkstats, i)->field; \
|
||||
unsigned int _cpu; \
|
||||
for_each_possible_cpu(_cpu) \
|
||||
res += per_cpu_ptr((part)->dkstats, _cpu)->field; \
|
||||
res; \
|
||||
})
|
||||
|
||||
|
||||
@@ -99,6 +99,12 @@ static inline int gpio_export_link(struct device *dev, const char *name,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
static inline int gpio_sysfs_set_active_low(unsigned gpio, int value)
|
||||
{
|
||||
/* GPIO can never have been requested */
|
||||
WARN_ON(1);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
static inline void gpio_unexport(unsigned gpio)
|
||||
{
|
||||
|
||||
@@ -46,7 +46,7 @@ void kmap_flush_unused(void);
|
||||
|
||||
static inline unsigned int nr_free_highpages(void) { return 0; }
|
||||
|
||||
#define totalhigh_pages 0
|
||||
#define totalhigh_pages 0UL
|
||||
|
||||
#ifndef ARCH_HAS_KMAP
|
||||
static inline void *kmap(struct page *page)
|
||||
|
||||
+10
-48
@@ -162,18 +162,23 @@ struct hrtimer_clock_base {
|
||||
* @expires_next: absolute time of the next event which was scheduled
|
||||
* via clock_set_next_event()
|
||||
* @hres_active: State of high resolution mode
|
||||
* @check_clocks: Indictator, when set evaluate time source and clock
|
||||
* event devices whether high resolution mode can be
|
||||
* activated.
|
||||
* @nr_events: Total number of timer interrupt events
|
||||
* @hang_detected: The last hrtimer interrupt detected a hang
|
||||
* @nr_events: Total number of hrtimer interrupt events
|
||||
* @nr_retries: Total number of hrtimer interrupt retries
|
||||
* @nr_hangs: Total number of hrtimer interrupt hangs
|
||||
* @max_hang_time: Maximum time spent in hrtimer_interrupt
|
||||
*/
|
||||
struct hrtimer_cpu_base {
|
||||
spinlock_t lock;
|
||||
raw_spinlock_t lock;
|
||||
struct hrtimer_clock_base clock_base[HRTIMER_MAX_CLOCK_BASES];
|
||||
#ifdef CONFIG_HIGH_RES_TIMERS
|
||||
ktime_t expires_next;
|
||||
int hres_active;
|
||||
int hang_detected;
|
||||
unsigned long nr_events;
|
||||
unsigned long nr_retries;
|
||||
unsigned long nr_hangs;
|
||||
ktime_t max_hang_time;
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -435,47 +440,4 @@ extern u64 ktime_divns(const ktime_t kt, s64 div);
|
||||
/* Show pending timers: */
|
||||
extern void sysrq_timer_list_show(void);
|
||||
|
||||
/*
|
||||
* Timer-statistics info:
|
||||
*/
|
||||
#ifdef CONFIG_TIMER_STATS
|
||||
|
||||
extern void timer_stats_update_stats(void *timer, pid_t pid, void *startf,
|
||||
void *timerf, char *comm,
|
||||
unsigned int timer_flag);
|
||||
|
||||
static inline void timer_stats_account_hrtimer(struct hrtimer *timer)
|
||||
{
|
||||
if (likely(!timer_stats_active))
|
||||
return;
|
||||
timer_stats_update_stats(timer, timer->start_pid, timer->start_site,
|
||||
timer->function, timer->start_comm, 0);
|
||||
}
|
||||
|
||||
extern void __timer_stats_hrtimer_set_start_info(struct hrtimer *timer,
|
||||
void *addr);
|
||||
|
||||
static inline void timer_stats_hrtimer_set_start_info(struct hrtimer *timer)
|
||||
{
|
||||
__timer_stats_hrtimer_set_start_info(timer, __builtin_return_address(0));
|
||||
}
|
||||
|
||||
static inline void timer_stats_hrtimer_clear_start_info(struct hrtimer *timer)
|
||||
{
|
||||
timer->start_site = NULL;
|
||||
}
|
||||
#else
|
||||
static inline void timer_stats_account_hrtimer(struct hrtimer *timer)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void timer_stats_hrtimer_set_start_info(struct hrtimer *timer)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void timer_stats_hrtimer_clear_start_info(struct hrtimer *timer)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -23,6 +23,12 @@ void reset_vma_resv_huge_pages(struct vm_area_struct *vma);
|
||||
int hugetlb_sysctl_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *);
|
||||
int hugetlb_overcommit_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *);
|
||||
int hugetlb_treat_movable_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *);
|
||||
|
||||
#ifdef CONFIG_NUMA
|
||||
int hugetlb_mempolicy_sysctl_handler(struct ctl_table *, int,
|
||||
void __user *, size_t *, loff_t *);
|
||||
#endif
|
||||
|
||||
int copy_hugetlb_page_range(struct mm_struct *, struct mm_struct *, struct vm_area_struct *);
|
||||
int follow_hugetlb_page(struct mm_struct *, struct vm_area_struct *,
|
||||
struct page **, struct vm_area_struct **,
|
||||
|
||||
@@ -20,19 +20,18 @@ enum {
|
||||
|
||||
#ifdef CONFIG_HAVE_HW_BREAKPOINT
|
||||
|
||||
/* As it's for in-kernel or ptrace use, we want it to be pinned */
|
||||
#define DEFINE_BREAKPOINT_ATTR(name) \
|
||||
struct perf_event_attr name = { \
|
||||
.type = PERF_TYPE_BREAKPOINT, \
|
||||
.size = sizeof(name), \
|
||||
.pinned = 1, \
|
||||
};
|
||||
|
||||
static inline void hw_breakpoint_init(struct perf_event_attr *attr)
|
||||
{
|
||||
memset(attr, 0, sizeof(*attr));
|
||||
|
||||
attr->type = PERF_TYPE_BREAKPOINT;
|
||||
attr->size = sizeof(*attr);
|
||||
/*
|
||||
* As it's for in-kernel or ptrace use, we want it to be pinned
|
||||
* and to call its callback every hits.
|
||||
*/
|
||||
attr->pinned = 1;
|
||||
attr->sample_period = 1;
|
||||
}
|
||||
|
||||
static inline unsigned long hw_breakpoint_addr(struct perf_event *bp)
|
||||
@@ -52,27 +51,24 @@ static inline int hw_breakpoint_len(struct perf_event *bp)
|
||||
|
||||
extern struct perf_event *
|
||||
register_user_hw_breakpoint(struct perf_event_attr *attr,
|
||||
perf_callback_t triggered,
|
||||
perf_overflow_handler_t triggered,
|
||||
struct task_struct *tsk);
|
||||
|
||||
/* FIXME: only change from the attr, and don't unregister */
|
||||
extern struct perf_event *
|
||||
modify_user_hw_breakpoint(struct perf_event *bp,
|
||||
struct perf_event_attr *attr,
|
||||
perf_callback_t triggered,
|
||||
struct task_struct *tsk);
|
||||
extern int
|
||||
modify_user_hw_breakpoint(struct perf_event *bp, struct perf_event_attr *attr);
|
||||
|
||||
/*
|
||||
* Kernel breakpoints are not associated with any particular thread.
|
||||
*/
|
||||
extern struct perf_event *
|
||||
register_wide_hw_breakpoint_cpu(struct perf_event_attr *attr,
|
||||
perf_callback_t triggered,
|
||||
perf_overflow_handler_t triggered,
|
||||
int cpu);
|
||||
|
||||
extern struct perf_event **
|
||||
register_wide_hw_breakpoint(struct perf_event_attr *attr,
|
||||
perf_callback_t triggered);
|
||||
perf_overflow_handler_t triggered);
|
||||
|
||||
extern int register_perf_hw_breakpoint(struct perf_event *bp);
|
||||
extern int __register_perf_hw_breakpoint(struct perf_event *bp);
|
||||
@@ -93,20 +89,18 @@ static inline struct arch_hw_breakpoint *counter_arch_bp(struct perf_event *bp)
|
||||
|
||||
static inline struct perf_event *
|
||||
register_user_hw_breakpoint(struct perf_event_attr *attr,
|
||||
perf_callback_t triggered,
|
||||
perf_overflow_handler_t triggered,
|
||||
struct task_struct *tsk) { return NULL; }
|
||||
static inline struct perf_event *
|
||||
static inline int
|
||||
modify_user_hw_breakpoint(struct perf_event *bp,
|
||||
struct perf_event_attr *attr,
|
||||
perf_callback_t triggered,
|
||||
struct task_struct *tsk) { return NULL; }
|
||||
struct perf_event_attr *attr) { return -ENOSYS; }
|
||||
static inline struct perf_event *
|
||||
register_wide_hw_breakpoint_cpu(struct perf_event_attr *attr,
|
||||
perf_callback_t triggered,
|
||||
perf_overflow_handler_t triggered,
|
||||
int cpu) { return NULL; }
|
||||
static inline struct perf_event **
|
||||
register_wide_hw_breakpoint(struct perf_event_attr *attr,
|
||||
perf_callback_t triggered) { return NULL; }
|
||||
perf_overflow_handler_t triggered) { return NULL; }
|
||||
static inline int
|
||||
register_perf_hw_breakpoint(struct perf_event *bp) { return -ENOSYS; }
|
||||
static inline int
|
||||
|
||||
+3
-89
@@ -110,7 +110,7 @@ extern s32 i2c_smbus_write_i2c_block_data(struct i2c_client *client,
|
||||
* @driver: Device driver model driver
|
||||
* @id_table: List of I2C devices supported by this driver
|
||||
* @detect: Callback for device detection
|
||||
* @address_data: The I2C addresses to probe (for detect)
|
||||
* @address_list: The I2C addresses to probe (for detect)
|
||||
* @clients: List of detected clients we created (for i2c-core use only)
|
||||
*
|
||||
* The driver.owner field should be set to the module owner of this driver.
|
||||
@@ -161,8 +161,8 @@ struct i2c_driver {
|
||||
const struct i2c_device_id *id_table;
|
||||
|
||||
/* Device detection callback for automatic device creation */
|
||||
int (*detect)(struct i2c_client *, int kind, struct i2c_board_info *);
|
||||
const struct i2c_client_address_data *address_data;
|
||||
int (*detect)(struct i2c_client *, struct i2c_board_info *);
|
||||
const unsigned short *address_list;
|
||||
struct list_head clients;
|
||||
};
|
||||
#define to_i2c_driver(d) container_of(d, struct i2c_driver, driver)
|
||||
@@ -391,14 +391,6 @@ static inline void i2c_unlock_adapter(struct i2c_adapter *adapter)
|
||||
#define I2C_CLASS_DDC (1<<3) /* DDC bus on graphics adapters */
|
||||
#define I2C_CLASS_SPD (1<<7) /* SPD EEPROMs and similar */
|
||||
|
||||
/* i2c_client_address_data is the struct for holding default client
|
||||
* addresses for a driver and for the parameters supplied on the
|
||||
* command line
|
||||
*/
|
||||
struct i2c_client_address_data {
|
||||
const unsigned short *normal_i2c;
|
||||
};
|
||||
|
||||
/* Internal numbers to terminate lists */
|
||||
#define I2C_CLIENT_END 0xfffeU
|
||||
|
||||
@@ -576,82 +568,4 @@ union i2c_smbus_data {
|
||||
#define I2C_SMBUS_BLOCK_PROC_CALL 7 /* SMBus 2.0 */
|
||||
#define I2C_SMBUS_I2C_BLOCK_DATA 8
|
||||
|
||||
|
||||
#ifdef __KERNEL__
|
||||
|
||||
/* These defines are used for probing i2c client addresses */
|
||||
/* The length of the option lists */
|
||||
#define I2C_CLIENT_MAX_OPTS 48
|
||||
|
||||
/* Default fill of many variables */
|
||||
#define I2C_CLIENT_DEFAULTS {I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
|
||||
I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
|
||||
I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
|
||||
I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
|
||||
I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
|
||||
I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
|
||||
I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
|
||||
I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
|
||||
I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
|
||||
I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
|
||||
I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
|
||||
I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
|
||||
I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
|
||||
I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
|
||||
I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
|
||||
I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END}
|
||||
|
||||
/* I2C_CLIENT_MODULE_PARM creates a module parameter, and puts it in the
|
||||
module header */
|
||||
|
||||
#define I2C_CLIENT_MODULE_PARM(var,desc) \
|
||||
static unsigned short var[I2C_CLIENT_MAX_OPTS] = I2C_CLIENT_DEFAULTS; \
|
||||
static unsigned int var##_num; \
|
||||
module_param_array(var, short, &var##_num, 0); \
|
||||
MODULE_PARM_DESC(var, desc)
|
||||
|
||||
#define I2C_CLIENT_INSMOD_COMMON \
|
||||
static const struct i2c_client_address_data addr_data = { \
|
||||
.normal_i2c = normal_i2c, \
|
||||
}
|
||||
|
||||
/* These are the ones you want to use in your own drivers. Pick the one
|
||||
which matches the number of devices the driver differenciates between. */
|
||||
#define I2C_CLIENT_INSMOD \
|
||||
I2C_CLIENT_INSMOD_COMMON
|
||||
|
||||
#define I2C_CLIENT_INSMOD_1(chip1) \
|
||||
enum chips { any_chip, chip1 }; \
|
||||
I2C_CLIENT_INSMOD_COMMON
|
||||
|
||||
#define I2C_CLIENT_INSMOD_2(chip1, chip2) \
|
||||
enum chips { any_chip, chip1, chip2 }; \
|
||||
I2C_CLIENT_INSMOD_COMMON
|
||||
|
||||
#define I2C_CLIENT_INSMOD_3(chip1, chip2, chip3) \
|
||||
enum chips { any_chip, chip1, chip2, chip3 }; \
|
||||
I2C_CLIENT_INSMOD_COMMON
|
||||
|
||||
#define I2C_CLIENT_INSMOD_4(chip1, chip2, chip3, chip4) \
|
||||
enum chips { any_chip, chip1, chip2, chip3, chip4 }; \
|
||||
I2C_CLIENT_INSMOD_COMMON
|
||||
|
||||
#define I2C_CLIENT_INSMOD_5(chip1, chip2, chip3, chip4, chip5) \
|
||||
enum chips { any_chip, chip1, chip2, chip3, chip4, chip5 }; \
|
||||
I2C_CLIENT_INSMOD_COMMON
|
||||
|
||||
#define I2C_CLIENT_INSMOD_6(chip1, chip2, chip3, chip4, chip5, chip6) \
|
||||
enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6 }; \
|
||||
I2C_CLIENT_INSMOD_COMMON
|
||||
|
||||
#define I2C_CLIENT_INSMOD_7(chip1, chip2, chip3, chip4, chip5, chip6, chip7) \
|
||||
enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6, \
|
||||
chip7 }; \
|
||||
I2C_CLIENT_INSMOD_COMMON
|
||||
|
||||
#define I2C_CLIENT_INSMOD_8(chip1, chip2, chip3, chip4, chip5, chip6, chip7, chip8) \
|
||||
enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6, \
|
||||
chip7, chip8 }; \
|
||||
I2C_CLIENT_INSMOD_COMMON
|
||||
#endif /* __KERNEL__ */
|
||||
#endif /* _LINUX_I2C_H */
|
||||
|
||||
@@ -89,4 +89,16 @@ struct adp5588_kpad_platform_data {
|
||||
unsigned short unlock_key2; /* Unlock Key 2 */
|
||||
};
|
||||
|
||||
struct adp5588_gpio_platform_data {
|
||||
unsigned gpio_start; /* GPIO Chip base # */
|
||||
unsigned pullup_dis_mask; /* Pull-Up Disable Mask */
|
||||
int (*setup)(struct i2c_client *client,
|
||||
int gpio, unsigned ngpio,
|
||||
void *context);
|
||||
int (*teardown)(struct i2c_client *client,
|
||||
int gpio, unsigned ngpio,
|
||||
void *context);
|
||||
void *context;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -72,6 +72,21 @@
|
||||
#define TPS_VDCDC1 0x0c
|
||||
# define TPS_ENABLE_LP (1 << 3)
|
||||
#define TPS_VDCDC2 0x0d
|
||||
# define TPS_LP_COREOFF (1 << 7)
|
||||
# define TPS_VCORE_1_8V (7<<4)
|
||||
# define TPS_VCORE_1_5V (6 << 4)
|
||||
# define TPS_VCORE_1_4V (5 << 4)
|
||||
# define TPS_VCORE_1_3V (4 << 4)
|
||||
# define TPS_VCORE_1_2V (3 << 4)
|
||||
# define TPS_VCORE_1_1V (2 << 4)
|
||||
# define TPS_VCORE_1_0V (1 << 4)
|
||||
# define TPS_VCORE_0_85V (0 << 4)
|
||||
# define TPS_VCORE_LP_1_2V (3 << 2)
|
||||
# define TPS_VCORE_LP_1_1V (2 << 2)
|
||||
# define TPS_VCORE_LP_1_0V (1 << 2)
|
||||
# define TPS_VCORE_LP_0_85V (0 << 2)
|
||||
# define TPS_VIB (1 << 1)
|
||||
# define TPS_VCORE_DISCH (1 << 0)
|
||||
#define TPS_VREGS1 0x0e
|
||||
# define TPS_LDO2_ENABLE (1 << 7)
|
||||
# define TPS_LDO2_OFF (1 << 6)
|
||||
@@ -152,6 +167,10 @@ extern int tps65010_config_vregs1(unsigned value);
|
||||
*/
|
||||
extern int tps65013_set_low_pwr(unsigned mode);
|
||||
|
||||
/* tps65010_set_vdcdc2
|
||||
* value to be written to VDCDC2
|
||||
*/
|
||||
extern int tps65010_config_vdcdc2(unsigned value);
|
||||
|
||||
struct i2c_client;
|
||||
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __TWL4030_H_
|
||||
#define __TWL4030_H_
|
||||
#ifndef __TWL_H_
|
||||
#define __TWL_H_
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/input/matrix_keypad.h>
|
||||
@@ -61,28 +61,112 @@
|
||||
#define TWL4030_MODULE_PWMA 0x0E
|
||||
#define TWL4030_MODULE_PWMB 0x0F
|
||||
|
||||
#define TWL5031_MODULE_ACCESSORY 0x10
|
||||
#define TWL5031_MODULE_INTERRUPTS 0x11
|
||||
|
||||
/* Slave 3 (i2c address 0x4b) */
|
||||
#define TWL4030_MODULE_BACKUP 0x10
|
||||
#define TWL4030_MODULE_INT 0x11
|
||||
#define TWL4030_MODULE_PM_MASTER 0x12
|
||||
#define TWL4030_MODULE_PM_RECEIVER 0x13
|
||||
#define TWL4030_MODULE_RTC 0x14
|
||||
#define TWL4030_MODULE_SECURED_REG 0x15
|
||||
#define TWL4030_MODULE_BACKUP 0x12
|
||||
#define TWL4030_MODULE_INT 0x13
|
||||
#define TWL4030_MODULE_PM_MASTER 0x14
|
||||
#define TWL4030_MODULE_PM_RECEIVER 0x15
|
||||
#define TWL4030_MODULE_RTC 0x16
|
||||
#define TWL4030_MODULE_SECURED_REG 0x17
|
||||
|
||||
#define TWL_MODULE_USB TWL4030_MODULE_USB
|
||||
#define TWL_MODULE_AUDIO_VOICE TWL4030_MODULE_AUDIO_VOICE
|
||||
#define TWL_MODULE_PIH TWL4030_MODULE_PIH
|
||||
#define TWL_MODULE_MADC TWL4030_MODULE_MADC
|
||||
#define TWL_MODULE_MAIN_CHARGE TWL4030_MODULE_MAIN_CHARGE
|
||||
#define TWL_MODULE_PM_MASTER TWL4030_MODULE_PM_MASTER
|
||||
#define TWL_MODULE_PM_RECEIVER TWL4030_MODULE_PM_RECEIVER
|
||||
#define TWL_MODULE_RTC TWL4030_MODULE_RTC
|
||||
|
||||
#define GPIO_INTR_OFFSET 0
|
||||
#define KEYPAD_INTR_OFFSET 1
|
||||
#define BCI_INTR_OFFSET 2
|
||||
#define MADC_INTR_OFFSET 3
|
||||
#define USB_INTR_OFFSET 4
|
||||
#define BCI_PRES_INTR_OFFSET 9
|
||||
#define USB_PRES_INTR_OFFSET 10
|
||||
#define RTC_INTR_OFFSET 11
|
||||
|
||||
/*
|
||||
* Offset from TWL6030_IRQ_BASE / pdata->irq_base
|
||||
*/
|
||||
#define PWR_INTR_OFFSET 0
|
||||
#define HOTDIE_INTR_OFFSET 12
|
||||
#define SMPSLDO_INTR_OFFSET 13
|
||||
#define BATDETECT_INTR_OFFSET 14
|
||||
#define SIMDETECT_INTR_OFFSET 15
|
||||
#define MMCDETECT_INTR_OFFSET 16
|
||||
#define GASGAUGE_INTR_OFFSET 17
|
||||
#define USBOTG_INTR_OFFSET 4
|
||||
#define CHARGER_INTR_OFFSET 2
|
||||
#define RSV_INTR_OFFSET 0
|
||||
|
||||
/* INT register offsets */
|
||||
#define REG_INT_STS_A 0x00
|
||||
#define REG_INT_STS_B 0x01
|
||||
#define REG_INT_STS_C 0x02
|
||||
|
||||
#define REG_INT_MSK_LINE_A 0x03
|
||||
#define REG_INT_MSK_LINE_B 0x04
|
||||
#define REG_INT_MSK_LINE_C 0x05
|
||||
|
||||
#define REG_INT_MSK_STS_A 0x06
|
||||
#define REG_INT_MSK_STS_B 0x07
|
||||
#define REG_INT_MSK_STS_C 0x08
|
||||
|
||||
/* MASK INT REG GROUP A */
|
||||
#define TWL6030_PWR_INT_MASK 0x07
|
||||
#define TWL6030_RTC_INT_MASK 0x18
|
||||
#define TWL6030_HOTDIE_INT_MASK 0x20
|
||||
#define TWL6030_SMPSLDOA_INT_MASK 0xC0
|
||||
|
||||
/* MASK INT REG GROUP B */
|
||||
#define TWL6030_SMPSLDOB_INT_MASK 0x01
|
||||
#define TWL6030_BATDETECT_INT_MASK 0x02
|
||||
#define TWL6030_SIMDETECT_INT_MASK 0x04
|
||||
#define TWL6030_MMCDETECT_INT_MASK 0x08
|
||||
#define TWL6030_GPADC_INT_MASK 0x60
|
||||
#define TWL6030_GASGAUGE_INT_MASK 0x80
|
||||
|
||||
/* MASK INT REG GROUP C */
|
||||
#define TWL6030_USBOTG_INT_MASK 0x0F
|
||||
#define TWL6030_CHARGER_CTRL_INT_MASK 0x10
|
||||
#define TWL6030_CHARGER_FAULT_INT_MASK 0x60
|
||||
|
||||
|
||||
#define TWL4030_CLASS_ID 0x4030
|
||||
#define TWL6030_CLASS_ID 0x6030
|
||||
unsigned int twl_rev(void);
|
||||
#define GET_TWL_REV (twl_rev())
|
||||
#define TWL_CLASS_IS(class, id) \
|
||||
static inline int twl_class_is_ ##class(void) \
|
||||
{ \
|
||||
return ((id) == (GET_TWL_REV)) ? 1 : 0; \
|
||||
}
|
||||
|
||||
TWL_CLASS_IS(4030, TWL4030_CLASS_ID)
|
||||
TWL_CLASS_IS(6030, TWL6030_CLASS_ID)
|
||||
|
||||
/*
|
||||
* Read and write single 8-bit registers
|
||||
*/
|
||||
int twl4030_i2c_write_u8(u8 mod_no, u8 val, u8 reg);
|
||||
int twl4030_i2c_read_u8(u8 mod_no, u8 *val, u8 reg);
|
||||
int twl_i2c_write_u8(u8 mod_no, u8 val, u8 reg);
|
||||
int twl_i2c_read_u8(u8 mod_no, u8 *val, u8 reg);
|
||||
|
||||
/*
|
||||
* Read and write several 8-bit registers at once.
|
||||
*
|
||||
* IMPORTANT: For twl4030_i2c_write(), allocate num_bytes + 1
|
||||
* IMPORTANT: For twl_i2c_write(), allocate num_bytes + 1
|
||||
* for the value, and populate your data starting at offset 1.
|
||||
*/
|
||||
int twl4030_i2c_write(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes);
|
||||
int twl4030_i2c_read(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes);
|
||||
int twl_i2c_write(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes);
|
||||
int twl_i2c_read(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes);
|
||||
|
||||
int twl6030_interrupt_unmask(u8 bit_mask, u8 offset);
|
||||
int twl6030_interrupt_mask(u8 bit_mask, u8 offset);
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
@@ -221,6 +305,38 @@ int twl4030_i2c_read(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes);
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* Accessory Interrupts
|
||||
*/
|
||||
#define TWL5031_ACIIMR_LSB 0x05
|
||||
#define TWL5031_ACIIMR_MSB 0x06
|
||||
#define TWL5031_ACIIDR_LSB 0x07
|
||||
#define TWL5031_ACIIDR_MSB 0x08
|
||||
#define TWL5031_ACCISR1 0x0F
|
||||
#define TWL5031_ACCIMR1 0x10
|
||||
#define TWL5031_ACCISR2 0x11
|
||||
#define TWL5031_ACCIMR2 0x12
|
||||
#define TWL5031_ACCSIR 0x13
|
||||
#define TWL5031_ACCEDR1 0x14
|
||||
#define TWL5031_ACCSIHCTRL 0x15
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* Battery Charger Controller
|
||||
*/
|
||||
|
||||
#define TWL5031_INTERRUPTS_BCIISR1 0x0
|
||||
#define TWL5031_INTERRUPTS_BCIIMR1 0x1
|
||||
#define TWL5031_INTERRUPTS_BCIISR2 0x2
|
||||
#define TWL5031_INTERRUPTS_BCIIMR2 0x3
|
||||
#define TWL5031_INTERRUPTS_BCISIR 0x4
|
||||
#define TWL5031_INTERRUPTS_BCIEDR1 0x5
|
||||
#define TWL5031_INTERRUPTS_BCIEDR2 0x6
|
||||
#define TWL5031_INTERRUPTS_BCISIHCTRL 0x7
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
/* Power bus message definitions */
|
||||
|
||||
/* The TWL4030/5030 splits its power-management resources (the various
|
||||
@@ -250,6 +366,7 @@ int twl4030_i2c_read(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes);
|
||||
|
||||
#define RES_TYPE_ALL 0x7
|
||||
|
||||
/* Resource states */
|
||||
#define RES_STATE_WRST 0xF
|
||||
#define RES_STATE_ACTIVE 0xE
|
||||
#define RES_STATE_SLEEP 0x8
|
||||
@@ -310,8 +427,18 @@ int twl4030_i2c_read(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes);
|
||||
#define MSG_SINGULAR(devgrp, id, state) \
|
||||
((devgrp) << 13 | 0 << 12 | (id) << 4 | (state))
|
||||
|
||||
#define MSG_BROADCAST_ALL(devgrp, state) \
|
||||
((devgrp) << 5 | (state))
|
||||
|
||||
#define MSG_BROADCAST_REF MSG_BROADCAST_ALL
|
||||
#define MSG_BROADCAST_PROV MSG_BROADCAST_ALL
|
||||
#define MSG_BROADCAST__CLK_RST MSG_BROADCAST_ALL
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
struct twl4030_clock_init_data {
|
||||
bool ck32k_lowpwr_enable;
|
||||
};
|
||||
|
||||
struct twl4030_bci_platform_data {
|
||||
int *battery_tmp_tbl;
|
||||
unsigned int tblsize;
|
||||
@@ -391,12 +518,15 @@ struct twl4030_resconfig {
|
||||
u8 devgroup; /* Processor group that Power resource belongs to */
|
||||
u8 type; /* Power resource addressed, 6 / broadcast message */
|
||||
u8 type2; /* Power resource addressed, 3 / broadcast message */
|
||||
u8 remap_off; /* off state remapping */
|
||||
u8 remap_sleep; /* sleep state remapping */
|
||||
};
|
||||
|
||||
struct twl4030_power_data {
|
||||
struct twl4030_script **scripts;
|
||||
unsigned num;
|
||||
struct twl4030_resconfig *resource_config;
|
||||
#define TWL4030_RESCONFIG_UNDEF ((u8)-1)
|
||||
};
|
||||
|
||||
extern void twl4030_power_init(struct twl4030_power_data *triton2_scripts);
|
||||
@@ -421,6 +551,7 @@ struct twl4030_codec_data {
|
||||
|
||||
struct twl4030_platform_data {
|
||||
unsigned irq_base, irq_end;
|
||||
struct twl4030_clock_init_data *clock;
|
||||
struct twl4030_bci_platform_data *bci;
|
||||
struct twl4030_gpio_platform_data *gpio;
|
||||
struct twl4030_madc_platform_data *madc;
|
||||
@@ -429,19 +560,31 @@ struct twl4030_platform_data {
|
||||
struct twl4030_power_data *power;
|
||||
struct twl4030_codec_data *codec;
|
||||
|
||||
/* LDO regulators */
|
||||
/* Common LDO regulators for TWL4030/TWL6030 */
|
||||
struct regulator_init_data *vdac;
|
||||
struct regulator_init_data *vaux1;
|
||||
struct regulator_init_data *vaux2;
|
||||
struct regulator_init_data *vaux3;
|
||||
/* TWL4030 LDO regulators */
|
||||
struct regulator_init_data *vpll1;
|
||||
struct regulator_init_data *vpll2;
|
||||
struct regulator_init_data *vmmc1;
|
||||
struct regulator_init_data *vmmc2;
|
||||
struct regulator_init_data *vsim;
|
||||
struct regulator_init_data *vaux1;
|
||||
struct regulator_init_data *vaux2;
|
||||
struct regulator_init_data *vaux3;
|
||||
struct regulator_init_data *vaux4;
|
||||
|
||||
/* REVISIT more to come ... _nothing_ should be hard-wired */
|
||||
struct regulator_init_data *vio;
|
||||
struct regulator_init_data *vdd1;
|
||||
struct regulator_init_data *vdd2;
|
||||
struct regulator_init_data *vintana1;
|
||||
struct regulator_init_data *vintana2;
|
||||
struct regulator_init_data *vintdig;
|
||||
/* TWL6030 LDO regulators */
|
||||
struct regulator_init_data *vmmc;
|
||||
struct regulator_init_data *vpp;
|
||||
struct regulator_init_data *vusim;
|
||||
struct regulator_init_data *vana;
|
||||
struct regulator_init_data *vcxio;
|
||||
struct regulator_init_data *vusb;
|
||||
};
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
@@ -473,6 +616,7 @@ int twl4030_sih_setup(int module);
|
||||
* VIO is generally fixed.
|
||||
*/
|
||||
|
||||
/* TWL4030 SMPS/LDO's */
|
||||
/* EXTERNAL dc-to-dc buck converters */
|
||||
#define TWL4030_REG_VDD1 0
|
||||
#define TWL4030_REG_VDD2 1
|
||||
@@ -499,4 +643,31 @@ int twl4030_sih_setup(int module);
|
||||
#define TWL4030_REG_VUSB1V8 18
|
||||
#define TWL4030_REG_VUSB3V1 19
|
||||
|
||||
/* TWL6030 SMPS/LDO's */
|
||||
/* EXTERNAL dc-to-dc buck convertor contollable via SR */
|
||||
#define TWL6030_REG_VDD1 30
|
||||
#define TWL6030_REG_VDD2 31
|
||||
#define TWL6030_REG_VDD3 32
|
||||
|
||||
/* Non SR compliant dc-to-dc buck convertors */
|
||||
#define TWL6030_REG_VMEM 33
|
||||
#define TWL6030_REG_V2V1 34
|
||||
#define TWL6030_REG_V1V29 35
|
||||
#define TWL6030_REG_V1V8 36
|
||||
|
||||
/* EXTERNAL LDOs */
|
||||
#define TWL6030_REG_VAUX1_6030 37
|
||||
#define TWL6030_REG_VAUX2_6030 38
|
||||
#define TWL6030_REG_VAUX3_6030 39
|
||||
#define TWL6030_REG_VMMC 40
|
||||
#define TWL6030_REG_VPP 41
|
||||
#define TWL6030_REG_VUSIM 42
|
||||
#define TWL6030_REG_VANA 43
|
||||
#define TWL6030_REG_VCXIO 44
|
||||
#define TWL6030_REG_VDAC 45
|
||||
#define TWL6030_REG_VUSB 46
|
||||
|
||||
/* INTERNAL LDOs */
|
||||
#define TWL6030_REG_VRTC 47
|
||||
|
||||
#endif /* End of __TWL4030_H */
|
||||
+17
-1
@@ -39,6 +39,10 @@ void i8042_lock_chip(void);
|
||||
void i8042_unlock_chip(void);
|
||||
int i8042_command(unsigned char *param, int command);
|
||||
bool i8042_check_port_owner(const struct serio *);
|
||||
int i8042_install_filter(bool (*filter)(unsigned char data, unsigned char str,
|
||||
struct serio *serio));
|
||||
int i8042_remove_filter(bool (*filter)(unsigned char data, unsigned char str,
|
||||
struct serio *serio));
|
||||
|
||||
#else
|
||||
|
||||
@@ -52,7 +56,7 @@ void i8042_unlock_chip(void)
|
||||
|
||||
int i8042_command(unsigned char *param, int command)
|
||||
{
|
||||
return -ENOSYS;
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
bool i8042_check_port_owner(const struct serio *serio)
|
||||
@@ -60,6 +64,18 @@ bool i8042_check_port_owner(const struct serio *serio)
|
||||
return false;
|
||||
}
|
||||
|
||||
int i8042_install_filter(bool (*filter)(unsigned char data, unsigned char str,
|
||||
struct serio *serio))
|
||||
{
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
int i8042_remove_filter(bool (*filter)(unsigned char data, unsigned char str,
|
||||
struct serio *serio))
|
||||
{
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
+2
-10
@@ -13,18 +13,14 @@
|
||||
#include <linux/fs.h>
|
||||
struct linux_binprm;
|
||||
|
||||
#define IMA_COUNT_UPDATE 1
|
||||
#define IMA_COUNT_LEAVE 0
|
||||
|
||||
#ifdef CONFIG_IMA
|
||||
extern int ima_bprm_check(struct linux_binprm *bprm);
|
||||
extern int ima_inode_alloc(struct inode *inode);
|
||||
extern void ima_inode_free(struct inode *inode);
|
||||
extern int ima_path_check(struct path *path, int mask, int update_counts);
|
||||
extern int ima_path_check(struct path *path, int mask);
|
||||
extern void ima_file_free(struct file *file);
|
||||
extern int ima_file_mmap(struct file *file, unsigned long prot);
|
||||
extern void ima_counts_get(struct file *file);
|
||||
extern void ima_counts_put(struct path *path, int mask);
|
||||
|
||||
#else
|
||||
static inline int ima_bprm_check(struct linux_binprm *bprm)
|
||||
@@ -42,7 +38,7 @@ static inline void ima_inode_free(struct inode *inode)
|
||||
return;
|
||||
}
|
||||
|
||||
static inline int ima_path_check(struct path *path, int mask, int update_counts)
|
||||
static inline int ima_path_check(struct path *path, int mask)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -62,9 +58,5 @@ static inline void ima_counts_get(struct file *file)
|
||||
return;
|
||||
}
|
||||
|
||||
static inline void ima_counts_put(struct path *path, int mask)
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif /* CONFIG_IMA_H */
|
||||
#endif /* _LINUX_IMA_H */
|
||||
|
||||
@@ -149,6 +149,8 @@ void prepare_namespace(void);
|
||||
|
||||
extern void (*late_time_init)(void);
|
||||
|
||||
extern int initcall_debug;
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef MODULE
|
||||
|
||||
@@ -165,7 +165,7 @@ extern struct cred init_cred;
|
||||
.journal_info = NULL, \
|
||||
.cpu_timers = INIT_CPU_TIMERS(tsk.cpu_timers), \
|
||||
.fs_excl = ATOMIC_INIT(0), \
|
||||
.pi_lock = __SPIN_LOCK_UNLOCKED(tsk.pi_lock), \
|
||||
.pi_lock = __RAW_SPIN_LOCK_UNLOCKED(tsk.pi_lock), \
|
||||
.timer_slack_ns = 50000, /* 50 usec default slack */ \
|
||||
.pids = { \
|
||||
[PIDTYPE_PID] = INIT_PID_LINK(PIDTYPE_PID), \
|
||||
|
||||
@@ -332,6 +332,7 @@ struct intel_iommu {
|
||||
#ifdef CONFIG_INTR_REMAP
|
||||
struct ir_table *ir_table; /* Interrupt remapping info */
|
||||
#endif
|
||||
int node;
|
||||
};
|
||||
|
||||
static inline void __iommu_flush_cache(
|
||||
|
||||
@@ -4,32 +4,6 @@
|
||||
#include <linux/radix-tree.h>
|
||||
#include <linux/rcupdate.h>
|
||||
|
||||
/*
|
||||
* This is the per-process anticipatory I/O scheduler state.
|
||||
*/
|
||||
struct as_io_context {
|
||||
spinlock_t lock;
|
||||
|
||||
void (*dtor)(struct as_io_context *aic); /* destructor */
|
||||
void (*exit)(struct as_io_context *aic); /* called on task exit */
|
||||
|
||||
unsigned long state;
|
||||
atomic_t nr_queued; /* queued reads & sync writes */
|
||||
atomic_t nr_dispatched; /* number of requests gone to the drivers */
|
||||
|
||||
/* IO History tracking */
|
||||
/* Thinktime */
|
||||
unsigned long last_end_request;
|
||||
unsigned long ttime_total;
|
||||
unsigned long ttime_samples;
|
||||
unsigned long ttime_mean;
|
||||
/* Layout pattern */
|
||||
unsigned int seek_samples;
|
||||
sector_t last_request_pos;
|
||||
u64 seek_total;
|
||||
sector_t seek_mean;
|
||||
};
|
||||
|
||||
struct cfq_queue;
|
||||
struct cfq_io_context {
|
||||
void *key;
|
||||
@@ -78,7 +52,6 @@ struct io_context {
|
||||
unsigned long last_waited; /* Time last woken after wait for request */
|
||||
int nr_batch_requests; /* Number of requests left in the batch */
|
||||
|
||||
struct as_io_context *aic;
|
||||
struct radix_tree_root radix_root;
|
||||
struct hlist_head cic_list;
|
||||
void *ioc_data;
|
||||
|
||||
@@ -14,14 +14,11 @@ static inline unsigned long iommu_device_max_index(unsigned long size,
|
||||
extern int iommu_is_span_boundary(unsigned int index, unsigned int nr,
|
||||
unsigned long shift,
|
||||
unsigned long boundary_size);
|
||||
extern void iommu_area_reserve(unsigned long *map, unsigned long i, int len);
|
||||
extern unsigned long iommu_area_alloc(unsigned long *map, unsigned long size,
|
||||
unsigned long start, unsigned int nr,
|
||||
unsigned long shift,
|
||||
unsigned long boundary_size,
|
||||
unsigned long align_mask);
|
||||
extern void iommu_area_free(unsigned long *map, unsigned long start,
|
||||
unsigned int nr);
|
||||
|
||||
extern unsigned long iommu_num_pages(unsigned long addr, unsigned long len,
|
||||
unsigned long io_page_size);
|
||||
|
||||
@@ -126,11 +126,11 @@ extern int allocate_resource(struct resource *root, struct resource *new,
|
||||
int adjust_resource(struct resource *res, resource_size_t start,
|
||||
resource_size_t size);
|
||||
resource_size_t resource_alignment(struct resource *res);
|
||||
static inline resource_size_t resource_size(struct resource *res)
|
||||
static inline resource_size_t resource_size(const struct resource *res)
|
||||
{
|
||||
return res->end - res->start + 1;
|
||||
}
|
||||
static inline unsigned long resource_type(struct resource *res)
|
||||
static inline unsigned long resource_type(const struct resource *res)
|
||||
{
|
||||
return res->flags & IORESOURCE_TYPE_BITS;
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ extern int mq_init_ns(struct ipc_namespace *ns);
|
||||
/* default values */
|
||||
#define DFLT_QUEUESMAX 256 /* max number of message queues */
|
||||
#define DFLT_MSGMAX 10 /* max number of messages in each queue */
|
||||
#define HARD_MSGMAX (131072/sizeof(void *))
|
||||
#define HARD_MSGMAX (32768*sizeof(void *)/4)
|
||||
#define DFLT_MSGSIZEMAX 8192 /* max message size */
|
||||
#else
|
||||
static inline int mq_init_ns(struct ipc_namespace *ns) { return 0; }
|
||||
|
||||
+1
-1
@@ -192,7 +192,7 @@ struct irq_desc {
|
||||
unsigned int irq_count; /* For detecting broken IRQs */
|
||||
unsigned long last_unhandled; /* Aging timer for unhandled count */
|
||||
unsigned int irqs_unhandled;
|
||||
spinlock_t lock;
|
||||
raw_spinlock_t lock;
|
||||
#ifdef CONFIG_SMP
|
||||
cpumask_var_t affinity;
|
||||
unsigned int node;
|
||||
|
||||
@@ -653,6 +653,7 @@ struct transaction_s
|
||||
* waiting for it to finish.
|
||||
*/
|
||||
unsigned int t_synchronous_commit:1;
|
||||
unsigned int t_flushed_data_blocks:1;
|
||||
|
||||
/*
|
||||
* For use by the filesystem to store fs-specific data
|
||||
|
||||
@@ -107,18 +107,6 @@ static inline void print_symbol(const char *fmt, unsigned long addr)
|
||||
__builtin_extract_return_addr((void *)addr));
|
||||
}
|
||||
|
||||
/*
|
||||
* Pretty-print a function pointer. This function is deprecated.
|
||||
* Please use the "%pF" vsprintf format instead.
|
||||
*/
|
||||
static inline void __deprecated print_fn_descriptor_symbol(const char *fmt, void *addr)
|
||||
{
|
||||
#if defined(CONFIG_IA64) || defined(CONFIG_PPC64)
|
||||
addr = *(void **)addr;
|
||||
#endif
|
||||
print_symbol(fmt, (unsigned long)addr);
|
||||
}
|
||||
|
||||
static inline void print_ip_sym(unsigned long ip)
|
||||
{
|
||||
printk("[<%p>] %pS\n", (void *) ip, (void *) ip);
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
#ifndef LINUX_KERNEL_PAGE_FLAGS_H
|
||||
#define LINUX_KERNEL_PAGE_FLAGS_H
|
||||
|
||||
/*
|
||||
* Stable page flag bits exported to user space
|
||||
*/
|
||||
|
||||
#define KPF_LOCKED 0
|
||||
#define KPF_ERROR 1
|
||||
#define KPF_REFERENCED 2
|
||||
#define KPF_UPTODATE 3
|
||||
#define KPF_DIRTY 4
|
||||
#define KPF_LRU 5
|
||||
#define KPF_ACTIVE 6
|
||||
#define KPF_SLAB 7
|
||||
#define KPF_WRITEBACK 8
|
||||
#define KPF_RECLAIM 9
|
||||
#define KPF_BUDDY 10
|
||||
|
||||
/* 11-20: new additions in 2.6.31 */
|
||||
#define KPF_MMAP 11
|
||||
#define KPF_ANON 12
|
||||
#define KPF_SWAPCACHE 13
|
||||
#define KPF_SWAPBACKED 14
|
||||
#define KPF_COMPOUND_HEAD 15
|
||||
#define KPF_COMPOUND_TAIL 16
|
||||
#define KPF_HUGE 17
|
||||
#define KPF_UNEVICTABLE 18
|
||||
#define KPF_HWPOISON 19
|
||||
#define KPF_NOPAGE 20
|
||||
|
||||
#define KPF_KSM 21
|
||||
|
||||
/* kernel hacking assistances
|
||||
* WARNING: subject to change, never rely on them!
|
||||
*/
|
||||
#define KPF_RESERVED 32
|
||||
#define KPF_MLOCKED 33
|
||||
#define KPF_MAPPEDTODISK 34
|
||||
#define KPF_PRIVATE 35
|
||||
#define KPF_PRIVATE_2 36
|
||||
#define KPF_OWNER_PRIVATE 37
|
||||
#define KPF_ARCH 38
|
||||
#define KPF_UNCACHED 39
|
||||
|
||||
#endif /* LINUX_KERNEL_PAGE_FLAGS_H */
|
||||
+56
-6
@@ -251,10 +251,10 @@ extern int printk_delay_msec;
|
||||
* Print a one-time message (analogous to WARN_ONCE() et al):
|
||||
*/
|
||||
#define printk_once(x...) ({ \
|
||||
static bool __print_once = true; \
|
||||
static bool __print_once; \
|
||||
\
|
||||
if (__print_once) { \
|
||||
__print_once = false; \
|
||||
if (!__print_once) { \
|
||||
__print_once = true; \
|
||||
printk(x); \
|
||||
} \
|
||||
})
|
||||
@@ -397,14 +397,57 @@ static inline char *pack_hex_byte(char *buf, u8 byte)
|
||||
printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
|
||||
#elif defined(CONFIG_DYNAMIC_DEBUG)
|
||||
/* dynamic_pr_debug() uses pr_fmt() internally so we don't need it here */
|
||||
#define pr_debug(fmt, ...) do { \
|
||||
dynamic_pr_debug(fmt, ##__VA_ARGS__); \
|
||||
} while (0)
|
||||
#define pr_debug(fmt, ...) \
|
||||
dynamic_pr_debug(fmt, ##__VA_ARGS__)
|
||||
#else
|
||||
#define pr_debug(fmt, ...) \
|
||||
({ if (0) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); 0; })
|
||||
#endif
|
||||
|
||||
/*
|
||||
* ratelimited messages with local ratelimit_state,
|
||||
* no local ratelimit_state used in the !PRINTK case
|
||||
*/
|
||||
#ifdef CONFIG_PRINTK
|
||||
#define printk_ratelimited(fmt, ...) ({ \
|
||||
static struct ratelimit_state _rs = { \
|
||||
.interval = DEFAULT_RATELIMIT_INTERVAL, \
|
||||
.burst = DEFAULT_RATELIMIT_BURST, \
|
||||
}; \
|
||||
\
|
||||
if (!__ratelimit(&_rs)) \
|
||||
printk(fmt, ##__VA_ARGS__); \
|
||||
})
|
||||
#else
|
||||
/* No effect, but we still get type checking even in the !PRINTK case: */
|
||||
#define printk_ratelimited printk
|
||||
#endif
|
||||
|
||||
#define pr_emerg_ratelimited(fmt, ...) \
|
||||
printk_ratelimited(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__)
|
||||
#define pr_alert_ratelimited(fmt, ...) \
|
||||
printk_ratelimited(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__)
|
||||
#define pr_crit_ratelimited(fmt, ...) \
|
||||
printk_ratelimited(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__)
|
||||
#define pr_err_ratelimited(fmt, ...) \
|
||||
printk_ratelimited(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
|
||||
#define pr_warning_ratelimited(fmt, ...) \
|
||||
printk_ratelimited(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
|
||||
#define pr_notice_ratelimited(fmt, ...) \
|
||||
printk_ratelimited(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__)
|
||||
#define pr_info_ratelimited(fmt, ...) \
|
||||
printk_ratelimited(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
|
||||
/* no pr_cont_ratelimited, don't do that... */
|
||||
/* If you are writing a driver, please use dev_dbg instead */
|
||||
#if defined(DEBUG)
|
||||
#define pr_debug_ratelimited(fmt, ...) \
|
||||
printk_ratelimited(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
|
||||
#else
|
||||
#define pr_debug_ratelimited(fmt, ...) \
|
||||
({ if (0) printk_ratelimited(KERN_DEBUG pr_fmt(fmt), \
|
||||
##__VA_ARGS__); 0; })
|
||||
#endif
|
||||
|
||||
/*
|
||||
* General tracing related utility functions - trace_printk(),
|
||||
* tracing_on/tracing_off and tracing_start()/tracing_stop
|
||||
@@ -492,6 +535,8 @@ extern int
|
||||
__trace_printk(unsigned long ip, const char *fmt, ...)
|
||||
__attribute__ ((format (printf, 2, 3)));
|
||||
|
||||
extern void trace_dump_stack(void);
|
||||
|
||||
/*
|
||||
* The double __builtin_constant_p is because gcc will give us an error
|
||||
* if we try to allocate the static variable to fmt if it is not a
|
||||
@@ -525,6 +570,7 @@ trace_printk(const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
|
||||
static inline void tracing_start(void) { }
|
||||
static inline void tracing_stop(void) { }
|
||||
static inline void ftrace_off_permanent(void) { }
|
||||
static inline void trace_dump_stack(void) { }
|
||||
static inline int
|
||||
trace_printk(const char *fmt, ...)
|
||||
{
|
||||
@@ -688,6 +734,10 @@ struct sysinfo {
|
||||
/* Force a compilation error if condition is constant and true */
|
||||
#define MAYBE_BUILD_BUG_ON(cond) ((void)sizeof(char[1 - 2 * !!(cond)]))
|
||||
|
||||
/* Force a compilation error if a constant expression is not a power of 2 */
|
||||
#define BUILD_BUG_ON_NOT_POWER_OF_2(n) \
|
||||
BUILD_BUG_ON((n) == 0 || (((n) & ((n) - 1)) != 0))
|
||||
|
||||
/* Force a compilation error if condition is true, but also produce a
|
||||
result (of value 0 and type size_t), so the expression can be used
|
||||
e.g. in a structure initializer (or where-ever else comma expressions
|
||||
|
||||
@@ -206,6 +206,8 @@ extern size_t vmcoreinfo_max_size;
|
||||
|
||||
int __init parse_crashkernel(char *cmdline, unsigned long long system_ram,
|
||||
unsigned long long *crash_size, unsigned long long *crash_base);
|
||||
int crash_shrink_memory(unsigned long new_size);
|
||||
size_t crash_get_memory_size(void);
|
||||
|
||||
#else /* !CONFIG_KEXEC */
|
||||
struct pt_regs;
|
||||
|
||||
+544
-80
@@ -1,6 +1,7 @@
|
||||
/*
|
||||
* A simple kernel FIFO implementation.
|
||||
* A generic kernel FIFO implementation.
|
||||
*
|
||||
* Copyright (C) 2009 Stefani Seibold <stefani@seibold.net>
|
||||
* Copyright (C) 2004 Stelian Pop <stelian@popies.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -18,6 +19,25 @@
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Howto porting drivers to the new generic fifo API:
|
||||
*
|
||||
* - Modify the declaration of the "struct kfifo *" object into a
|
||||
* in-place "struct kfifo" object
|
||||
* - Init the in-place object with kfifo_alloc() or kfifo_init()
|
||||
* Note: The address of the in-place "struct kfifo" object must be
|
||||
* passed as the first argument to this functions
|
||||
* - Replace the use of __kfifo_put into kfifo_in and __kfifo_get
|
||||
* into kfifo_out
|
||||
* - Replace the use of kfifo_put into kfifo_in_locked and kfifo_get
|
||||
* into kfifo_out_locked
|
||||
* Note: the spinlock pointer formerly passed to kfifo_init/kfifo_alloc
|
||||
* must be passed now to the kfifo_in_locked and kfifo_out_locked
|
||||
* as the last parameter.
|
||||
* - All formerly name __kfifo_* functions has been renamed into kfifo_*
|
||||
*/
|
||||
|
||||
#ifndef _LINUX_KFIFO_H
|
||||
#define _LINUX_KFIFO_H
|
||||
|
||||
@@ -29,26 +49,82 @@ struct kfifo {
|
||||
unsigned int size; /* the size of the allocated buffer */
|
||||
unsigned int in; /* data is added at offset (in % size) */
|
||||
unsigned int out; /* data is extracted from off. (out % size) */
|
||||
spinlock_t *lock; /* protects concurrent modifications */
|
||||
};
|
||||
|
||||
extern struct kfifo *kfifo_init(unsigned char *buffer, unsigned int size,
|
||||
gfp_t gfp_mask, spinlock_t *lock);
|
||||
extern struct kfifo *kfifo_alloc(unsigned int size, gfp_t gfp_mask,
|
||||
spinlock_t *lock);
|
||||
extern void kfifo_free(struct kfifo *fifo);
|
||||
extern unsigned int __kfifo_put(struct kfifo *fifo,
|
||||
const unsigned char *buffer, unsigned int len);
|
||||
extern unsigned int __kfifo_get(struct kfifo *fifo,
|
||||
unsigned char *buffer, unsigned int len);
|
||||
/*
|
||||
* Macros for declaration and initialization of the kfifo datatype
|
||||
*/
|
||||
|
||||
/* helper macro */
|
||||
#define __kfifo_initializer(s, b) \
|
||||
(struct kfifo) { \
|
||||
.size = s, \
|
||||
.in = 0, \
|
||||
.out = 0, \
|
||||
.buffer = b \
|
||||
}
|
||||
|
||||
/**
|
||||
* __kfifo_reset - removes the entire FIFO contents, no locking version
|
||||
* @fifo: the fifo to be emptied.
|
||||
* DECLARE_KFIFO - macro to declare a kfifo and the associated buffer
|
||||
* @name: name of the declared kfifo datatype
|
||||
* @size: size of the fifo buffer. Must be a power of two.
|
||||
*
|
||||
* Note1: the macro can be used inside struct or union declaration
|
||||
* Note2: the macro creates two objects:
|
||||
* A kfifo object with the given name and a buffer for the kfifo
|
||||
* object named name##kfifo_buffer
|
||||
*/
|
||||
static inline void __kfifo_reset(struct kfifo *fifo)
|
||||
#define DECLARE_KFIFO(name, size) \
|
||||
union { \
|
||||
struct kfifo name; \
|
||||
unsigned char name##kfifo_buffer[size + sizeof(struct kfifo)]; \
|
||||
}
|
||||
|
||||
/**
|
||||
* INIT_KFIFO - Initialize a kfifo declared by DECLARE_KFIFO
|
||||
* @name: name of the declared kfifo datatype
|
||||
*/
|
||||
#define INIT_KFIFO(name) \
|
||||
name = __kfifo_initializer(sizeof(name##kfifo_buffer) - \
|
||||
sizeof(struct kfifo), name##kfifo_buffer)
|
||||
|
||||
/**
|
||||
* DEFINE_KFIFO - macro to define and initialize a kfifo
|
||||
* @name: name of the declared kfifo datatype
|
||||
* @size: size of the fifo buffer. Must be a power of two.
|
||||
*
|
||||
* Note1: the macro can be used for global and local kfifo data type variables
|
||||
* Note2: the macro creates two objects:
|
||||
* A kfifo object with the given name and a buffer for the kfifo
|
||||
* object named name##kfifo_buffer
|
||||
*/
|
||||
#define DEFINE_KFIFO(name, size) \
|
||||
unsigned char name##kfifo_buffer[size]; \
|
||||
struct kfifo name = __kfifo_initializer(size, name##kfifo_buffer)
|
||||
|
||||
#undef __kfifo_initializer
|
||||
|
||||
extern void kfifo_init(struct kfifo *fifo, void *buffer,
|
||||
unsigned int size);
|
||||
extern __must_check int kfifo_alloc(struct kfifo *fifo, unsigned int size,
|
||||
gfp_t gfp_mask);
|
||||
extern void kfifo_free(struct kfifo *fifo);
|
||||
extern unsigned int kfifo_in(struct kfifo *fifo,
|
||||
const void *from, unsigned int len);
|
||||
extern __must_check unsigned int kfifo_out(struct kfifo *fifo,
|
||||
void *to, unsigned int len);
|
||||
extern __must_check unsigned int kfifo_out_peek(struct kfifo *fifo,
|
||||
void *to, unsigned int len, unsigned offset);
|
||||
|
||||
/**
|
||||
* kfifo_initialized - Check if kfifo is initialized.
|
||||
* @fifo: fifo to check
|
||||
* Return %true if FIFO is initialized, otherwise %false.
|
||||
* Assumes the fifo was 0 before.
|
||||
*/
|
||||
static inline bool kfifo_initialized(struct kfifo *fifo)
|
||||
{
|
||||
fifo->in = fifo->out = 0;
|
||||
return fifo->buffer != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -57,96 +133,484 @@ static inline void __kfifo_reset(struct kfifo *fifo)
|
||||
*/
|
||||
static inline void kfifo_reset(struct kfifo *fifo)
|
||||
{
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(fifo->lock, flags);
|
||||
|
||||
__kfifo_reset(fifo);
|
||||
|
||||
spin_unlock_irqrestore(fifo->lock, flags);
|
||||
fifo->in = fifo->out = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* kfifo_put - puts some data into the FIFO
|
||||
* @fifo: the fifo to be used.
|
||||
* @buffer: the data to be added.
|
||||
* @len: the length of the data to be added.
|
||||
*
|
||||
* This function copies at most @len bytes from the @buffer into
|
||||
* the FIFO depending on the free space, and returns the number of
|
||||
* bytes copied.
|
||||
* kfifo_reset_out - skip FIFO contents
|
||||
* @fifo: the fifo to be emptied.
|
||||
*/
|
||||
static inline unsigned int kfifo_put(struct kfifo *fifo,
|
||||
const unsigned char *buffer, unsigned int len)
|
||||
static inline void kfifo_reset_out(struct kfifo *fifo)
|
||||
{
|
||||
unsigned long flags;
|
||||
unsigned int ret;
|
||||
|
||||
spin_lock_irqsave(fifo->lock, flags);
|
||||
|
||||
ret = __kfifo_put(fifo, buffer, len);
|
||||
|
||||
spin_unlock_irqrestore(fifo->lock, flags);
|
||||
|
||||
return ret;
|
||||
smp_mb();
|
||||
fifo->out = fifo->in;
|
||||
}
|
||||
|
||||
/**
|
||||
* kfifo_get - gets some data from the FIFO
|
||||
* @fifo: the fifo to be used.
|
||||
* @buffer: where the data must be copied.
|
||||
* @len: the size of the destination buffer.
|
||||
*
|
||||
* This function copies at most @len bytes from the FIFO into the
|
||||
* @buffer and returns the number of copied bytes.
|
||||
*/
|
||||
static inline unsigned int kfifo_get(struct kfifo *fifo,
|
||||
unsigned char *buffer, unsigned int len)
|
||||
{
|
||||
unsigned long flags;
|
||||
unsigned int ret;
|
||||
|
||||
spin_lock_irqsave(fifo->lock, flags);
|
||||
|
||||
ret = __kfifo_get(fifo, buffer, len);
|
||||
|
||||
/*
|
||||
* optimization: if the FIFO is empty, set the indices to 0
|
||||
* so we don't wrap the next time
|
||||
*/
|
||||
if (fifo->in == fifo->out)
|
||||
fifo->in = fifo->out = 0;
|
||||
|
||||
spin_unlock_irqrestore(fifo->lock, flags);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* __kfifo_len - returns the number of bytes available in the FIFO, no locking version
|
||||
* kfifo_size - returns the size of the fifo in bytes
|
||||
* @fifo: the fifo to be used.
|
||||
*/
|
||||
static inline unsigned int __kfifo_len(struct kfifo *fifo)
|
||||
static inline __must_check unsigned int kfifo_size(struct kfifo *fifo)
|
||||
{
|
||||
return fifo->in - fifo->out;
|
||||
return fifo->size;
|
||||
}
|
||||
|
||||
/**
|
||||
* kfifo_len - returns the number of bytes available in the FIFO
|
||||
* kfifo_len - returns the number of used bytes in the FIFO
|
||||
* @fifo: the fifo to be used.
|
||||
*/
|
||||
static inline unsigned int kfifo_len(struct kfifo *fifo)
|
||||
{
|
||||
register unsigned int out;
|
||||
|
||||
out = fifo->out;
|
||||
smp_rmb();
|
||||
return fifo->in - out;
|
||||
}
|
||||
|
||||
/**
|
||||
* kfifo_is_empty - returns true if the fifo is empty
|
||||
* @fifo: the fifo to be used.
|
||||
*/
|
||||
static inline __must_check int kfifo_is_empty(struct kfifo *fifo)
|
||||
{
|
||||
return fifo->in == fifo->out;
|
||||
}
|
||||
|
||||
/**
|
||||
* kfifo_is_full - returns true if the fifo is full
|
||||
* @fifo: the fifo to be used.
|
||||
*/
|
||||
static inline __must_check int kfifo_is_full(struct kfifo *fifo)
|
||||
{
|
||||
return kfifo_len(fifo) == kfifo_size(fifo);
|
||||
}
|
||||
|
||||
/**
|
||||
* kfifo_avail - returns the number of bytes available in the FIFO
|
||||
* @fifo: the fifo to be used.
|
||||
*/
|
||||
static inline __must_check unsigned int kfifo_avail(struct kfifo *fifo)
|
||||
{
|
||||
return kfifo_size(fifo) - kfifo_len(fifo);
|
||||
}
|
||||
|
||||
/**
|
||||
* kfifo_in_locked - puts some data into the FIFO using a spinlock for locking
|
||||
* @fifo: the fifo to be used.
|
||||
* @from: the data to be added.
|
||||
* @n: the length of the data to be added.
|
||||
* @lock: pointer to the spinlock to use for locking.
|
||||
*
|
||||
* This function copies at most @len bytes from the @from buffer into
|
||||
* the FIFO depending on the free space, and returns the number of
|
||||
* bytes copied.
|
||||
*/
|
||||
static inline unsigned int kfifo_in_locked(struct kfifo *fifo,
|
||||
const void *from, unsigned int n, spinlock_t *lock)
|
||||
{
|
||||
unsigned long flags;
|
||||
unsigned int ret;
|
||||
|
||||
spin_lock_irqsave(fifo->lock, flags);
|
||||
spin_lock_irqsave(lock, flags);
|
||||
|
||||
ret = __kfifo_len(fifo);
|
||||
ret = kfifo_in(fifo, from, n);
|
||||
|
||||
spin_unlock_irqrestore(fifo->lock, flags);
|
||||
spin_unlock_irqrestore(lock, flags);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* kfifo_out_locked - gets some data from the FIFO using a spinlock for locking
|
||||
* @fifo: the fifo to be used.
|
||||
* @to: where the data must be copied.
|
||||
* @n: the size of the destination buffer.
|
||||
* @lock: pointer to the spinlock to use for locking.
|
||||
*
|
||||
* This function copies at most @len bytes from the FIFO into the
|
||||
* @to buffer and returns the number of copied bytes.
|
||||
*/
|
||||
static inline __must_check unsigned int kfifo_out_locked(struct kfifo *fifo,
|
||||
void *to, unsigned int n, spinlock_t *lock)
|
||||
{
|
||||
unsigned long flags;
|
||||
unsigned int ret;
|
||||
|
||||
spin_lock_irqsave(lock, flags);
|
||||
|
||||
ret = kfifo_out(fifo, to, n);
|
||||
|
||||
spin_unlock_irqrestore(lock, flags);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
extern void kfifo_skip(struct kfifo *fifo, unsigned int len);
|
||||
|
||||
extern __must_check int kfifo_from_user(struct kfifo *fifo,
|
||||
const void __user *from, unsigned int n, unsigned *lenout);
|
||||
|
||||
extern __must_check int kfifo_to_user(struct kfifo *fifo,
|
||||
void __user *to, unsigned int n, unsigned *lenout);
|
||||
|
||||
/*
|
||||
* __kfifo_add_out internal helper function for updating the out offset
|
||||
*/
|
||||
static inline void __kfifo_add_out(struct kfifo *fifo,
|
||||
unsigned int off)
|
||||
{
|
||||
smp_mb();
|
||||
fifo->out += off;
|
||||
}
|
||||
|
||||
/*
|
||||
* __kfifo_add_in internal helper function for updating the in offset
|
||||
*/
|
||||
static inline void __kfifo_add_in(struct kfifo *fifo,
|
||||
unsigned int off)
|
||||
{
|
||||
smp_wmb();
|
||||
fifo->in += off;
|
||||
}
|
||||
|
||||
/*
|
||||
* __kfifo_off internal helper function for calculating the index of a
|
||||
* given offeset
|
||||
*/
|
||||
static inline unsigned int __kfifo_off(struct kfifo *fifo, unsigned int off)
|
||||
{
|
||||
return off & (fifo->size - 1);
|
||||
}
|
||||
|
||||
/*
|
||||
* __kfifo_peek_n internal helper function for determinate the length of
|
||||
* the next record in the fifo
|
||||
*/
|
||||
static inline unsigned int __kfifo_peek_n(struct kfifo *fifo,
|
||||
unsigned int recsize)
|
||||
{
|
||||
#define __KFIFO_GET(fifo, off, shift) \
|
||||
((fifo)->buffer[__kfifo_off((fifo), (fifo)->out+(off))] << (shift))
|
||||
|
||||
unsigned int l;
|
||||
|
||||
l = __KFIFO_GET(fifo, 0, 0);
|
||||
|
||||
if (--recsize)
|
||||
l |= __KFIFO_GET(fifo, 1, 8);
|
||||
|
||||
return l;
|
||||
#undef __KFIFO_GET
|
||||
}
|
||||
|
||||
/*
|
||||
* __kfifo_poke_n internal helper function for storing the length of
|
||||
* the next record into the fifo
|
||||
*/
|
||||
static inline void __kfifo_poke_n(struct kfifo *fifo,
|
||||
unsigned int recsize, unsigned int n)
|
||||
{
|
||||
#define __KFIFO_PUT(fifo, off, val, shift) \
|
||||
( \
|
||||
(fifo)->buffer[__kfifo_off((fifo), (fifo)->in+(off))] = \
|
||||
(unsigned char)((val) >> (shift)) \
|
||||
)
|
||||
|
||||
__KFIFO_PUT(fifo, 0, n, 0);
|
||||
|
||||
if (--recsize)
|
||||
__KFIFO_PUT(fifo, 1, n, 8);
|
||||
#undef __KFIFO_PUT
|
||||
}
|
||||
|
||||
/*
|
||||
* __kfifo_in_... internal functions for put date into the fifo
|
||||
* do not call it directly, use kfifo_in_rec() instead
|
||||
*/
|
||||
extern unsigned int __kfifo_in_n(struct kfifo *fifo,
|
||||
const void *from, unsigned int n, unsigned int recsize);
|
||||
|
||||
extern unsigned int __kfifo_in_generic(struct kfifo *fifo,
|
||||
const void *from, unsigned int n, unsigned int recsize);
|
||||
|
||||
static inline unsigned int __kfifo_in_rec(struct kfifo *fifo,
|
||||
const void *from, unsigned int n, unsigned int recsize)
|
||||
{
|
||||
unsigned int ret;
|
||||
|
||||
ret = __kfifo_in_n(fifo, from, n, recsize);
|
||||
|
||||
if (likely(ret == 0)) {
|
||||
if (recsize)
|
||||
__kfifo_poke_n(fifo, recsize, n);
|
||||
__kfifo_add_in(fifo, n + recsize);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* kfifo_in_rec - puts some record data into the FIFO
|
||||
* @fifo: the fifo to be used.
|
||||
* @from: the data to be added.
|
||||
* @n: the length of the data to be added.
|
||||
* @recsize: size of record field
|
||||
*
|
||||
* This function copies @n bytes from the @from into the FIFO and returns
|
||||
* the number of bytes which cannot be copied.
|
||||
* A returned value greater than the @n value means that the record doesn't
|
||||
* fit into the buffer.
|
||||
*
|
||||
* Note that with only one concurrent reader and one concurrent
|
||||
* writer, you don't need extra locking to use these functions.
|
||||
*/
|
||||
static inline __must_check unsigned int kfifo_in_rec(struct kfifo *fifo,
|
||||
void *from, unsigned int n, unsigned int recsize)
|
||||
{
|
||||
if (!__builtin_constant_p(recsize))
|
||||
return __kfifo_in_generic(fifo, from, n, recsize);
|
||||
return __kfifo_in_rec(fifo, from, n, recsize);
|
||||
}
|
||||
|
||||
/*
|
||||
* __kfifo_out_... internal functions for get date from the fifo
|
||||
* do not call it directly, use kfifo_out_rec() instead
|
||||
*/
|
||||
extern unsigned int __kfifo_out_n(struct kfifo *fifo,
|
||||
void *to, unsigned int reclen, unsigned int recsize);
|
||||
|
||||
extern unsigned int __kfifo_out_generic(struct kfifo *fifo,
|
||||
void *to, unsigned int n,
|
||||
unsigned int recsize, unsigned int *total);
|
||||
|
||||
static inline unsigned int __kfifo_out_rec(struct kfifo *fifo,
|
||||
void *to, unsigned int n, unsigned int recsize,
|
||||
unsigned int *total)
|
||||
{
|
||||
unsigned int l;
|
||||
|
||||
if (!recsize) {
|
||||
l = n;
|
||||
if (total)
|
||||
*total = l;
|
||||
} else {
|
||||
l = __kfifo_peek_n(fifo, recsize);
|
||||
if (total)
|
||||
*total = l;
|
||||
if (n < l)
|
||||
return l;
|
||||
}
|
||||
|
||||
return __kfifo_out_n(fifo, to, l, recsize);
|
||||
}
|
||||
|
||||
/**
|
||||
* kfifo_out_rec - gets some record data from the FIFO
|
||||
* @fifo: the fifo to be used.
|
||||
* @to: where the data must be copied.
|
||||
* @n: the size of the destination buffer.
|
||||
* @recsize: size of record field
|
||||
* @total: pointer where the total number of to copied bytes should stored
|
||||
*
|
||||
* This function copies at most @n bytes from the FIFO to @to and returns the
|
||||
* number of bytes which cannot be copied.
|
||||
* A returned value greater than the @n value means that the record doesn't
|
||||
* fit into the @to buffer.
|
||||
*
|
||||
* Note that with only one concurrent reader and one concurrent
|
||||
* writer, you don't need extra locking to use these functions.
|
||||
*/
|
||||
static inline __must_check unsigned int kfifo_out_rec(struct kfifo *fifo,
|
||||
void *to, unsigned int n, unsigned int recsize,
|
||||
unsigned int *total)
|
||||
|
||||
{
|
||||
if (!__builtin_constant_p(recsize))
|
||||
return __kfifo_out_generic(fifo, to, n, recsize, total);
|
||||
return __kfifo_out_rec(fifo, to, n, recsize, total);
|
||||
}
|
||||
|
||||
/*
|
||||
* __kfifo_from_user_... internal functions for transfer from user space into
|
||||
* the fifo. do not call it directly, use kfifo_from_user_rec() instead
|
||||
*/
|
||||
extern unsigned int __kfifo_from_user_n(struct kfifo *fifo,
|
||||
const void __user *from, unsigned int n, unsigned int recsize);
|
||||
|
||||
extern unsigned int __kfifo_from_user_generic(struct kfifo *fifo,
|
||||
const void __user *from, unsigned int n, unsigned int recsize);
|
||||
|
||||
static inline unsigned int __kfifo_from_user_rec(struct kfifo *fifo,
|
||||
const void __user *from, unsigned int n, unsigned int recsize)
|
||||
{
|
||||
unsigned int ret;
|
||||
|
||||
ret = __kfifo_from_user_n(fifo, from, n, recsize);
|
||||
|
||||
if (likely(ret == 0)) {
|
||||
if (recsize)
|
||||
__kfifo_poke_n(fifo, recsize, n);
|
||||
__kfifo_add_in(fifo, n + recsize);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* kfifo_from_user_rec - puts some data from user space into the FIFO
|
||||
* @fifo: the fifo to be used.
|
||||
* @from: pointer to the data to be added.
|
||||
* @n: the length of the data to be added.
|
||||
* @recsize: size of record field
|
||||
*
|
||||
* This function copies @n bytes from the @from into the
|
||||
* FIFO and returns the number of bytes which cannot be copied.
|
||||
*
|
||||
* If the returned value is equal or less the @n value, the copy_from_user()
|
||||
* functions has failed. Otherwise the record doesn't fit into the buffer.
|
||||
*
|
||||
* Note that with only one concurrent reader and one concurrent
|
||||
* writer, you don't need extra locking to use these functions.
|
||||
*/
|
||||
static inline __must_check unsigned int kfifo_from_user_rec(struct kfifo *fifo,
|
||||
const void __user *from, unsigned int n, unsigned int recsize)
|
||||
{
|
||||
if (!__builtin_constant_p(recsize))
|
||||
return __kfifo_from_user_generic(fifo, from, n, recsize);
|
||||
return __kfifo_from_user_rec(fifo, from, n, recsize);
|
||||
}
|
||||
|
||||
/*
|
||||
* __kfifo_to_user_... internal functions for transfer fifo data into user space
|
||||
* do not call it directly, use kfifo_to_user_rec() instead
|
||||
*/
|
||||
extern unsigned int __kfifo_to_user_n(struct kfifo *fifo,
|
||||
void __user *to, unsigned int n, unsigned int reclen,
|
||||
unsigned int recsize);
|
||||
|
||||
extern unsigned int __kfifo_to_user_generic(struct kfifo *fifo,
|
||||
void __user *to, unsigned int n, unsigned int recsize,
|
||||
unsigned int *total);
|
||||
|
||||
static inline unsigned int __kfifo_to_user_rec(struct kfifo *fifo,
|
||||
void __user *to, unsigned int n,
|
||||
unsigned int recsize, unsigned int *total)
|
||||
{
|
||||
unsigned int l;
|
||||
|
||||
if (!recsize) {
|
||||
l = n;
|
||||
if (total)
|
||||
*total = l;
|
||||
} else {
|
||||
l = __kfifo_peek_n(fifo, recsize);
|
||||
if (total)
|
||||
*total = l;
|
||||
if (n < l)
|
||||
return l;
|
||||
}
|
||||
|
||||
return __kfifo_to_user_n(fifo, to, n, l, recsize);
|
||||
}
|
||||
|
||||
/**
|
||||
* kfifo_to_user_rec - gets data from the FIFO and write it to user space
|
||||
* @fifo: the fifo to be used.
|
||||
* @to: where the data must be copied.
|
||||
* @n: the size of the destination buffer.
|
||||
* @recsize: size of record field
|
||||
* @total: pointer where the total number of to copied bytes should stored
|
||||
*
|
||||
* This function copies at most @n bytes from the FIFO to the @to.
|
||||
* In case of an error, the function returns the number of bytes which cannot
|
||||
* be copied.
|
||||
* If the returned value is equal or less the @n value, the copy_to_user()
|
||||
* functions has failed. Otherwise the record doesn't fit into the @to buffer.
|
||||
*
|
||||
* Note that with only one concurrent reader and one concurrent
|
||||
* writer, you don't need extra locking to use these functions.
|
||||
*/
|
||||
static inline __must_check unsigned int kfifo_to_user_rec(struct kfifo *fifo,
|
||||
void __user *to, unsigned int n, unsigned int recsize,
|
||||
unsigned int *total)
|
||||
{
|
||||
if (!__builtin_constant_p(recsize))
|
||||
return __kfifo_to_user_generic(fifo, to, n, recsize, total);
|
||||
return __kfifo_to_user_rec(fifo, to, n, recsize, total);
|
||||
}
|
||||
|
||||
/*
|
||||
* __kfifo_peek_... internal functions for peek into the next fifo record
|
||||
* do not call it directly, use kfifo_peek_rec() instead
|
||||
*/
|
||||
extern unsigned int __kfifo_peek_generic(struct kfifo *fifo,
|
||||
unsigned int recsize);
|
||||
|
||||
/**
|
||||
* kfifo_peek_rec - gets the size of the next FIFO record data
|
||||
* @fifo: the fifo to be used.
|
||||
* @recsize: size of record field
|
||||
*
|
||||
* This function returns the size of the next FIFO record in number of bytes
|
||||
*/
|
||||
static inline __must_check unsigned int kfifo_peek_rec(struct kfifo *fifo,
|
||||
unsigned int recsize)
|
||||
{
|
||||
if (!__builtin_constant_p(recsize))
|
||||
return __kfifo_peek_generic(fifo, recsize);
|
||||
if (!recsize)
|
||||
return kfifo_len(fifo);
|
||||
return __kfifo_peek_n(fifo, recsize);
|
||||
}
|
||||
|
||||
/*
|
||||
* __kfifo_skip_... internal functions for skip the next fifo record
|
||||
* do not call it directly, use kfifo_skip_rec() instead
|
||||
*/
|
||||
extern void __kfifo_skip_generic(struct kfifo *fifo, unsigned int recsize);
|
||||
|
||||
static inline void __kfifo_skip_rec(struct kfifo *fifo,
|
||||
unsigned int recsize)
|
||||
{
|
||||
unsigned int l;
|
||||
|
||||
if (recsize) {
|
||||
l = __kfifo_peek_n(fifo, recsize);
|
||||
|
||||
if (l + recsize <= kfifo_len(fifo)) {
|
||||
__kfifo_add_out(fifo, l + recsize);
|
||||
return;
|
||||
}
|
||||
}
|
||||
kfifo_reset_out(fifo);
|
||||
}
|
||||
|
||||
/**
|
||||
* kfifo_skip_rec - skip the next fifo out record
|
||||
* @fifo: the fifo to be used.
|
||||
* @recsize: size of record field
|
||||
*
|
||||
* This function skips the next FIFO record
|
||||
*/
|
||||
static inline void kfifo_skip_rec(struct kfifo *fifo,
|
||||
unsigned int recsize)
|
||||
{
|
||||
if (!__builtin_constant_p(recsize))
|
||||
__kfifo_skip_generic(fifo, recsize);
|
||||
else
|
||||
__kfifo_skip_rec(fifo, recsize);
|
||||
}
|
||||
|
||||
/**
|
||||
* kfifo_avail_rec - returns the number of bytes available in a record FIFO
|
||||
* @fifo: the fifo to be used.
|
||||
* @recsize: size of record field
|
||||
*/
|
||||
static inline __must_check unsigned int kfifo_avail_rec(struct kfifo *fifo,
|
||||
unsigned int recsize)
|
||||
{
|
||||
unsigned int l = kfifo_size(fifo) - kfifo_len(fifo);
|
||||
|
||||
return (l > recsize) ? l - recsize : 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -29,8 +29,7 @@ struct pt_regs;
|
||||
*
|
||||
* On some architectures it is required to skip a breakpoint
|
||||
* exception when it occurs after a breakpoint has been removed.
|
||||
* This can be implemented in the architecture specific portion of
|
||||
* for kgdb.
|
||||
* This can be implemented in the architecture specific portion of kgdb.
|
||||
*/
|
||||
extern int kgdb_skipexception(int exception, struct pt_regs *regs);
|
||||
|
||||
@@ -65,7 +64,7 @@ struct uart_port;
|
||||
/**
|
||||
* kgdb_breakpoint - compiled in breakpoint
|
||||
*
|
||||
* This will be impelmented a static inline per architecture. This
|
||||
* This will be implemented as a static inline per architecture. This
|
||||
* function is called by the kgdb core to execute an architecture
|
||||
* specific trap to cause kgdb to enter the exception processing.
|
||||
*
|
||||
@@ -190,7 +189,7 @@ kgdb_arch_handle_exception(int vector, int signo, int err_code,
|
||||
* @flags: Current IRQ state
|
||||
*
|
||||
* On SMP systems, we need to get the attention of the other CPUs
|
||||
* and get them be in a known state. This should do what is needed
|
||||
* and get them into a known state. This should do what is needed
|
||||
* to get the other CPUs to call kgdb_wait(). Note that on some arches,
|
||||
* the NMI approach is not used for rounding up all the CPUs. For example,
|
||||
* in case of MIPS, smp_call_function() is used to roundup CPUs. In
|
||||
|
||||
+59
-53
@@ -36,6 +36,56 @@ int kmemcheck_hide_addr(unsigned long address);
|
||||
|
||||
bool kmemcheck_is_obj_initialized(unsigned long addr, size_t size);
|
||||
|
||||
/*
|
||||
* Bitfield annotations
|
||||
*
|
||||
* How to use: If you have a struct using bitfields, for example
|
||||
*
|
||||
* struct a {
|
||||
* int x:8, y:8;
|
||||
* };
|
||||
*
|
||||
* then this should be rewritten as
|
||||
*
|
||||
* struct a {
|
||||
* kmemcheck_bitfield_begin(flags);
|
||||
* int x:8, y:8;
|
||||
* kmemcheck_bitfield_end(flags);
|
||||
* };
|
||||
*
|
||||
* Now the "flags_begin" and "flags_end" members may be used to refer to the
|
||||
* beginning and end, respectively, of the bitfield (and things like
|
||||
* &x.flags_begin is allowed). As soon as the struct is allocated, the bit-
|
||||
* fields should be annotated:
|
||||
*
|
||||
* struct a *a = kmalloc(sizeof(struct a), GFP_KERNEL);
|
||||
* kmemcheck_annotate_bitfield(a, flags);
|
||||
*/
|
||||
#define kmemcheck_bitfield_begin(name) \
|
||||
int name##_begin[0];
|
||||
|
||||
#define kmemcheck_bitfield_end(name) \
|
||||
int name##_end[0];
|
||||
|
||||
#define kmemcheck_annotate_bitfield(ptr, name) \
|
||||
do { \
|
||||
int _n; \
|
||||
\
|
||||
if (!ptr) \
|
||||
break; \
|
||||
\
|
||||
_n = (long) &((ptr)->name##_end) \
|
||||
- (long) &((ptr)->name##_begin); \
|
||||
MAYBE_BUILD_BUG_ON(_n < 0); \
|
||||
\
|
||||
kmemcheck_mark_initialized(&((ptr)->name##_begin), _n); \
|
||||
} while (0)
|
||||
|
||||
#define kmemcheck_annotate_variable(var) \
|
||||
do { \
|
||||
kmemcheck_mark_initialized(&(var), sizeof(var)); \
|
||||
} while (0) \
|
||||
|
||||
#else
|
||||
#define kmemcheck_enabled 0
|
||||
|
||||
@@ -106,60 +156,16 @@ static inline bool kmemcheck_is_obj_initialized(unsigned long addr, size_t size)
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_KMEMCHECK */
|
||||
|
||||
/*
|
||||
* Bitfield annotations
|
||||
*
|
||||
* How to use: If you have a struct using bitfields, for example
|
||||
*
|
||||
* struct a {
|
||||
* int x:8, y:8;
|
||||
* };
|
||||
*
|
||||
* then this should be rewritten as
|
||||
*
|
||||
* struct a {
|
||||
* kmemcheck_bitfield_begin(flags);
|
||||
* int x:8, y:8;
|
||||
* kmemcheck_bitfield_end(flags);
|
||||
* };
|
||||
*
|
||||
* Now the "flags_begin" and "flags_end" members may be used to refer to the
|
||||
* beginning and end, respectively, of the bitfield (and things like
|
||||
* &x.flags_begin is allowed). As soon as the struct is allocated, the bit-
|
||||
* fields should be annotated:
|
||||
*
|
||||
* struct a *a = kmalloc(sizeof(struct a), GFP_KERNEL);
|
||||
* kmemcheck_annotate_bitfield(a, flags);
|
||||
*
|
||||
* Note: We provide the same definitions for both kmemcheck and non-
|
||||
* kmemcheck kernels. This makes it harder to introduce accidental errors. It
|
||||
* is also allowed to pass NULL pointers to kmemcheck_annotate_bitfield().
|
||||
*/
|
||||
#define kmemcheck_bitfield_begin(name) \
|
||||
int name##_begin[0];
|
||||
|
||||
#define kmemcheck_bitfield_end(name) \
|
||||
int name##_end[0];
|
||||
|
||||
#define kmemcheck_annotate_bitfield(ptr, name) \
|
||||
do { \
|
||||
int _n; \
|
||||
\
|
||||
if (!ptr) \
|
||||
break; \
|
||||
\
|
||||
_n = (long) &((ptr)->name##_end) \
|
||||
- (long) &((ptr)->name##_begin); \
|
||||
MAYBE_BUILD_BUG_ON(_n < 0); \
|
||||
\
|
||||
kmemcheck_mark_initialized(&((ptr)->name##_begin), _n); \
|
||||
#define kmemcheck_bitfield_begin(name)
|
||||
#define kmemcheck_bitfield_end(name)
|
||||
#define kmemcheck_annotate_bitfield(ptr, name) \
|
||||
do { \
|
||||
} while (0)
|
||||
|
||||
#define kmemcheck_annotate_variable(var) \
|
||||
do { \
|
||||
kmemcheck_mark_initialized(&(var), sizeof(var)); \
|
||||
} while (0) \
|
||||
#define kmemcheck_annotate_variable(var) \
|
||||
do { \
|
||||
} while (0)
|
||||
|
||||
#endif /* CONFIG_KMEMCHECK */
|
||||
|
||||
#endif /* LINUX_KMEMCHECK_H */
|
||||
|
||||
@@ -32,8 +32,7 @@ extern void kmemleak_padding(const void *ptr, unsigned long offset,
|
||||
size_t size) __ref;
|
||||
extern void kmemleak_not_leak(const void *ptr) __ref;
|
||||
extern void kmemleak_ignore(const void *ptr) __ref;
|
||||
extern void kmemleak_scan_area(const void *ptr, unsigned long offset,
|
||||
size_t length, gfp_t gfp) __ref;
|
||||
extern void kmemleak_scan_area(const void *ptr, size_t size, gfp_t gfp) __ref;
|
||||
extern void kmemleak_no_scan(const void *ptr) __ref;
|
||||
|
||||
static inline void kmemleak_alloc_recursive(const void *ptr, size_t size,
|
||||
@@ -84,8 +83,7 @@ static inline void kmemleak_not_leak(const void *ptr)
|
||||
static inline void kmemleak_ignore(const void *ptr)
|
||||
{
|
||||
}
|
||||
static inline void kmemleak_scan_area(const void *ptr, unsigned long offset,
|
||||
size_t length, gfp_t gfp)
|
||||
static inline void kmemleak_scan_area(const void *ptr, size_t size, gfp_t gfp)
|
||||
{
|
||||
}
|
||||
static inline void kmemleak_erase(void **ptr)
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* linux/include/kmsg_dump.h
|
||||
*
|
||||
* Copyright (C) 2009 Net Insight AB
|
||||
*
|
||||
* Author: Simon Kagstrom <simon.kagstrom@netinsight.net>
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU General Public
|
||||
* License. See the file COPYING in the main directory of this archive
|
||||
* for more details.
|
||||
*/
|
||||
#ifndef _LINUX_KMSG_DUMP_H
|
||||
#define _LINUX_KMSG_DUMP_H
|
||||
|
||||
#include <linux/list.h>
|
||||
|
||||
enum kmsg_dump_reason {
|
||||
KMSG_DUMP_OOPS,
|
||||
KMSG_DUMP_PANIC,
|
||||
};
|
||||
|
||||
/**
|
||||
* struct kmsg_dumper - kernel crash message dumper structure
|
||||
* @dump: The callback which gets called on crashes. The buffer is passed
|
||||
* as two sections, where s1 (length l1) contains the older
|
||||
* messages and s2 (length l2) contains the newer.
|
||||
* @list: Entry in the dumper list (private)
|
||||
* @registered: Flag that specifies if this is already registered
|
||||
*/
|
||||
struct kmsg_dumper {
|
||||
void (*dump)(struct kmsg_dumper *dumper, enum kmsg_dump_reason reason,
|
||||
const char *s1, unsigned long l1,
|
||||
const char *s2, unsigned long l2);
|
||||
struct list_head list;
|
||||
int registered;
|
||||
};
|
||||
|
||||
#ifdef CONFIG_PRINTK
|
||||
void kmsg_dump(enum kmsg_dump_reason reason);
|
||||
|
||||
int kmsg_dump_register(struct kmsg_dumper *dumper);
|
||||
|
||||
int kmsg_dump_unregister(struct kmsg_dumper *dumper);
|
||||
#else
|
||||
static inline void kmsg_dump(enum kmsg_dump_reason reason)
|
||||
{
|
||||
}
|
||||
|
||||
static inline int kmsg_dump_register(struct kmsg_dumper *dumper)
|
||||
{
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
static inline int kmsg_dump_unregister(struct kmsg_dumper *dumper)
|
||||
{
|
||||
return -EINVAL;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _LINUX_KMSG_DUMP_H */
|
||||
+85
-17
@@ -9,8 +9,12 @@
|
||||
|
||||
#include <linux/bitops.h>
|
||||
#include <linux/mm.h>
|
||||
#include <linux/pagemap.h>
|
||||
#include <linux/rmap.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/vmstat.h>
|
||||
|
||||
struct stable_node;
|
||||
struct mem_cgroup;
|
||||
|
||||
#ifdef CONFIG_KSM
|
||||
int ksm_madvise(struct vm_area_struct *vma, unsigned long start,
|
||||
@@ -34,31 +38,62 @@ static inline void ksm_exit(struct mm_struct *mm)
|
||||
/*
|
||||
* A KSM page is one of those write-protected "shared pages" or "merged pages"
|
||||
* which KSM maps into multiple mms, wherever identical anonymous page content
|
||||
* is found in VM_MERGEABLE vmas. It's a PageAnon page, with NULL anon_vma.
|
||||
* is found in VM_MERGEABLE vmas. It's a PageAnon page, pointing not to any
|
||||
* anon_vma, but to that page's node of the stable tree.
|
||||
*/
|
||||
static inline int PageKsm(struct page *page)
|
||||
{
|
||||
return ((unsigned long)page->mapping == PAGE_MAPPING_ANON);
|
||||
return ((unsigned long)page->mapping & PAGE_MAPPING_FLAGS) ==
|
||||
(PAGE_MAPPING_ANON | PAGE_MAPPING_KSM);
|
||||
}
|
||||
|
||||
static inline struct stable_node *page_stable_node(struct page *page)
|
||||
{
|
||||
return PageKsm(page) ? page_rmapping(page) : NULL;
|
||||
}
|
||||
|
||||
static inline void set_page_stable_node(struct page *page,
|
||||
struct stable_node *stable_node)
|
||||
{
|
||||
page->mapping = (void *)stable_node +
|
||||
(PAGE_MAPPING_ANON | PAGE_MAPPING_KSM);
|
||||
}
|
||||
|
||||
/*
|
||||
* But we have to avoid the checking which page_add_anon_rmap() performs.
|
||||
* When do_swap_page() first faults in from swap what used to be a KSM page,
|
||||
* no problem, it will be assigned to this vma's anon_vma; but thereafter,
|
||||
* it might be faulted into a different anon_vma (or perhaps to a different
|
||||
* offset in the same anon_vma). do_swap_page() cannot do all the locking
|
||||
* needed to reconstitute a cross-anon_vma KSM page: for now it has to make
|
||||
* a copy, and leave remerging the pages to a later pass of ksmd.
|
||||
*
|
||||
* We'd like to make this conditional on vma->vm_flags & VM_MERGEABLE,
|
||||
* but what if the vma was unmerged while the page was swapped out?
|
||||
*/
|
||||
static inline void page_add_ksm_rmap(struct page *page)
|
||||
struct page *ksm_does_need_to_copy(struct page *page,
|
||||
struct vm_area_struct *vma, unsigned long address);
|
||||
static inline struct page *ksm_might_need_to_copy(struct page *page,
|
||||
struct vm_area_struct *vma, unsigned long address)
|
||||
{
|
||||
if (atomic_inc_and_test(&page->_mapcount)) {
|
||||
page->mapping = (void *) PAGE_MAPPING_ANON;
|
||||
__inc_zone_page_state(page, NR_ANON_PAGES);
|
||||
}
|
||||
}
|
||||
#else /* !CONFIG_KSM */
|
||||
struct anon_vma *anon_vma = page_anon_vma(page);
|
||||
|
||||
static inline int ksm_madvise(struct vm_area_struct *vma, unsigned long start,
|
||||
unsigned long end, int advice, unsigned long *vm_flags)
|
||||
{
|
||||
return 0;
|
||||
if (!anon_vma ||
|
||||
(anon_vma == vma->anon_vma &&
|
||||
page->index == linear_page_index(vma, address)))
|
||||
return page;
|
||||
|
||||
return ksm_does_need_to_copy(page, vma, address);
|
||||
}
|
||||
|
||||
int page_referenced_ksm(struct page *page,
|
||||
struct mem_cgroup *memcg, unsigned long *vm_flags);
|
||||
int try_to_unmap_ksm(struct page *page, enum ttu_flags flags);
|
||||
int rmap_walk_ksm(struct page *page, int (*rmap_one)(struct page *,
|
||||
struct vm_area_struct *, unsigned long, void *), void *arg);
|
||||
void ksm_migrate_page(struct page *newpage, struct page *oldpage);
|
||||
|
||||
#else /* !CONFIG_KSM */
|
||||
|
||||
static inline int ksm_fork(struct mm_struct *mm, struct mm_struct *oldmm)
|
||||
{
|
||||
return 0;
|
||||
@@ -73,7 +108,40 @@ static inline int PageKsm(struct page *page)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* No stub required for page_add_ksm_rmap(page) */
|
||||
#ifdef CONFIG_MMU
|
||||
static inline int ksm_madvise(struct vm_area_struct *vma, unsigned long start,
|
||||
unsigned long end, int advice, unsigned long *vm_flags)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline struct page *ksm_might_need_to_copy(struct page *page,
|
||||
struct vm_area_struct *vma, unsigned long address)
|
||||
{
|
||||
return page;
|
||||
}
|
||||
|
||||
static inline int page_referenced_ksm(struct page *page,
|
||||
struct mem_cgroup *memcg, unsigned long *vm_flags)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int try_to_unmap_ksm(struct page *page, enum ttu_flags flags)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int rmap_walk_ksm(struct page *page, int (*rmap_one)(struct page*,
|
||||
struct vm_area_struct *, unsigned long, void *), void *arg)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void ksm_migrate_page(struct page *newpage, struct page *oldpage)
|
||||
{
|
||||
}
|
||||
#endif /* CONFIG_MMU */
|
||||
#endif /* !CONFIG_KSM */
|
||||
|
||||
#endif
|
||||
#endif /* __LINUX_KSM_H */
|
||||
|
||||
@@ -496,6 +496,7 @@ struct kvm_ioeventfd {
|
||||
#define KVM_CAP_VCPU_EVENTS 41
|
||||
#endif
|
||||
#define KVM_CAP_S390_PSW 42
|
||||
#define KVM_CAP_PPC_SEGSTATE 43
|
||||
|
||||
#ifdef KVM_CAP_IRQ_ROUTING
|
||||
|
||||
|
||||
@@ -12,9 +12,6 @@
|
||||
#ifndef __LINUX_LEDS_LP3944_H
|
||||
#define __LINUX_LEDS_LP3944_H
|
||||
|
||||
#include <linux/leds.h>
|
||||
#include <linux/workqueue.h>
|
||||
|
||||
#define LP3944_LED0 0
|
||||
#define LP3944_LED1 1
|
||||
#define LP3944_LED2 2
|
||||
|
||||
@@ -32,7 +32,7 @@ struct pca9532_led {
|
||||
struct i2c_client *client;
|
||||
char *name;
|
||||
struct led_classdev ldev;
|
||||
struct work_struct work;
|
||||
struct work_struct work;
|
||||
enum pca9532_type type;
|
||||
enum pca9532_state state;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* leds-regulator.h - platform data structure for regulator driven LEDs.
|
||||
*
|
||||
* Copyright (C) 2009 Antonio Ospite <ospite@studenti.unina.it>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __LINUX_LEDS_REGULATOR_H
|
||||
#define __LINUX_LEDS_REGULATOR_H
|
||||
|
||||
/*
|
||||
* Use "vled" as supply id when declaring the regulator consumer:
|
||||
*
|
||||
* static struct regulator_consumer_supply pcap_regulator_VVIB_consumers [] = {
|
||||
* { .dev_name = "leds-regulator.0", supply = "vled" },
|
||||
* };
|
||||
*
|
||||
* If you have several regulator driven LEDs, you can append a numerical id to
|
||||
* .dev_name as done above, and use the same id when declaring the platform
|
||||
* device:
|
||||
*
|
||||
* static struct led_regulator_platform_data a780_vibrator_data = {
|
||||
* .name = "a780::vibrator",
|
||||
* };
|
||||
*
|
||||
* static struct platform_device a780_vibrator = {
|
||||
* .name = "leds-regulator",
|
||||
* .id = 0,
|
||||
* .dev = {
|
||||
* .platform_data = &a780_vibrator_data,
|
||||
* },
|
||||
* };
|
||||
*/
|
||||
|
||||
#include <linux/leds.h>
|
||||
|
||||
struct led_regulator_platform_data {
|
||||
char *name; /* LED name as expected by LED class */
|
||||
enum led_brightness brightness; /* initial brightness value */
|
||||
};
|
||||
|
||||
#endif /* __LINUX_LEDS_REGULATOR_H */
|
||||
@@ -354,6 +354,9 @@ enum {
|
||||
/* max tries if error condition is still set after ->error_handler */
|
||||
ATA_EH_MAX_TRIES = 5,
|
||||
|
||||
/* sometimes resuming a link requires several retries */
|
||||
ATA_LINK_RESUME_TRIES = 5,
|
||||
|
||||
/* how hard are we gonna try to probe/recover devices */
|
||||
ATA_PROBE_MAX_TRIES = 3,
|
||||
ATA_EH_DEV_TRIES = 3,
|
||||
|
||||
@@ -43,6 +43,21 @@ struct lis3lv02d_platform_data {
|
||||
#define LIS3_WAKEUP_Z_HI (1 << 5)
|
||||
unsigned char wakeup_flags;
|
||||
unsigned char wakeup_thresh;
|
||||
#define LIS3_NO_MAP 0
|
||||
#define LIS3_DEV_X 1
|
||||
#define LIS3_DEV_Y 2
|
||||
#define LIS3_DEV_Z 3
|
||||
#define LIS3_INV_DEV_X -1
|
||||
#define LIS3_INV_DEV_Y -2
|
||||
#define LIS3_INV_DEV_Z -3
|
||||
s8 axis_x;
|
||||
s8 axis_y;
|
||||
s8 axis_z;
|
||||
int (*setup_resources)(void);
|
||||
int (*release_resources)(void);
|
||||
/* Limits for selftest are specified in chip data sheet */
|
||||
s16 st_min_limits[3]; /* min pass limit x, y, z */
|
||||
s16 st_max_limits[3]; /* max pass limit x, y, z */
|
||||
};
|
||||
|
||||
#endif /* __LIS3LV02D_H_ */
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
#ifndef _LINUX_LIST_SORT_H
|
||||
#define _LINUX_LIST_SORT_H
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
struct list_head;
|
||||
|
||||
void list_sort(void *priv, struct list_head *head,
|
||||
int (*cmp)(void *priv, struct list_head *a,
|
||||
struct list_head *b));
|
||||
#endif
|
||||
@@ -54,6 +54,7 @@ extern u64 __init lmb_phys_mem_size(void);
|
||||
extern u64 lmb_end_of_DRAM(void);
|
||||
extern void __init lmb_enforce_memory_limit(u64 memory_limit);
|
||||
extern int __init lmb_is_reserved(u64 addr);
|
||||
extern int lmb_is_region_reserved(u64 base, u64 size);
|
||||
extern int lmb_find(struct lmb_property *res);
|
||||
|
||||
extern void lmb_dump_all(void);
|
||||
|
||||
@@ -54,6 +54,11 @@ extern void mem_cgroup_rotate_lru_list(struct page *page, enum lru_list lru);
|
||||
extern void mem_cgroup_del_lru(struct page *page);
|
||||
extern void mem_cgroup_move_lists(struct page *page,
|
||||
enum lru_list from, enum lru_list to);
|
||||
|
||||
/* For coalescing uncharge for reducing memcg' overhead*/
|
||||
extern void mem_cgroup_uncharge_start(void);
|
||||
extern void mem_cgroup_uncharge_end(void);
|
||||
|
||||
extern void mem_cgroup_uncharge_page(struct page *page);
|
||||
extern void mem_cgroup_uncharge_cache_page(struct page *page);
|
||||
extern int mem_cgroup_shmem_charge_fallback(struct page *page,
|
||||
@@ -68,6 +73,7 @@ extern unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan,
|
||||
extern void mem_cgroup_out_of_memory(struct mem_cgroup *mem, gfp_t gfp_mask);
|
||||
int task_in_mem_cgroup(struct task_struct *task, const struct mem_cgroup *mem);
|
||||
|
||||
extern struct mem_cgroup *try_get_mem_cgroup_from_page(struct page *page);
|
||||
extern struct mem_cgroup *mem_cgroup_from_task(struct task_struct *p);
|
||||
|
||||
static inline
|
||||
@@ -80,6 +86,8 @@ int mm_match_cgroup(const struct mm_struct *mm, const struct mem_cgroup *cgroup)
|
||||
return cgroup == mem;
|
||||
}
|
||||
|
||||
extern struct cgroup_subsys_state *mem_cgroup_css(struct mem_cgroup *mem);
|
||||
|
||||
extern int
|
||||
mem_cgroup_prepare_migration(struct page *page, struct mem_cgroup **ptr);
|
||||
extern void mem_cgroup_end_migration(struct mem_cgroup *mem,
|
||||
@@ -117,7 +125,7 @@ static inline bool mem_cgroup_disabled(void)
|
||||
}
|
||||
|
||||
extern bool mem_cgroup_oom_called(struct task_struct *task);
|
||||
void mem_cgroup_update_mapped_file_stat(struct page *page, int val);
|
||||
void mem_cgroup_update_file_mapped(struct page *page, int val);
|
||||
unsigned long mem_cgroup_soft_limit_reclaim(struct zone *zone, int order,
|
||||
gfp_t gfp_mask, int nid,
|
||||
int zid);
|
||||
@@ -151,6 +159,14 @@ static inline void mem_cgroup_cancel_charge_swapin(struct mem_cgroup *ptr)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void mem_cgroup_uncharge_start(void)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void mem_cgroup_uncharge_end(void)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void mem_cgroup_uncharge_page(struct page *page)
|
||||
{
|
||||
}
|
||||
@@ -189,6 +205,11 @@ mem_cgroup_move_lists(struct page *page, enum lru_list from, enum lru_list to)
|
||||
{
|
||||
}
|
||||
|
||||
static inline struct mem_cgroup *try_get_mem_cgroup_from_page(struct page *page)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline int mm_match_cgroup(struct mm_struct *mm, struct mem_cgroup *mem)
|
||||
{
|
||||
return 1;
|
||||
@@ -200,6 +221,11 @@ static inline int task_in_mem_cgroup(struct task_struct *task,
|
||||
return 1;
|
||||
}
|
||||
|
||||
static inline struct cgroup_subsys_state *mem_cgroup_css(struct mem_cgroup *mem)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline int
|
||||
mem_cgroup_prepare_migration(struct page *page, struct mem_cgroup **ptr)
|
||||
{
|
||||
@@ -274,7 +300,7 @@ mem_cgroup_print_oom_info(struct mem_cgroup *memcg, struct task_struct *p)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void mem_cgroup_update_mapped_file_stat(struct page *page,
|
||||
static inline void mem_cgroup_update_file_mapped(struct page *page,
|
||||
int val)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -50,6 +50,19 @@ struct memory_notify {
|
||||
int status_change_nid;
|
||||
};
|
||||
|
||||
/*
|
||||
* During pageblock isolation, count the number of pages within the
|
||||
* range [start_pfn, start_pfn + nr_pages) which are owned by code
|
||||
* in the notifier chain.
|
||||
*/
|
||||
#define MEM_ISOLATE_COUNT (1<<0)
|
||||
|
||||
struct memory_isolate_notify {
|
||||
unsigned long start_pfn; /* Start of range to check */
|
||||
unsigned int nr_pages; /* # pages in range to check */
|
||||
unsigned int pages_found; /* # pages owned found by callbacks */
|
||||
};
|
||||
|
||||
struct notifier_block;
|
||||
struct mem_section;
|
||||
|
||||
@@ -76,14 +89,28 @@ static inline int memory_notify(unsigned long val, void *v)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
static inline int register_memory_isolate_notifier(struct notifier_block *nb)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
static inline void unregister_memory_isolate_notifier(struct notifier_block *nb)
|
||||
{
|
||||
}
|
||||
static inline int memory_isolate_notify(unsigned long val, void *v)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
extern int register_memory_notifier(struct notifier_block *nb);
|
||||
extern void unregister_memory_notifier(struct notifier_block *nb);
|
||||
extern int register_memory_isolate_notifier(struct notifier_block *nb);
|
||||
extern void unregister_memory_isolate_notifier(struct notifier_block *nb);
|
||||
extern int register_new_memory(int, struct mem_section *);
|
||||
extern int unregister_memory_section(struct mem_section *);
|
||||
extern int memory_dev_init(void);
|
||||
extern int remove_memory_block(unsigned long, struct mem_section *, int);
|
||||
extern int memory_notify(unsigned long val, void *v);
|
||||
extern int memory_isolate_notify(unsigned long val, void *v);
|
||||
extern struct memory_block *find_memory_block(struct mem_section *);
|
||||
#define CONFIG_MEM_BLOCK_SIZE (PAGES_PER_SECTION<<PAGE_SHIFT)
|
||||
enum mem_add_context { BOOT, HOTPLUG };
|
||||
|
||||
@@ -69,7 +69,6 @@ extern void online_page(struct page *page);
|
||||
/* VM interface that may be used by firmware interface */
|
||||
extern int online_pages(unsigned long, unsigned long);
|
||||
extern void __offline_isolated_pages(unsigned long, unsigned long);
|
||||
extern int offline_pages(unsigned long, unsigned long, unsigned long);
|
||||
|
||||
/* reasonably generic interface to expand the physical pages in a zone */
|
||||
extern int __add_pages(int nid, struct zone *zone, unsigned long start_pfn,
|
||||
|
||||
@@ -201,6 +201,7 @@ extern void mpol_fix_fork_child_flag(struct task_struct *p);
|
||||
extern struct zonelist *huge_zonelist(struct vm_area_struct *vma,
|
||||
unsigned long addr, gfp_t gfp_flags,
|
||||
struct mempolicy **mpol, nodemask_t **nodemask);
|
||||
extern bool init_nodemask_of_mempolicy(nodemask_t *mask);
|
||||
extern unsigned slab_node(struct mempolicy *policy);
|
||||
|
||||
extern enum zone_type policy_zone;
|
||||
@@ -328,6 +329,8 @@ static inline struct zonelist *huge_zonelist(struct vm_area_struct *vma,
|
||||
return node_zonelist(0, gfp_flags);
|
||||
}
|
||||
|
||||
static inline bool init_nodemask_of_mempolicy(nodemask_t *m) { return false; }
|
||||
|
||||
static inline int do_migrate_pages(struct mm_struct *mm,
|
||||
const nodemask_t *from_nodes,
|
||||
const nodemask_t *to_nodes, int flags)
|
||||
|
||||
@@ -0,0 +1,217 @@
|
||||
/*
|
||||
* Marvell 88PM8607 Interface
|
||||
*
|
||||
* Copyright (C) 2009 Marvell International Ltd.
|
||||
* Haojian Zhuang <haojian.zhuang@marvell.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#ifndef __LINUX_MFD_88PM8607_H
|
||||
#define __LINUX_MFD_88PM8607_H
|
||||
|
||||
enum {
|
||||
PM8607_ID_BUCK1 = 0,
|
||||
PM8607_ID_BUCK2,
|
||||
PM8607_ID_BUCK3,
|
||||
|
||||
PM8607_ID_LDO1,
|
||||
PM8607_ID_LDO2,
|
||||
PM8607_ID_LDO3,
|
||||
PM8607_ID_LDO4,
|
||||
PM8607_ID_LDO5,
|
||||
PM8607_ID_LDO6,
|
||||
PM8607_ID_LDO7,
|
||||
PM8607_ID_LDO8,
|
||||
PM8607_ID_LDO9,
|
||||
PM8607_ID_LDO10,
|
||||
PM8607_ID_LDO12,
|
||||
PM8607_ID_LDO14,
|
||||
|
||||
PM8607_ID_RG_MAX,
|
||||
};
|
||||
|
||||
#define CHIP_ID (0x40)
|
||||
#define CHIP_ID_MASK (0xF8)
|
||||
|
||||
/* Interrupt Registers */
|
||||
#define PM8607_STATUS_1 (0x01)
|
||||
#define PM8607_STATUS_2 (0x02)
|
||||
#define PM8607_INT_STATUS1 (0x03)
|
||||
#define PM8607_INT_STATUS2 (0x04)
|
||||
#define PM8607_INT_STATUS3 (0x05)
|
||||
#define PM8607_INT_MASK_1 (0x06)
|
||||
#define PM8607_INT_MASK_2 (0x07)
|
||||
#define PM8607_INT_MASK_3 (0x08)
|
||||
|
||||
/* Regulator Control Registers */
|
||||
#define PM8607_LDO1 (0x10)
|
||||
#define PM8607_LDO2 (0x11)
|
||||
#define PM8607_LDO3 (0x12)
|
||||
#define PM8607_LDO4 (0x13)
|
||||
#define PM8607_LDO5 (0x14)
|
||||
#define PM8607_LDO6 (0x15)
|
||||
#define PM8607_LDO7 (0x16)
|
||||
#define PM8607_LDO8 (0x17)
|
||||
#define PM8607_LDO9 (0x18)
|
||||
#define PM8607_LDO10 (0x19)
|
||||
#define PM8607_LDO12 (0x1A)
|
||||
#define PM8607_LDO14 (0x1B)
|
||||
#define PM8607_SLEEP_MODE1 (0x1C)
|
||||
#define PM8607_SLEEP_MODE2 (0x1D)
|
||||
#define PM8607_SLEEP_MODE3 (0x1E)
|
||||
#define PM8607_SLEEP_MODE4 (0x1F)
|
||||
#define PM8607_GO (0x20)
|
||||
#define PM8607_SLEEP_BUCK1 (0x21)
|
||||
#define PM8607_SLEEP_BUCK2 (0x22)
|
||||
#define PM8607_SLEEP_BUCK3 (0x23)
|
||||
#define PM8607_BUCK1 (0x24)
|
||||
#define PM8607_BUCK2 (0x25)
|
||||
#define PM8607_BUCK3 (0x26)
|
||||
#define PM8607_BUCK_CONTROLS (0x27)
|
||||
#define PM8607_SUPPLIES_EN11 (0x2B)
|
||||
#define PM8607_SUPPLIES_EN12 (0x2C)
|
||||
#define PM8607_GROUP1 (0x2D)
|
||||
#define PM8607_GROUP2 (0x2E)
|
||||
#define PM8607_GROUP3 (0x2F)
|
||||
#define PM8607_GROUP4 (0x30)
|
||||
#define PM8607_GROUP5 (0x31)
|
||||
#define PM8607_GROUP6 (0x32)
|
||||
#define PM8607_SUPPLIES_EN21 (0x33)
|
||||
#define PM8607_SUPPLIES_EN22 (0x34)
|
||||
|
||||
/* RTC Control Registers */
|
||||
#define PM8607_RTC1 (0xA0)
|
||||
#define PM8607_RTC_COUNTER1 (0xA1)
|
||||
#define PM8607_RTC_COUNTER2 (0xA2)
|
||||
#define PM8607_RTC_COUNTER3 (0xA3)
|
||||
#define PM8607_RTC_COUNTER4 (0xA4)
|
||||
#define PM8607_RTC_EXPIRE1 (0xA5)
|
||||
#define PM8607_RTC_EXPIRE2 (0xA6)
|
||||
#define PM8607_RTC_EXPIRE3 (0xA7)
|
||||
#define PM8607_RTC_EXPIRE4 (0xA8)
|
||||
#define PM8607_RTC_TRIM1 (0xA9)
|
||||
#define PM8607_RTC_TRIM2 (0xAA)
|
||||
#define PM8607_RTC_TRIM3 (0xAB)
|
||||
#define PM8607_RTC_TRIM4 (0xAC)
|
||||
#define PM8607_RTC_MISC1 (0xAD)
|
||||
#define PM8607_RTC_MISC2 (0xAE)
|
||||
#define PM8607_RTC_MISC3 (0xAF)
|
||||
|
||||
/* Misc Registers */
|
||||
#define PM8607_CHIP_ID (0x00)
|
||||
#define PM8607_LDO1 (0x10)
|
||||
#define PM8607_DVC3 (0x26)
|
||||
#define PM8607_MISC1 (0x40)
|
||||
|
||||
/* bit definitions for PM8607 events */
|
||||
#define PM8607_EVENT_ONKEY (1 << 0)
|
||||
#define PM8607_EVENT_EXTON (1 << 1)
|
||||
#define PM8607_EVENT_CHG (1 << 2)
|
||||
#define PM8607_EVENT_BAT (1 << 3)
|
||||
#define PM8607_EVENT_RTC (1 << 4)
|
||||
#define PM8607_EVENT_CC (1 << 5)
|
||||
#define PM8607_EVENT_VBAT (1 << 8)
|
||||
#define PM8607_EVENT_VCHG (1 << 9)
|
||||
#define PM8607_EVENT_VSYS (1 << 10)
|
||||
#define PM8607_EVENT_TINT (1 << 11)
|
||||
#define PM8607_EVENT_GPADC0 (1 << 12)
|
||||
#define PM8607_EVENT_GPADC1 (1 << 13)
|
||||
#define PM8607_EVENT_GPADC2 (1 << 14)
|
||||
#define PM8607_EVENT_GPADC3 (1 << 15)
|
||||
#define PM8607_EVENT_AUDIO_SHORT (1 << 16)
|
||||
#define PM8607_EVENT_PEN (1 << 17)
|
||||
#define PM8607_EVENT_HEADSET (1 << 18)
|
||||
#define PM8607_EVENT_HOOK (1 << 19)
|
||||
#define PM8607_EVENT_MICIN (1 << 20)
|
||||
#define PM8607_EVENT_CHG_TIMEOUT (1 << 21)
|
||||
#define PM8607_EVENT_CHG_DONE (1 << 22)
|
||||
#define PM8607_EVENT_CHG_FAULT (1 << 23)
|
||||
|
||||
/* bit definitions of Status Query Interface */
|
||||
#define PM8607_STATUS_CC (1 << 3)
|
||||
#define PM8607_STATUS_PEN (1 << 4)
|
||||
#define PM8607_STATUS_HEADSET (1 << 5)
|
||||
#define PM8607_STATUS_HOOK (1 << 6)
|
||||
#define PM8607_STATUS_MICIN (1 << 7)
|
||||
#define PM8607_STATUS_ONKEY (1 << 8)
|
||||
#define PM8607_STATUS_EXTON (1 << 9)
|
||||
#define PM8607_STATUS_CHG (1 << 10)
|
||||
#define PM8607_STATUS_BAT (1 << 11)
|
||||
#define PM8607_STATUS_VBUS (1 << 12)
|
||||
#define PM8607_STATUS_OV (1 << 13)
|
||||
|
||||
/* bit definitions of BUCK3 */
|
||||
#define PM8607_BUCK3_DOUBLE (1 << 6)
|
||||
|
||||
/* bit definitions of Misc1 */
|
||||
#define PM8607_MISC1_PI2C (1 << 0)
|
||||
|
||||
/* Interrupt Number in 88PM8607 */
|
||||
enum {
|
||||
PM8607_IRQ_ONKEY = 0,
|
||||
PM8607_IRQ_EXTON,
|
||||
PM8607_IRQ_CHG,
|
||||
PM8607_IRQ_BAT,
|
||||
PM8607_IRQ_RTC,
|
||||
PM8607_IRQ_VBAT = 8,
|
||||
PM8607_IRQ_VCHG,
|
||||
PM8607_IRQ_VSYS,
|
||||
PM8607_IRQ_TINT,
|
||||
PM8607_IRQ_GPADC0,
|
||||
PM8607_IRQ_GPADC1,
|
||||
PM8607_IRQ_GPADC2,
|
||||
PM8607_IRQ_GPADC3,
|
||||
PM8607_IRQ_AUDIO_SHORT = 16,
|
||||
PM8607_IRQ_PEN,
|
||||
PM8607_IRQ_HEADSET,
|
||||
PM8607_IRQ_HOOK,
|
||||
PM8607_IRQ_MICIN,
|
||||
PM8607_IRQ_CHG_FAIL,
|
||||
PM8607_IRQ_CHG_DONE,
|
||||
PM8607_IRQ_CHG_FAULT,
|
||||
};
|
||||
|
||||
enum {
|
||||
PM8607_CHIP_A0 = 0x40,
|
||||
PM8607_CHIP_A1 = 0x41,
|
||||
PM8607_CHIP_B0 = 0x48,
|
||||
};
|
||||
|
||||
|
||||
struct pm8607_chip {
|
||||
struct device *dev;
|
||||
struct mutex io_lock;
|
||||
struct i2c_client *client;
|
||||
|
||||
int (*read)(struct pm8607_chip *chip, int reg, int bytes, void *dest);
|
||||
int (*write)(struct pm8607_chip *chip, int reg, int bytes, void *src);
|
||||
|
||||
int buck3_double; /* DVC ramp slope double */
|
||||
unsigned char chip_id;
|
||||
|
||||
};
|
||||
|
||||
#define PM8607_MAX_REGULATOR 15 /* 3 Bucks, 12 LDOs */
|
||||
|
||||
enum {
|
||||
GI2C_PORT = 0,
|
||||
PI2C_PORT,
|
||||
};
|
||||
|
||||
struct pm8607_platform_data {
|
||||
int i2c_port; /* Controlled by GI2C or PI2C */
|
||||
struct regulator_init_data *regulator[PM8607_MAX_REGULATOR];
|
||||
};
|
||||
|
||||
extern int pm8607_reg_read(struct pm8607_chip *, int);
|
||||
extern int pm8607_reg_write(struct pm8607_chip *, int, unsigned char);
|
||||
extern int pm8607_bulk_read(struct pm8607_chip *, int, int,
|
||||
unsigned char *);
|
||||
extern int pm8607_bulk_write(struct pm8607_chip *, int, int,
|
||||
unsigned char *);
|
||||
extern int pm8607_set_bits(struct pm8607_chip *, int, unsigned char,
|
||||
unsigned char);
|
||||
#endif /* __LINUX_MFD_88PM8607_H */
|
||||
@@ -0,0 +1,262 @@
|
||||
/*
|
||||
* Copyright (C) 2009 ST-Ericsson
|
||||
*
|
||||
* Author: Srinidhi KASAGAR <srinidhi.kasagar@stericsson.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* AB4500 device core funtions, for client access
|
||||
*/
|
||||
#ifndef MFD_AB4500_H
|
||||
#define MFD_AB4500_H
|
||||
|
||||
#include <linux/device.h>
|
||||
|
||||
/*
|
||||
* AB4500 bank addresses
|
||||
*/
|
||||
#define AB4500_SYS_CTRL1_BLOCK 0x1
|
||||
#define AB4500_SYS_CTRL2_BLOCK 0x2
|
||||
#define AB4500_REGU_CTRL1 0x3
|
||||
#define AB4500_REGU_CTRL2 0x4
|
||||
#define AB4500_USB 0x5
|
||||
#define AB4500_TVOUT 0x6
|
||||
#define AB4500_DBI 0x7
|
||||
#define AB4500_ECI_AV_ACC 0x8
|
||||
#define AB4500_RESERVED 0x9
|
||||
#define AB4500_GPADC 0xA
|
||||
#define AB4500_CHARGER 0xB
|
||||
#define AB4500_GAS_GAUGE 0xC
|
||||
#define AB4500_AUDIO 0xD
|
||||
#define AB4500_INTERRUPT 0xE
|
||||
#define AB4500_RTC 0xF
|
||||
#define AB4500_MISC 0x10
|
||||
#define AB4500_DEBUG 0x12
|
||||
#define AB4500_PROD_TEST 0x13
|
||||
#define AB4500_OTP_EMUL 0x15
|
||||
|
||||
/*
|
||||
* System control 1 register offsets.
|
||||
* Bank = 0x01
|
||||
*/
|
||||
#define AB4500_TURNON_STAT_REG 0x0100
|
||||
#define AB4500_RESET_STAT_REG 0x0101
|
||||
#define AB4500_PONKEY1_PRESS_STAT_REG 0x0102
|
||||
|
||||
#define AB4500_FSM_STAT1_REG 0x0140
|
||||
#define AB4500_FSM_STAT2_REG 0x0141
|
||||
#define AB4500_SYSCLK_REQ_STAT_REG 0x0142
|
||||
#define AB4500_USB_STAT1_REG 0x0143
|
||||
#define AB4500_USB_STAT2_REG 0x0144
|
||||
#define AB4500_STATUS_SPARE1_REG 0x0145
|
||||
#define AB4500_STATUS_SPARE2_REG 0x0146
|
||||
|
||||
#define AB4500_CTRL1_REG 0x0180
|
||||
#define AB4500_CTRL2_REG 0x0181
|
||||
|
||||
/*
|
||||
* System control 2 register offsets.
|
||||
* bank = 0x02
|
||||
*/
|
||||
#define AB4500_CTRL3_REG 0x0200
|
||||
#define AB4500_MAIN_WDOG_CTRL_REG 0x0201
|
||||
#define AB4500_MAIN_WDOG_TIMER_REG 0x0202
|
||||
#define AB4500_LOW_BAT_REG 0x0203
|
||||
#define AB4500_BATT_OK_REG 0x0204
|
||||
#define AB4500_SYSCLK_TIMER_REG 0x0205
|
||||
#define AB4500_SMPSCLK_CTRL_REG 0x0206
|
||||
#define AB4500_SMPSCLK_SEL1_REG 0x0207
|
||||
#define AB4500_SMPSCLK_SEL2_REG 0x0208
|
||||
#define AB4500_SMPSCLK_SEL3_REG 0x0209
|
||||
#define AB4500_SYSULPCLK_CONF_REG 0x020A
|
||||
#define AB4500_SYSULPCLK_CTRL1_REG 0x020B
|
||||
#define AB4500_SYSCLK_CTRL_REG 0x020C
|
||||
#define AB4500_SYSCLK_REQ1_VALID_REG 0x020D
|
||||
#define AB4500_SYSCLK_REQ_VALID_REG 0x020E
|
||||
#define AB4500_SYSCTRL_SPARE_REG 0x020F
|
||||
#define AB4500_PAD_CONF_REG 0x0210
|
||||
|
||||
/*
|
||||
* Regu control1 register offsets
|
||||
* Bank = 0x03
|
||||
*/
|
||||
#define AB4500_REGU_SERIAL_CTRL1_REG 0x0300
|
||||
#define AB4500_REGU_SERIAL_CTRL2_REG 0x0301
|
||||
#define AB4500_REGU_SERIAL_CTRL3_REG 0x0302
|
||||
#define AB4500_REGU_REQ_CTRL1_REG 0x0303
|
||||
#define AB4500_REGU_REQ_CTRL2_REG 0x0304
|
||||
#define AB4500_REGU_REQ_CTRL3_REG 0x0305
|
||||
#define AB4500_REGU_REQ_CTRL4_REG 0x0306
|
||||
#define AB4500_REGU_MISC1_REG 0x0380
|
||||
#define AB4500_REGU_OTGSUPPLY_CTRL_REG 0x0381
|
||||
#define AB4500_REGU_VUSB_CTRL_REG 0x0382
|
||||
#define AB4500_REGU_VAUDIO_SUPPLY_REG 0x0383
|
||||
#define AB4500_REGU_CTRL1_SPARE_REG 0x0384
|
||||
|
||||
/*
|
||||
* Regu control2 Vmod register offsets
|
||||
*/
|
||||
#define AB4500_REGU_VMOD_REGU_REG 0x0440
|
||||
#define AB4500_REGU_VMOD_SEL1_REG 0x0441
|
||||
#define AB4500_REGU_VMOD_SEL2_REG 0x0442
|
||||
#define AB4500_REGU_CTRL_DISCH_REG 0x0443
|
||||
#define AB4500_REGU_CTRL_DISCH2_REG 0x0444
|
||||
|
||||
/*
|
||||
* USB/ULPI register offsets
|
||||
* Bank : 0x5
|
||||
*/
|
||||
#define AB4500_USB_LINE_STAT_REG 0x0580
|
||||
#define AB4500_USB_LINE_CTRL1_REG 0x0581
|
||||
#define AB4500_USB_LINE_CTRL2_REG 0x0582
|
||||
#define AB4500_USB_LINE_CTRL3_REG 0x0583
|
||||
#define AB4500_USB_LINE_CTRL4_REG 0x0584
|
||||
#define AB4500_USB_LINE_CTRL5_REG 0x0585
|
||||
#define AB4500_USB_OTG_CTRL_REG 0x0587
|
||||
#define AB4500_USB_OTG_STAT_REG 0x0588
|
||||
#define AB4500_USB_OTG_STAT_REG 0x0588
|
||||
#define AB4500_USB_CTRL_SPARE_REG 0x0589
|
||||
#define AB4500_USB_PHY_CTRL_REG 0x058A
|
||||
|
||||
/*
|
||||
* TVOUT / CTRL register offsets
|
||||
* Bank : 0x06
|
||||
*/
|
||||
#define AB4500_TVOUT_CTRL_REG 0x0680
|
||||
|
||||
/*
|
||||
* DBI register offsets
|
||||
* Bank : 0x07
|
||||
*/
|
||||
#define AB4500_DBI_REG1_REG 0x0700
|
||||
#define AB4500_DBI_REG2_REG 0x0701
|
||||
|
||||
/*
|
||||
* ECI regsiter offsets
|
||||
* Bank : 0x08
|
||||
*/
|
||||
#define AB4500_ECI_CTRL_REG 0x0800
|
||||
#define AB4500_ECI_HOOKLEVEL_REG 0x0801
|
||||
#define AB4500_ECI_DATAOUT_REG 0x0802
|
||||
#define AB4500_ECI_DATAIN_REG 0x0803
|
||||
|
||||
/*
|
||||
* AV Connector register offsets
|
||||
* Bank : 0x08
|
||||
*/
|
||||
#define AB4500_AV_CONN_REG 0x0840
|
||||
|
||||
/*
|
||||
* Accessory detection register offsets
|
||||
* Bank : 0x08
|
||||
*/
|
||||
#define AB4500_ACC_DET_DB1_REG 0x0880
|
||||
#define AB4500_ACC_DET_DB2_REG 0x0881
|
||||
|
||||
/*
|
||||
* GPADC register offsets
|
||||
* Bank : 0x0A
|
||||
*/
|
||||
#define AB4500_GPADC_CTRL1_REG 0x0A00
|
||||
#define AB4500_GPADC_CTRL2_REG 0x0A01
|
||||
#define AB4500_GPADC_CTRL3_REG 0x0A02
|
||||
#define AB4500_GPADC_AUTO_TIMER_REG 0x0A03
|
||||
#define AB4500_GPADC_STAT_REG 0x0A04
|
||||
#define AB4500_GPADC_MANDATAL_REG 0x0A05
|
||||
#define AB4500_GPADC_MANDATAH_REG 0x0A06
|
||||
#define AB4500_GPADC_AUTODATAL_REG 0x0A07
|
||||
#define AB4500_GPADC_AUTODATAH_REG 0x0A08
|
||||
#define AB4500_GPADC_MUX_CTRL_REG 0x0A09
|
||||
|
||||
/*
|
||||
* Charger / status register offfsets
|
||||
* Bank : 0x0B
|
||||
*/
|
||||
#define AB4500_CH_STATUS1_REG 0x0B00
|
||||
#define AB4500_CH_STATUS2_REG 0x0B01
|
||||
#define AB4500_CH_USBCH_STAT1_REG 0x0B02
|
||||
#define AB4500_CH_USBCH_STAT2_REG 0x0B03
|
||||
#define AB4500_CH_FSM_STAT_REG 0x0B04
|
||||
#define AB4500_CH_STAT_REG 0x0B05
|
||||
|
||||
/*
|
||||
* Charger / control register offfsets
|
||||
* Bank : 0x0B
|
||||
*/
|
||||
#define AB4500_CH_VOLT_LVL_REG 0x0B40
|
||||
|
||||
/*
|
||||
* Charger / main control register offfsets
|
||||
* Bank : 0x0B
|
||||
*/
|
||||
#define AB4500_MCH_CTRL1 0x0B80
|
||||
#define AB4500_MCH_CTRL2 0x0B81
|
||||
#define AB4500_MCH_IPT_CURLVL_REG 0x0B82
|
||||
#define AB4500_CH_WD_REG 0x0B83
|
||||
|
||||
/*
|
||||
* Charger / USB control register offsets
|
||||
* Bank : 0x0B
|
||||
*/
|
||||
#define AB4500_USBCH_CTRL1_REG 0x0BC0
|
||||
#define AB4500_USBCH_CTRL2_REG 0x0BC1
|
||||
#define AB4500_USBCH_IPT_CRNTLVL_REG 0x0BC2
|
||||
|
||||
/*
|
||||
* RTC bank register offsets
|
||||
* Bank : 0xF
|
||||
*/
|
||||
#define AB4500_RTC_SOFF_STAT_REG 0x0F00
|
||||
#define AB4500_RTC_CC_CONF_REG 0x0F01
|
||||
#define AB4500_RTC_READ_REQ_REG 0x0F02
|
||||
#define AB4500_RTC_WATCH_TSECMID_REG 0x0F03
|
||||
#define AB4500_RTC_WATCH_TSECHI_REG 0x0F04
|
||||
#define AB4500_RTC_WATCH_TMIN_LOW_REG 0x0F05
|
||||
#define AB4500_RTC_WATCH_TMIN_MID_REG 0x0F06
|
||||
#define AB4500_RTC_WATCH_TMIN_HI_REG 0x0F07
|
||||
#define AB4500_RTC_ALRM_MIN_LOW_REG 0x0F08
|
||||
#define AB4500_RTC_ALRM_MIN_MID_REG 0x0F09
|
||||
#define AB4500_RTC_ALRM_MIN_HI_REG 0x0F0A
|
||||
#define AB4500_RTC_STAT_REG 0x0F0B
|
||||
#define AB4500_RTC_BKUP_CHG_REG 0x0F0C
|
||||
#define AB4500_RTC_FORCE_BKUP_REG 0x0F0D
|
||||
#define AB4500_RTC_CALIB_REG 0x0F0E
|
||||
#define AB4500_RTC_SWITCH_STAT_REG 0x0F0F
|
||||
|
||||
/*
|
||||
* PWM Out generators
|
||||
* Bank: 0x10
|
||||
*/
|
||||
#define AB4500_PWM_OUT_CTRL1_REG 0x1060
|
||||
#define AB4500_PWM_OUT_CTRL2_REG 0x1061
|
||||
#define AB4500_PWM_OUT_CTRL3_REG 0x1062
|
||||
#define AB4500_PWM_OUT_CTRL4_REG 0x1063
|
||||
#define AB4500_PWM_OUT_CTRL5_REG 0x1064
|
||||
#define AB4500_PWM_OUT_CTRL6_REG 0x1065
|
||||
#define AB4500_PWM_OUT_CTRL7_REG 0x1066
|
||||
|
||||
#define AB4500_I2C_PAD_CTRL_REG 0x1067
|
||||
#define AB4500_REV_REG 0x1080
|
||||
|
||||
/**
|
||||
* struct ab4500
|
||||
* @spi: spi device structure
|
||||
* @tx_buf: transmit buffer
|
||||
* @rx_buf: receive buffer
|
||||
* @lock: sync primitive
|
||||
*/
|
||||
struct ab4500 {
|
||||
struct spi_device *spi;
|
||||
unsigned long tx_buf[4];
|
||||
unsigned long rx_buf[4];
|
||||
struct mutex lock;
|
||||
};
|
||||
|
||||
int ab4500_write(struct ab4500 *ab4500, unsigned char block,
|
||||
unsigned long addr, unsigned char data);
|
||||
int ab4500_read(struct ab4500 *ab4500, unsigned char block,
|
||||
unsigned long addr);
|
||||
|
||||
#endif /* MFD_AB4500_H */
|
||||
@@ -0,0 +1,299 @@
|
||||
/*
|
||||
* Definitions and platform data for Analog Devices
|
||||
* ADP5520/ADP5501 MFD PMICs (Backlight, LED, GPIO and Keys)
|
||||
*
|
||||
* Copyright 2009 Analog Devices Inc.
|
||||
*
|
||||
* Licensed under the GPL-2 or later.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __LINUX_MFD_ADP5520_H
|
||||
#define __LINUX_MFD_ADP5520_H
|
||||
|
||||
#define ID_ADP5520 5520
|
||||
#define ID_ADP5501 5501
|
||||
|
||||
/*
|
||||
* ADP5520/ADP5501 Register Map
|
||||
*/
|
||||
|
||||
#define ADP5520_MODE_STATUS 0x00
|
||||
#define ADP5520_INTERRUPT_ENABLE 0x01
|
||||
#define ADP5520_BL_CONTROL 0x02
|
||||
#define ADP5520_BL_TIME 0x03
|
||||
#define ADP5520_BL_FADE 0x04
|
||||
#define ADP5520_DAYLIGHT_MAX 0x05
|
||||
#define ADP5520_DAYLIGHT_DIM 0x06
|
||||
#define ADP5520_OFFICE_MAX 0x07
|
||||
#define ADP5520_OFFICE_DIM 0x08
|
||||
#define ADP5520_DARK_MAX 0x09
|
||||
#define ADP5520_DARK_DIM 0x0A
|
||||
#define ADP5520_BL_VALUE 0x0B
|
||||
#define ADP5520_ALS_CMPR_CFG 0x0C
|
||||
#define ADP5520_L2_TRIP 0x0D
|
||||
#define ADP5520_L2_HYS 0x0E
|
||||
#define ADP5520_L3_TRIP 0x0F
|
||||
#define ADP5520_L3_HYS 0x10
|
||||
#define ADP5520_LED_CONTROL 0x11
|
||||
#define ADP5520_LED_TIME 0x12
|
||||
#define ADP5520_LED_FADE 0x13
|
||||
#define ADP5520_LED1_CURRENT 0x14
|
||||
#define ADP5520_LED2_CURRENT 0x15
|
||||
#define ADP5520_LED3_CURRENT 0x16
|
||||
|
||||
/*
|
||||
* ADP5520 Register Map
|
||||
*/
|
||||
|
||||
#define ADP5520_GPIO_CFG_1 0x17
|
||||
#define ADP5520_GPIO_CFG_2 0x18
|
||||
#define ADP5520_GPIO_IN 0x19
|
||||
#define ADP5520_GPIO_OUT 0x1A
|
||||
#define ADP5520_GPIO_INT_EN 0x1B
|
||||
#define ADP5520_GPIO_INT_STAT 0x1C
|
||||
#define ADP5520_GPIO_INT_LVL 0x1D
|
||||
#define ADP5520_GPIO_DEBOUNCE 0x1E
|
||||
#define ADP5520_GPIO_PULLUP 0x1F
|
||||
#define ADP5520_KP_INT_STAT_1 0x20
|
||||
#define ADP5520_KP_INT_STAT_2 0x21
|
||||
#define ADP5520_KR_INT_STAT_1 0x22
|
||||
#define ADP5520_KR_INT_STAT_2 0x23
|
||||
#define ADP5520_KEY_STAT_1 0x24
|
||||
#define ADP5520_KEY_STAT_2 0x25
|
||||
|
||||
/*
|
||||
* MODE_STATUS bits
|
||||
*/
|
||||
|
||||
#define ADP5520_nSTNBY (1 << 7)
|
||||
#define ADP5520_BL_EN (1 << 6)
|
||||
#define ADP5520_DIM_EN (1 << 5)
|
||||
#define ADP5520_OVP_INT (1 << 4)
|
||||
#define ADP5520_CMPR_INT (1 << 3)
|
||||
#define ADP5520_GPI_INT (1 << 2)
|
||||
#define ADP5520_KR_INT (1 << 1)
|
||||
#define ADP5520_KP_INT (1 << 0)
|
||||
|
||||
/*
|
||||
* INTERRUPT_ENABLE bits
|
||||
*/
|
||||
|
||||
#define ADP5520_AUTO_LD_EN (1 << 4)
|
||||
#define ADP5520_CMPR_IEN (1 << 3)
|
||||
#define ADP5520_OVP_IEN (1 << 2)
|
||||
#define ADP5520_KR_IEN (1 << 1)
|
||||
#define ADP5520_KP_IEN (1 << 0)
|
||||
|
||||
/*
|
||||
* BL_CONTROL bits
|
||||
*/
|
||||
|
||||
#define ADP5520_BL_LVL ((x) << 5)
|
||||
#define ADP5520_BL_LAW ((x) << 4)
|
||||
#define ADP5520_BL_AUTO_ADJ (1 << 3)
|
||||
#define ADP5520_OVP_EN (1 << 2)
|
||||
#define ADP5520_FOVR (1 << 1)
|
||||
#define ADP5520_KP_BL_EN (1 << 0)
|
||||
|
||||
/*
|
||||
* ALS_CMPR_CFG bits
|
||||
*/
|
||||
|
||||
#define ADP5520_L3_OUT (1 << 3)
|
||||
#define ADP5520_L2_OUT (1 << 2)
|
||||
#define ADP5520_L3_EN (1 << 1)
|
||||
|
||||
#define ADP5020_MAX_BRIGHTNESS 0x7F
|
||||
|
||||
#define FADE_VAL(in, out) ((0xF & (in)) | ((0xF & (out)) << 4))
|
||||
#define BL_CTRL_VAL(law, auto) (((1 & (auto)) << 3) | ((0x3 & (law)) << 4))
|
||||
#define ALS_CMPR_CFG_VAL(filt, l3_en) (((0x7 & filt) << 5) | l3_en)
|
||||
|
||||
/*
|
||||
* LEDs subdevice bits and masks
|
||||
*/
|
||||
|
||||
#define ADP5520_01_MAXLEDS 3
|
||||
|
||||
#define ADP5520_FLAG_LED_MASK 0x3
|
||||
#define ADP5520_FLAG_OFFT_SHIFT 8
|
||||
#define ADP5520_FLAG_OFFT_MASK 0x3
|
||||
|
||||
#define ADP5520_R3_MODE (1 << 5)
|
||||
#define ADP5520_C3_MODE (1 << 4)
|
||||
#define ADP5520_LED_LAW (1 << 3)
|
||||
#define ADP5520_LED3_EN (1 << 2)
|
||||
#define ADP5520_LED2_EN (1 << 1)
|
||||
#define ADP5520_LED1_EN (1 << 0)
|
||||
|
||||
/*
|
||||
* GPIO subdevice bits and masks
|
||||
*/
|
||||
|
||||
#define ADP5520_MAXGPIOS 8
|
||||
|
||||
#define ADP5520_GPIO_C3 (1 << 7) /* LED2 or GPIO7 aka C3 */
|
||||
#define ADP5520_GPIO_C2 (1 << 6)
|
||||
#define ADP5520_GPIO_C1 (1 << 5)
|
||||
#define ADP5520_GPIO_C0 (1 << 4)
|
||||
#define ADP5520_GPIO_R3 (1 << 3) /* LED3 or GPIO3 aka R3 */
|
||||
#define ADP5520_GPIO_R2 (1 << 2)
|
||||
#define ADP5520_GPIO_R1 (1 << 1)
|
||||
#define ADP5520_GPIO_R0 (1 << 0)
|
||||
|
||||
struct adp5520_gpio_platform_data {
|
||||
unsigned gpio_start;
|
||||
u8 gpio_en_mask;
|
||||
u8 gpio_pullup_mask;
|
||||
};
|
||||
|
||||
/*
|
||||
* Keypad subdevice bits and masks
|
||||
*/
|
||||
|
||||
#define ADP5520_MAXKEYS 16
|
||||
|
||||
#define ADP5520_COL_C3 (1 << 7) /* LED2 or GPIO7 aka C3 */
|
||||
#define ADP5520_COL_C2 (1 << 6)
|
||||
#define ADP5520_COL_C1 (1 << 5)
|
||||
#define ADP5520_COL_C0 (1 << 4)
|
||||
#define ADP5520_ROW_R3 (1 << 3) /* LED3 or GPIO3 aka R3 */
|
||||
#define ADP5520_ROW_R2 (1 << 2)
|
||||
#define ADP5520_ROW_R1 (1 << 1)
|
||||
#define ADP5520_ROW_R0 (1 << 0)
|
||||
|
||||
#define ADP5520_KEY(row, col) (col + row * 4)
|
||||
#define ADP5520_KEYMAPSIZE ADP5520_MAXKEYS
|
||||
|
||||
struct adp5520_keys_platform_data {
|
||||
int rows_en_mask; /* Number of rows */
|
||||
int cols_en_mask; /* Number of columns */
|
||||
const unsigned short *keymap; /* Pointer to keymap */
|
||||
unsigned short keymapsize; /* Keymap size */
|
||||
unsigned repeat:1; /* Enable key repeat */
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* LEDs subdevice platform data
|
||||
*/
|
||||
|
||||
#define FLAG_ID_ADP5520_LED1_ADP5501_LED0 1 /* ADP5520 PIN ILED */
|
||||
#define FLAG_ID_ADP5520_LED2_ADP5501_LED1 2 /* ADP5520 PIN C3 */
|
||||
#define FLAG_ID_ADP5520_LED3_ADP5501_LED2 3 /* ADP5520 PIN R3 */
|
||||
|
||||
#define ADP5520_LED_DIS_BLINK (0 << ADP5520_FLAG_OFFT_SHIFT)
|
||||
#define ADP5520_LED_OFFT_600ms (1 << ADP5520_FLAG_OFFT_SHIFT)
|
||||
#define ADP5520_LED_OFFT_800ms (2 << ADP5520_FLAG_OFFT_SHIFT)
|
||||
#define ADP5520_LED_OFFT_1200ms (3 << ADP5520_FLAG_OFFT_SHIFT)
|
||||
|
||||
#define ADP5520_LED_ONT_200ms 0
|
||||
#define ADP5520_LED_ONT_600ms 1
|
||||
#define ADP5520_LED_ONT_800ms 2
|
||||
#define ADP5520_LED_ONT_1200ms 3
|
||||
|
||||
struct adp5520_leds_platform_data {
|
||||
int num_leds;
|
||||
struct led_info *leds;
|
||||
u8 fade_in; /* Backlight Fade-In Timer */
|
||||
u8 fade_out; /* Backlight Fade-Out Timer */
|
||||
u8 led_on_time;
|
||||
};
|
||||
|
||||
/*
|
||||
* Backlight subdevice platform data
|
||||
*/
|
||||
|
||||
#define ADP5520_FADE_T_DIS 0 /* Fade Timer Disabled */
|
||||
#define ADP5520_FADE_T_300ms 1 /* 0.3 Sec */
|
||||
#define ADP5520_FADE_T_600ms 2
|
||||
#define ADP5520_FADE_T_900ms 3
|
||||
#define ADP5520_FADE_T_1200ms 4
|
||||
#define ADP5520_FADE_T_1500ms 5
|
||||
#define ADP5520_FADE_T_1800ms 6
|
||||
#define ADP5520_FADE_T_2100ms 7
|
||||
#define ADP5520_FADE_T_2400ms 8
|
||||
#define ADP5520_FADE_T_2700ms 9
|
||||
#define ADP5520_FADE_T_3000ms 10
|
||||
#define ADP5520_FADE_T_3500ms 11
|
||||
#define ADP5520_FADE_T_4000ms 12
|
||||
#define ADP5520_FADE_T_4500ms 13
|
||||
#define ADP5520_FADE_T_5000ms 14
|
||||
#define ADP5520_FADE_T_5500ms 15 /* 5.5 Sec */
|
||||
|
||||
#define ADP5520_BL_LAW_LINEAR 0
|
||||
#define ADP5520_BL_LAW_SQUARE 1
|
||||
#define ADP5520_BL_LAW_CUBIC1 2
|
||||
#define ADP5520_BL_LAW_CUBIC2 3
|
||||
|
||||
#define ADP5520_BL_AMBL_FILT_80ms 0 /* Light sensor filter time */
|
||||
#define ADP5520_BL_AMBL_FILT_160ms 1
|
||||
#define ADP5520_BL_AMBL_FILT_320ms 2
|
||||
#define ADP5520_BL_AMBL_FILT_640ms 3
|
||||
#define ADP5520_BL_AMBL_FILT_1280ms 4
|
||||
#define ADP5520_BL_AMBL_FILT_2560ms 5
|
||||
#define ADP5520_BL_AMBL_FILT_5120ms 6
|
||||
#define ADP5520_BL_AMBL_FILT_10240ms 7 /* 10.24 sec */
|
||||
|
||||
/*
|
||||
* Blacklight current 0..30mA
|
||||
*/
|
||||
#define ADP5520_BL_CUR_mA(I) ((I * 127) / 30)
|
||||
|
||||
/*
|
||||
* L2 comparator current 0..1000uA
|
||||
*/
|
||||
#define ADP5520_L2_COMP_CURR_uA(I) ((I * 255) / 1000)
|
||||
|
||||
/*
|
||||
* L3 comparator current 0..127uA
|
||||
*/
|
||||
#define ADP5520_L3_COMP_CURR_uA(I) ((I * 255) / 127)
|
||||
|
||||
struct adp5520_backlight_platform_data {
|
||||
u8 fade_in; /* Backlight Fade-In Timer */
|
||||
u8 fade_out; /* Backlight Fade-Out Timer */
|
||||
u8 fade_led_law; /* fade-on/fade-off transfer characteristic */
|
||||
|
||||
u8 en_ambl_sens; /* 1 = enable ambient light sensor */
|
||||
u8 abml_filt; /* Light sensor filter time */
|
||||
u8 l1_daylight_max; /* use BL_CUR_mA(I) 0 <= I <= 30 mA */
|
||||
u8 l1_daylight_dim; /* typ = 0, use BL_CUR_mA(I) 0 <= I <= 30 mA */
|
||||
u8 l2_office_max; /* use BL_CUR_mA(I) 0 <= I <= 30 mA */
|
||||
u8 l2_office_dim; /* typ = 0, use BL_CUR_mA(I) 0 <= I <= 30 mA */
|
||||
u8 l3_dark_max; /* use BL_CUR_mA(I) 0 <= I <= 30 mA */
|
||||
u8 l3_dark_dim; /* typ = 0, use BL_CUR_mA(I) 0 <= I <= 30 mA */
|
||||
u8 l2_trip; /* use L2_COMP_CURR_uA(I) 0 <= I <= 1000 uA */
|
||||
u8 l2_hyst; /* use L2_COMP_CURR_uA(I) 0 <= I <= 1000 uA */
|
||||
u8 l3_trip; /* use L3_COMP_CURR_uA(I) 0 <= I <= 127 uA */
|
||||
u8 l3_hyst; /* use L3_COMP_CURR_uA(I) 0 <= I <= 127 uA */
|
||||
};
|
||||
|
||||
/*
|
||||
* MFD chip platform data
|
||||
*/
|
||||
|
||||
struct adp5520_platform_data {
|
||||
struct adp5520_keys_platform_data *keys;
|
||||
struct adp5520_gpio_platform_data *gpio;
|
||||
struct adp5520_leds_platform_data *leds;
|
||||
struct adp5520_backlight_platform_data *backlight;
|
||||
};
|
||||
|
||||
/*
|
||||
* MFD chip functions
|
||||
*/
|
||||
|
||||
extern int adp5520_read(struct device *dev, int reg, uint8_t *val);
|
||||
extern int adp5520_write(struct device *dev, int reg, u8 val);
|
||||
extern int adp5520_clr_bits(struct device *dev, int reg, uint8_t bit_mask);
|
||||
extern int adp5520_set_bits(struct device *dev, int reg, uint8_t bit_mask);
|
||||
|
||||
extern int adp5520_register_notifier(struct device *dev,
|
||||
struct notifier_block *nb, unsigned int events);
|
||||
|
||||
extern int adp5520_unregister_notifier(struct device *dev,
|
||||
struct notifier_block *nb, unsigned int events);
|
||||
|
||||
#endif /* __LINUX_MFD_ADP5520_H */
|
||||
@@ -231,9 +231,6 @@ void pcap_set_ts_bits(struct pcap_chip *, u32);
|
||||
#define PCAP_LED_4MA 1
|
||||
#define PCAP_LED_5MA 2
|
||||
#define PCAP_LED_9MA 3
|
||||
#define PCAP_LED_GPIO_VAL_MASK 0x00ffffff
|
||||
#define PCAP_LED_GPIO_EN 0x01000000
|
||||
#define PCAP_LED_GPIO_INVERT 0x02000000
|
||||
#define PCAP_LED_T_MASK 0xf
|
||||
#define PCAP_LED_C_MASK 0x3
|
||||
#define PCAP_BL_MASK 0x1f
|
||||
|
||||
@@ -24,52 +24,23 @@
|
||||
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/mfd/mc13783.h>
|
||||
#include <linux/workqueue.h>
|
||||
#include <linux/mutex.h>
|
||||
|
||||
struct mc13783_irq {
|
||||
void (*handler)(int, void *);
|
||||
void *data;
|
||||
};
|
||||
|
||||
#define MC13783_NUM_IRQ 2
|
||||
#define MC13783_IRQ_TS 0
|
||||
#define MC13783_IRQ_REGULATOR 1
|
||||
|
||||
#define MC13783_ADC_MODE_TS 1
|
||||
#define MC13783_ADC_MODE_SINGLE_CHAN 2
|
||||
#define MC13783_ADC_MODE_MULT_CHAN 3
|
||||
#include <linux/interrupt.h>
|
||||
|
||||
struct mc13783 {
|
||||
int revision;
|
||||
struct device *dev;
|
||||
struct spi_device *spi_device;
|
||||
|
||||
int (*read_dev)(void *data, char reg, int count, u32 *dst);
|
||||
int (*write_dev)(void *data, char reg, int count, const u32 *src);
|
||||
|
||||
struct mutex io_lock;
|
||||
void *io_data;
|
||||
struct spi_device *spidev;
|
||||
struct mutex lock;
|
||||
int irq;
|
||||
unsigned int flags;
|
||||
int flags;
|
||||
|
||||
struct mc13783_irq irq_handler[MC13783_NUM_IRQ];
|
||||
struct work_struct work;
|
||||
struct completion adc_done;
|
||||
unsigned int ts_active;
|
||||
struct mutex adc_conv_lock;
|
||||
irq_handler_t irqhandler[MC13783_NUM_IRQ];
|
||||
void *irqdata[MC13783_NUM_IRQ];
|
||||
|
||||
/* XXX these should go as platformdata to the regulator subdevice */
|
||||
struct mc13783_regulator_init_data *regulators;
|
||||
int num_regulators;
|
||||
};
|
||||
|
||||
int mc13783_reg_read(struct mc13783 *, int reg_num, u32 *);
|
||||
int mc13783_reg_write(struct mc13783 *, int, u32);
|
||||
int mc13783_set_bits(struct mc13783 *, int, u32, u32);
|
||||
int mc13783_free_irq(struct mc13783 *mc13783, int irq);
|
||||
int mc13783_register_irq(struct mc13783 *mc13783, int irq,
|
||||
void (*handler) (int, void *), void *data);
|
||||
|
||||
#define MC13783_REG_INTERRUPT_STATUS_0 0
|
||||
#define MC13783_REG_INTERRUPT_MASK_0 1
|
||||
#define MC13783_REG_INTERRUPT_SENSE_0 2
|
||||
@@ -136,55 +107,6 @@ int mc13783_register_irq(struct mc13783 *mc13783, int irq,
|
||||
#define MC13783_REG_TEST_3 63
|
||||
#define MC13783_REG_NB 64
|
||||
|
||||
|
||||
/*
|
||||
* Interrupt Status
|
||||
*/
|
||||
#define MC13783_INT_STAT_ADCDONEI (1 << 0)
|
||||
#define MC13783_INT_STAT_ADCBISDONEI (1 << 1)
|
||||
#define MC13783_INT_STAT_TSI (1 << 2)
|
||||
#define MC13783_INT_STAT_WHIGHI (1 << 3)
|
||||
#define MC13783_INT_STAT_WLOWI (1 << 4)
|
||||
#define MC13783_INT_STAT_CHGDETI (1 << 6)
|
||||
#define MC13783_INT_STAT_CHGOVI (1 << 7)
|
||||
#define MC13783_INT_STAT_CHGREVI (1 << 8)
|
||||
#define MC13783_INT_STAT_CHGSHORTI (1 << 9)
|
||||
#define MC13783_INT_STAT_CCCVI (1 << 10)
|
||||
#define MC13783_INT_STAT_CHGCURRI (1 << 11)
|
||||
#define MC13783_INT_STAT_BPONI (1 << 12)
|
||||
#define MC13783_INT_STAT_LOBATLI (1 << 13)
|
||||
#define MC13783_INT_STAT_LOBATHI (1 << 14)
|
||||
#define MC13783_INT_STAT_UDPI (1 << 15)
|
||||
#define MC13783_INT_STAT_USBI (1 << 16)
|
||||
#define MC13783_INT_STAT_IDI (1 << 19)
|
||||
#define MC13783_INT_STAT_Unused (1 << 20)
|
||||
#define MC13783_INT_STAT_SE1I (1 << 21)
|
||||
#define MC13783_INT_STAT_CKDETI (1 << 22)
|
||||
#define MC13783_INT_STAT_UDMI (1 << 23)
|
||||
|
||||
/*
|
||||
* Interrupt Mask
|
||||
*/
|
||||
#define MC13783_INT_MASK_ADCDONEM (1 << 0)
|
||||
#define MC13783_INT_MASK_ADCBISDONEM (1 << 1)
|
||||
#define MC13783_INT_MASK_TSM (1 << 2)
|
||||
#define MC13783_INT_MASK_WHIGHM (1 << 3)
|
||||
#define MC13783_INT_MASK_WLOWM (1 << 4)
|
||||
#define MC13783_INT_MASK_CHGDETM (1 << 6)
|
||||
#define MC13783_INT_MASK_CHGOVM (1 << 7)
|
||||
#define MC13783_INT_MASK_CHGREVM (1 << 8)
|
||||
#define MC13783_INT_MASK_CHGSHORTM (1 << 9)
|
||||
#define MC13783_INT_MASK_CCCVM (1 << 10)
|
||||
#define MC13783_INT_MASK_CHGCURRM (1 << 11)
|
||||
#define MC13783_INT_MASK_BPONM (1 << 12)
|
||||
#define MC13783_INT_MASK_LOBATLM (1 << 13)
|
||||
#define MC13783_INT_MASK_LOBATHM (1 << 14)
|
||||
#define MC13783_INT_MASK_UDPM (1 << 15)
|
||||
#define MC13783_INT_MASK_USBM (1 << 16)
|
||||
#define MC13783_INT_MASK_IDM (1 << 19)
|
||||
#define MC13783_INT_MASK_SE1M (1 << 21)
|
||||
#define MC13783_INT_MASK_CKDETM (1 << 22)
|
||||
|
||||
/*
|
||||
* Reg Regulator Mode 0
|
||||
*/
|
||||
@@ -284,113 +206,15 @@ int mc13783_register_irq(struct mc13783 *mc13783, int irq,
|
||||
#define MC13783_SWCTRL_SW3_STBY (1 << 21)
|
||||
#define MC13783_SWCTRL_SW3_MODE (1 << 22)
|
||||
|
||||
/*
|
||||
* ADC/Touch
|
||||
*/
|
||||
#define MC13783_ADC0_LICELLCON (1 << 0)
|
||||
#define MC13783_ADC0_CHRGICON (1 << 1)
|
||||
#define MC13783_ADC0_BATICON (1 << 2)
|
||||
#define MC13783_ADC0_RTHEN (1 << 3)
|
||||
#define MC13783_ADC0_DTHEN (1 << 4)
|
||||
#define MC13783_ADC0_UIDEN (1 << 5)
|
||||
#define MC13783_ADC0_ADOUTEN (1 << 6)
|
||||
#define MC13783_ADC0_ADOUTPER (1 << 7)
|
||||
#define MC13783_ADC0_ADREFEN (1 << 10)
|
||||
#define MC13783_ADC0_ADREFMODE (1 << 11)
|
||||
#define MC13783_ADC0_TSMOD0 (1 << 12)
|
||||
#define MC13783_ADC0_TSMOD1 (1 << 13)
|
||||
#define MC13783_ADC0_TSMOD2 (1 << 14)
|
||||
#define MC13783_ADC0_CHRGRAWDIV (1 << 15)
|
||||
#define MC13783_ADC0_ADINC1 (1 << 16)
|
||||
#define MC13783_ADC0_ADINC2 (1 << 17)
|
||||
#define MC13783_ADC0_WCOMP (1 << 18)
|
||||
#define MC13783_ADC0_ADCBIS0 (1 << 23)
|
||||
static inline int mc13783_set_bits(struct mc13783 *mc13783, unsigned int offset,
|
||||
u32 mask, u32 val)
|
||||
{
|
||||
int ret;
|
||||
mc13783_lock(mc13783);
|
||||
ret = mc13783_reg_rmw(mc13783, offset, mask, val);
|
||||
mc13783_unlock(mc13783);
|
||||
|
||||
#define MC13783_ADC1_ADEN (1 << 0)
|
||||
#define MC13783_ADC1_RAND (1 << 1)
|
||||
#define MC13783_ADC1_ADSEL (1 << 3)
|
||||
#define MC13783_ADC1_TRIGMASK (1 << 4)
|
||||
#define MC13783_ADC1_ADA10 (1 << 5)
|
||||
#define MC13783_ADC1_ADA11 (1 << 6)
|
||||
#define MC13783_ADC1_ADA12 (1 << 7)
|
||||
#define MC13783_ADC1_ADA20 (1 << 8)
|
||||
#define MC13783_ADC1_ADA21 (1 << 9)
|
||||
#define MC13783_ADC1_ADA22 (1 << 10)
|
||||
#define MC13783_ADC1_ATO0 (1 << 11)
|
||||
#define MC13783_ADC1_ATO1 (1 << 12)
|
||||
#define MC13783_ADC1_ATO2 (1 << 13)
|
||||
#define MC13783_ADC1_ATO3 (1 << 14)
|
||||
#define MC13783_ADC1_ATO4 (1 << 15)
|
||||
#define MC13783_ADC1_ATO5 (1 << 16)
|
||||
#define MC13783_ADC1_ATO6 (1 << 17)
|
||||
#define MC13783_ADC1_ATO7 (1 << 18)
|
||||
#define MC13783_ADC1_ATOX (1 << 19)
|
||||
#define MC13783_ADC1_ASC (1 << 20)
|
||||
#define MC13783_ADC1_ADTRIGIGN (1 << 21)
|
||||
#define MC13783_ADC1_ADONESHOT (1 << 22)
|
||||
#define MC13783_ADC1_ADCBIS1 (1 << 23)
|
||||
|
||||
#define MC13783_ADC1_CHAN0_SHIFT 5
|
||||
#define MC13783_ADC1_CHAN1_SHIFT 8
|
||||
|
||||
#define MC13783_ADC2_ADD10 (1 << 2)
|
||||
#define MC13783_ADC2_ADD11 (1 << 3)
|
||||
#define MC13783_ADC2_ADD12 (1 << 4)
|
||||
#define MC13783_ADC2_ADD13 (1 << 5)
|
||||
#define MC13783_ADC2_ADD14 (1 << 6)
|
||||
#define MC13783_ADC2_ADD15 (1 << 7)
|
||||
#define MC13783_ADC2_ADD16 (1 << 8)
|
||||
#define MC13783_ADC2_ADD17 (1 << 9)
|
||||
#define MC13783_ADC2_ADD18 (1 << 10)
|
||||
#define MC13783_ADC2_ADD19 (1 << 11)
|
||||
#define MC13783_ADC2_ADD20 (1 << 14)
|
||||
#define MC13783_ADC2_ADD21 (1 << 15)
|
||||
#define MC13783_ADC2_ADD22 (1 << 16)
|
||||
#define MC13783_ADC2_ADD23 (1 << 17)
|
||||
#define MC13783_ADC2_ADD24 (1 << 18)
|
||||
#define MC13783_ADC2_ADD25 (1 << 19)
|
||||
#define MC13783_ADC2_ADD26 (1 << 20)
|
||||
#define MC13783_ADC2_ADD27 (1 << 21)
|
||||
#define MC13783_ADC2_ADD28 (1 << 22)
|
||||
#define MC13783_ADC2_ADD29 (1 << 23)
|
||||
|
||||
#define MC13783_ADC3_WHIGH0 (1 << 0)
|
||||
#define MC13783_ADC3_WHIGH1 (1 << 1)
|
||||
#define MC13783_ADC3_WHIGH2 (1 << 2)
|
||||
#define MC13783_ADC3_WHIGH3 (1 << 3)
|
||||
#define MC13783_ADC3_WHIGH4 (1 << 4)
|
||||
#define MC13783_ADC3_WHIGH5 (1 << 5)
|
||||
#define MC13783_ADC3_ICID0 (1 << 6)
|
||||
#define MC13783_ADC3_ICID1 (1 << 7)
|
||||
#define MC13783_ADC3_ICID2 (1 << 8)
|
||||
#define MC13783_ADC3_WLOW0 (1 << 9)
|
||||
#define MC13783_ADC3_WLOW1 (1 << 10)
|
||||
#define MC13783_ADC3_WLOW2 (1 << 11)
|
||||
#define MC13783_ADC3_WLOW3 (1 << 12)
|
||||
#define MC13783_ADC3_WLOW4 (1 << 13)
|
||||
#define MC13783_ADC3_WLOW5 (1 << 14)
|
||||
#define MC13783_ADC3_ADCBIS2 (1 << 23)
|
||||
|
||||
#define MC13783_ADC4_ADDBIS10 (1 << 2)
|
||||
#define MC13783_ADC4_ADDBIS11 (1 << 3)
|
||||
#define MC13783_ADC4_ADDBIS12 (1 << 4)
|
||||
#define MC13783_ADC4_ADDBIS13 (1 << 5)
|
||||
#define MC13783_ADC4_ADDBIS14 (1 << 6)
|
||||
#define MC13783_ADC4_ADDBIS15 (1 << 7)
|
||||
#define MC13783_ADC4_ADDBIS16 (1 << 8)
|
||||
#define MC13783_ADC4_ADDBIS17 (1 << 9)
|
||||
#define MC13783_ADC4_ADDBIS18 (1 << 10)
|
||||
#define MC13783_ADC4_ADDBIS19 (1 << 11)
|
||||
#define MC13783_ADC4_ADDBIS20 (1 << 14)
|
||||
#define MC13783_ADC4_ADDBIS21 (1 << 15)
|
||||
#define MC13783_ADC4_ADDBIS22 (1 << 16)
|
||||
#define MC13783_ADC4_ADDBIS23 (1 << 17)
|
||||
#define MC13783_ADC4_ADDBIS24 (1 << 18)
|
||||
#define MC13783_ADC4_ADDBIS25 (1 << 19)
|
||||
#define MC13783_ADC4_ADDBIS26 (1 << 20)
|
||||
#define MC13783_ADC4_ADDBIS27 (1 << 21)
|
||||
#define MC13783_ADC4_ADDBIS28 (1 << 22)
|
||||
#define MC13783_ADC4_ADDBIS29 (1 << 23)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif /* __LINUX_MFD_MC13783_PRIV_H */
|
||||
|
||||
|
||||
+95
-25
@@ -1,28 +1,50 @@
|
||||
/*
|
||||
* Copyright 2009 Pengutronix, Sascha Hauer <s.hauer@pengutronix.de>
|
||||
* Copyright 2009 Pengutronix
|
||||
* Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
|
||||
*
|
||||
* Initial development of this code was funded by
|
||||
* Phytec Messtechnik GmbH, http://www.phytec.de
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 2 as published by the
|
||||
* Free Software Foundation.
|
||||
*/
|
||||
#ifndef __LINUX_MFD_MC13783_H
|
||||
#define __LINUX_MFD_MC13783_H
|
||||
|
||||
#ifndef __INCLUDE_LINUX_MFD_MC13783_H
|
||||
#define __INCLUDE_LINUX_MFD_MC13783_H
|
||||
#include <linux/interrupt.h>
|
||||
|
||||
struct mc13783;
|
||||
|
||||
void mc13783_lock(struct mc13783 *mc13783);
|
||||
void mc13783_unlock(struct mc13783 *mc13783);
|
||||
|
||||
int mc13783_reg_read(struct mc13783 *mc13783, unsigned int offset, u32 *val);
|
||||
int mc13783_reg_write(struct mc13783 *mc13783, unsigned int offset, u32 val);
|
||||
int mc13783_reg_rmw(struct mc13783 *mc13783, unsigned int offset,
|
||||
u32 mask, u32 val);
|
||||
|
||||
int mc13783_irq_request(struct mc13783 *mc13783, int irq,
|
||||
irq_handler_t handler, const char *name, void *dev);
|
||||
int mc13783_irq_request_nounmask(struct mc13783 *mc13783, int irq,
|
||||
irq_handler_t handler, const char *name, void *dev);
|
||||
int mc13783_irq_free(struct mc13783 *mc13783, int irq, void *dev);
|
||||
int mc13783_ackirq(struct mc13783 *mc13783, int irq);
|
||||
|
||||
int mc13783_mask(struct mc13783 *mc13783, int irq);
|
||||
int mc13783_unmask(struct mc13783 *mc13783, int irq);
|
||||
|
||||
#define MC13783_ADC0 43
|
||||
#define MC13783_ADC0_ADREFEN (1 << 10)
|
||||
#define MC13783_ADC0_ADREFMODE (1 << 11)
|
||||
#define MC13783_ADC0_TSMOD0 (1 << 12)
|
||||
#define MC13783_ADC0_TSMOD1 (1 << 13)
|
||||
#define MC13783_ADC0_TSMOD2 (1 << 14)
|
||||
#define MC13783_ADC0_ADINC1 (1 << 16)
|
||||
#define MC13783_ADC0_ADINC2 (1 << 17)
|
||||
|
||||
#define MC13783_ADC0_TSMOD_MASK (MC13783_ADC0_TSMOD0 | \
|
||||
MC13783_ADC0_TSMOD1 | \
|
||||
MC13783_ADC0_TSMOD2)
|
||||
|
||||
/* to be cleaned up */
|
||||
struct regulator_init_data;
|
||||
|
||||
struct mc13783_regulator_init_data {
|
||||
@@ -30,23 +52,30 @@ struct mc13783_regulator_init_data {
|
||||
struct regulator_init_data *init_data;
|
||||
};
|
||||
|
||||
struct mc13783_platform_data {
|
||||
struct mc13783_regulator_init_data *regulators;
|
||||
struct mc13783_regulator_platform_data {
|
||||
int num_regulators;
|
||||
unsigned int flags;
|
||||
struct mc13783_regulator_init_data *regulators;
|
||||
};
|
||||
|
||||
/* mc13783_platform_data flags */
|
||||
struct mc13783_platform_data {
|
||||
int num_regulators;
|
||||
struct mc13783_regulator_init_data *regulators;
|
||||
|
||||
#define MC13783_USE_TOUCHSCREEN (1 << 0)
|
||||
#define MC13783_USE_CODEC (1 << 1)
|
||||
#define MC13783_USE_ADC (1 << 2)
|
||||
#define MC13783_USE_RTC (1 << 3)
|
||||
#define MC13783_USE_REGULATOR (1 << 4)
|
||||
unsigned int flags;
|
||||
};
|
||||
|
||||
#define MC13783_ADC_MODE_TS 1
|
||||
#define MC13783_ADC_MODE_SINGLE_CHAN 2
|
||||
#define MC13783_ADC_MODE_MULT_CHAN 3
|
||||
|
||||
int mc13783_adc_do_conversion(struct mc13783 *mc13783, unsigned int mode,
|
||||
unsigned int channel, unsigned int *sample);
|
||||
|
||||
void mc13783_adc_set_ts_status(struct mc13783 *mc13783, unsigned int status);
|
||||
|
||||
#define MC13783_SW_SW1A 0
|
||||
#define MC13783_SW_SW1B 1
|
||||
@@ -80,5 +109,46 @@ void mc13783_adc_set_ts_status(struct mc13783 *mc13783, unsigned int status);
|
||||
#define MC13783_REGU_V3 29
|
||||
#define MC13783_REGU_V4 30
|
||||
|
||||
#endif /* __INCLUDE_LINUX_MFD_MC13783_H */
|
||||
#define MC13783_IRQ_ADCDONE 0
|
||||
#define MC13783_IRQ_ADCBISDONE 1
|
||||
#define MC13783_IRQ_TS 2
|
||||
#define MC13783_IRQ_WHIGH 3
|
||||
#define MC13783_IRQ_WLOW 4
|
||||
#define MC13783_IRQ_CHGDET 6
|
||||
#define MC13783_IRQ_CHGOV 7
|
||||
#define MC13783_IRQ_CHGREV 8
|
||||
#define MC13783_IRQ_CHGSHORT 9
|
||||
#define MC13783_IRQ_CCCV 10
|
||||
#define MC13783_IRQ_CHGCURR 11
|
||||
#define MC13783_IRQ_BPON 12
|
||||
#define MC13783_IRQ_LOBATL 13
|
||||
#define MC13783_IRQ_LOBATH 14
|
||||
#define MC13783_IRQ_UDP 15
|
||||
#define MC13783_IRQ_USB 16
|
||||
#define MC13783_IRQ_ID 19
|
||||
#define MC13783_IRQ_SE1 21
|
||||
#define MC13783_IRQ_CKDET 22
|
||||
#define MC13783_IRQ_UDM 23
|
||||
#define MC13783_IRQ_1HZ 24
|
||||
#define MC13783_IRQ_TODA 25
|
||||
#define MC13783_IRQ_ONOFD1 27
|
||||
#define MC13783_IRQ_ONOFD2 28
|
||||
#define MC13783_IRQ_ONOFD3 29
|
||||
#define MC13783_IRQ_SYSRST 30
|
||||
#define MC13783_IRQ_RTCRST 31
|
||||
#define MC13783_IRQ_PC 32
|
||||
#define MC13783_IRQ_WARM 33
|
||||
#define MC13783_IRQ_MEMHLD 34
|
||||
#define MC13783_IRQ_PWRRDY 35
|
||||
#define MC13783_IRQ_THWARNL 36
|
||||
#define MC13783_IRQ_THWARNH 37
|
||||
#define MC13783_IRQ_CLK 38
|
||||
#define MC13783_IRQ_SEMAF 39
|
||||
#define MC13783_IRQ_MC2B 41
|
||||
#define MC13783_IRQ_HSDET 42
|
||||
#define MC13783_IRQ_HSL 43
|
||||
#define MC13783_IRQ_ALSPTH 44
|
||||
#define MC13783_IRQ_AHSSHORT 45
|
||||
#define MC13783_NUM_IRQ 46
|
||||
|
||||
#endif /* __LINUX_MFD_MC13783_H */
|
||||
|
||||
@@ -29,7 +29,12 @@ struct pcf50633_platform_data {
|
||||
char **batteries;
|
||||
int num_batteries;
|
||||
|
||||
int charging_restart_interval;
|
||||
/*
|
||||
* Should be set accordingly to the reference resistor used, see
|
||||
* I_{ch(ref)} charger reference current in the pcf50633 User
|
||||
* Manual.
|
||||
*/
|
||||
int charger_reference_current_ma;
|
||||
|
||||
/* Callbacks */
|
||||
void (*probe_done)(struct pcf50633 *);
|
||||
@@ -40,10 +45,6 @@ struct pcf50633_platform_data {
|
||||
u8 resumers[5];
|
||||
};
|
||||
|
||||
struct pcf50633_subdev_pdata {
|
||||
struct pcf50633 *pcf;
|
||||
};
|
||||
|
||||
struct pcf50633_irq {
|
||||
void (*handler) (int, void *);
|
||||
void *data;
|
||||
@@ -217,5 +218,9 @@ enum pcf50633_reg_int5 {
|
||||
#define PCF50633_REG_LEDCTL 0x2a
|
||||
#define PCF50633_REG_LEDDIM 0x2b
|
||||
|
||||
#endif
|
||||
static inline struct pcf50633 *dev_to_pcf50633(struct device *dev)
|
||||
{
|
||||
return dev_get_drvdata(dev);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -128,6 +128,7 @@ enum pcf50633_reg_mbcs3 {
|
||||
int pcf50633_mbc_usb_curlim_set(struct pcf50633 *pcf, int ma);
|
||||
|
||||
int pcf50633_mbc_get_status(struct pcf50633 *);
|
||||
int pcf50633_mbc_get_usb_online_status(struct pcf50633 *);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
#define MFD_TMIO_H
|
||||
|
||||
#include <linux/fb.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/platform_device.h>
|
||||
|
||||
#define tmio_ioread8(addr) readb(addr)
|
||||
#define tmio_ioread16(addr) readw(addr)
|
||||
@@ -18,11 +20,48 @@
|
||||
writew((val) >> 16, (addr) + 2); \
|
||||
} while (0)
|
||||
|
||||
#define CNF_CMD 0x04
|
||||
#define CNF_CTL_BASE 0x10
|
||||
#define CNF_INT_PIN 0x3d
|
||||
#define CNF_STOP_CLK_CTL 0x40
|
||||
#define CNF_GCLK_CTL 0x41
|
||||
#define CNF_SD_CLK_MODE 0x42
|
||||
#define CNF_PIN_STATUS 0x44
|
||||
#define CNF_PWR_CTL_1 0x48
|
||||
#define CNF_PWR_CTL_2 0x49
|
||||
#define CNF_PWR_CTL_3 0x4a
|
||||
#define CNF_CARD_DETECT_MODE 0x4c
|
||||
#define CNF_SD_SLOT 0x50
|
||||
#define CNF_EXT_GCLK_CTL_1 0xf0
|
||||
#define CNF_EXT_GCLK_CTL_2 0xf1
|
||||
#define CNF_EXT_GCLK_CTL_3 0xf9
|
||||
#define CNF_SD_LED_EN_1 0xfa
|
||||
#define CNF_SD_LED_EN_2 0xfe
|
||||
|
||||
#define SDCREN 0x2 /* Enable access to MMC CTL regs. (flag in COMMAND_REG)*/
|
||||
|
||||
#define sd_config_write8(base, shift, reg, val) \
|
||||
tmio_iowrite8((val), (base) + ((reg) << (shift)))
|
||||
#define sd_config_write16(base, shift, reg, val) \
|
||||
tmio_iowrite16((val), (base) + ((reg) << (shift)))
|
||||
#define sd_config_write32(base, shift, reg, val) \
|
||||
do { \
|
||||
tmio_iowrite16((val), (base) + ((reg) << (shift))); \
|
||||
tmio_iowrite16((val) >> 16, (base) + ((reg + 2) << (shift))); \
|
||||
} while (0)
|
||||
|
||||
int tmio_core_mmc_enable(void __iomem *cnf, int shift, unsigned long base);
|
||||
int tmio_core_mmc_resume(void __iomem *cnf, int shift, unsigned long base);
|
||||
void tmio_core_mmc_pwr(void __iomem *cnf, int shift, int state);
|
||||
void tmio_core_mmc_clk_div(void __iomem *cnf, int shift, int state);
|
||||
|
||||
/*
|
||||
* data for the MMC controller
|
||||
*/
|
||||
struct tmio_mmc_data {
|
||||
const unsigned int hclk;
|
||||
void (*set_pwr)(struct platform_device *host, int state);
|
||||
void (*set_clk_div)(struct platform_device *host, int state);
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
#define __MFD_WM831X_CORE_H__
|
||||
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/workqueue.h>
|
||||
|
||||
/*
|
||||
* Register values.
|
||||
@@ -117,6 +116,7 @@
|
||||
#define WM831X_DC3_SLEEP_CONTROL 0x4063
|
||||
#define WM831X_DC4_CONTROL 0x4064
|
||||
#define WM831X_DC4_SLEEP_CONTROL 0x4065
|
||||
#define WM832X_DC4_SLEEP_CONTROL 0x4067
|
||||
#define WM831X_EPE1_CONTROL 0x4066
|
||||
#define WM831X_EPE2_CONTROL 0x4067
|
||||
#define WM831X_LDO1_CONTROL 0x4068
|
||||
@@ -235,6 +235,8 @@
|
||||
|
||||
struct regulator_dev;
|
||||
|
||||
#define WM831X_NUM_IRQ_REGS 5
|
||||
|
||||
struct wm831x {
|
||||
struct mutex io_lock;
|
||||
|
||||
@@ -248,10 +250,11 @@ struct wm831x {
|
||||
|
||||
int irq; /* Our chip IRQ */
|
||||
struct mutex irq_lock;
|
||||
struct workqueue_struct *irq_wq;
|
||||
struct work_struct irq_work;
|
||||
unsigned int irq_base;
|
||||
int irq_masks[5];
|
||||
int irq_masks_cur[WM831X_NUM_IRQ_REGS]; /* Currently active value */
|
||||
int irq_masks_cache[WM831X_NUM_IRQ_REGS]; /* Cached hardware value */
|
||||
|
||||
int num_gpio;
|
||||
|
||||
struct mutex auxadc_lock;
|
||||
|
||||
@@ -278,12 +281,30 @@ int wm831x_bulk_read(struct wm831x *wm831x, unsigned short reg,
|
||||
int wm831x_irq_init(struct wm831x *wm831x, int irq);
|
||||
void wm831x_irq_exit(struct wm831x *wm831x);
|
||||
|
||||
int __must_check wm831x_request_irq(struct wm831x *wm831x,
|
||||
unsigned int irq, irq_handler_t handler,
|
||||
unsigned long flags, const char *name,
|
||||
void *dev);
|
||||
void wm831x_free_irq(struct wm831x *wm831x, unsigned int, void *);
|
||||
void wm831x_disable_irq(struct wm831x *wm831x, int irq);
|
||||
void wm831x_enable_irq(struct wm831x *wm831x, int irq);
|
||||
static inline int __must_check wm831x_request_irq(struct wm831x *wm831x,
|
||||
unsigned int irq,
|
||||
irq_handler_t handler,
|
||||
unsigned long flags,
|
||||
const char *name,
|
||||
void *dev)
|
||||
{
|
||||
return request_threaded_irq(irq, NULL, handler, flags, name, dev);
|
||||
}
|
||||
|
||||
static inline void wm831x_free_irq(struct wm831x *wm831x,
|
||||
unsigned int irq, void *dev)
|
||||
{
|
||||
free_irq(irq, dev);
|
||||
}
|
||||
|
||||
static inline void wm831x_disable_irq(struct wm831x *wm831x, int irq)
|
||||
{
|
||||
disable_irq(irq);
|
||||
}
|
||||
|
||||
static inline void wm831x_enable_irq(struct wm831x *wm831x, int irq)
|
||||
{
|
||||
enable_irq(irq);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -41,6 +41,23 @@ struct wm831x_battery_pdata {
|
||||
int timeout; /** Charge cycle timeout, in minutes */
|
||||
};
|
||||
|
||||
/**
|
||||
* Configuration for the WM831x DC-DC BuckWise convertors. This
|
||||
* should be passed as driver_data in the regulator_init_data.
|
||||
*
|
||||
* Currently all the configuration is for the fast DVS switching
|
||||
* support of the devices. This allows MFPs on the device to be
|
||||
* configured as an input to switch between two output voltages,
|
||||
* allowing voltage transitions without the expense of an access over
|
||||
* I2C or SPI buses.
|
||||
*/
|
||||
struct wm831x_buckv_pdata {
|
||||
int dvs_gpio; /** CPU GPIO to use for DVS switching */
|
||||
int dvs_control_src; /** Hardware DVS source to use (1 or 2) */
|
||||
int dvs_init_state; /** DVS state to expect on startup */
|
||||
int dvs_state_gpio; /** CPU GPIO to use for monitoring status */
|
||||
};
|
||||
|
||||
/* Sources for status LED configuration. Values are register values
|
||||
* plus 1 to allow for a zero default for preserve.
|
||||
*/
|
||||
@@ -91,6 +108,7 @@ struct wm831x_pdata {
|
||||
/** Called after subdevices are set up */
|
||||
int (*post_init)(struct wm831x *wm831x);
|
||||
|
||||
int irq_base;
|
||||
int gpio_base;
|
||||
struct wm831x_backlight_pdata *backlight;
|
||||
struct wm831x_backup_pdata *backup;
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/workqueue.h>
|
||||
#include <linux/interrupt.h>
|
||||
|
||||
#include <linux/mfd/wm8350/audio.h>
|
||||
#include <linux/mfd/wm8350/gpio.h>
|
||||
@@ -601,7 +601,7 @@ extern const u16 wm8352_mode3_defaults[];
|
||||
struct wm8350;
|
||||
|
||||
struct wm8350_irq {
|
||||
void (*handler) (struct wm8350 *, int, void *);
|
||||
irq_handler_t handler;
|
||||
void *data;
|
||||
};
|
||||
|
||||
@@ -646,10 +646,12 @@ struct wm8350 {
|
||||
* @init: Function called during driver initialisation. Should be
|
||||
* used by the platform to configure GPIO functions and similar.
|
||||
* @irq_high: Set if WM8350 IRQ is active high.
|
||||
* @irq_base: Base IRQ for genirq (not currently used).
|
||||
*/
|
||||
struct wm8350_platform_data {
|
||||
int (*init)(struct wm8350 *wm8350);
|
||||
int irq_high;
|
||||
int irq_base;
|
||||
};
|
||||
|
||||
|
||||
@@ -676,11 +678,13 @@ int wm8350_block_write(struct wm8350 *wm8350, int reg, int size, u16 *src);
|
||||
* WM8350 internal interrupts
|
||||
*/
|
||||
int wm8350_register_irq(struct wm8350 *wm8350, int irq,
|
||||
void (*handler) (struct wm8350 *, int, void *),
|
||||
void *data);
|
||||
irq_handler_t handler, unsigned long flags,
|
||||
const char *name, void *data);
|
||||
int wm8350_free_irq(struct wm8350 *wm8350, int irq);
|
||||
int wm8350_mask_irq(struct wm8350 *wm8350, int irq);
|
||||
int wm8350_unmask_irq(struct wm8350 *wm8350, int irq);
|
||||
|
||||
int wm8350_irq_init(struct wm8350 *wm8350, int irq,
|
||||
struct wm8350_platform_data *pdata);
|
||||
int wm8350_irq_exit(struct wm8350 *wm8350);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -172,6 +172,24 @@
|
||||
#define WM8350_GPIO_DEBOUNCE_OFF 0
|
||||
#define WM8350_GPIO_DEBOUNCE_ON 1
|
||||
|
||||
/*
|
||||
* R30 (0x1E) - GPIO Interrupt Status
|
||||
*/
|
||||
#define WM8350_GP12_EINT 0x1000
|
||||
#define WM8350_GP11_EINT 0x0800
|
||||
#define WM8350_GP10_EINT 0x0400
|
||||
#define WM8350_GP9_EINT 0x0200
|
||||
#define WM8350_GP8_EINT 0x0100
|
||||
#define WM8350_GP7_EINT 0x0080
|
||||
#define WM8350_GP6_EINT 0x0040
|
||||
#define WM8350_GP5_EINT 0x0020
|
||||
#define WM8350_GP4_EINT 0x0010
|
||||
#define WM8350_GP3_EINT 0x0008
|
||||
#define WM8350_GP2_EINT 0x0004
|
||||
#define WM8350_GP1_EINT 0x0002
|
||||
#define WM8350_GP0_EINT 0x0001
|
||||
|
||||
|
||||
/*
|
||||
* R128 (0x80) - GPIO Debounce
|
||||
*/
|
||||
|
||||
@@ -666,20 +666,20 @@
|
||||
#define WM8350_ISINK_FLASH_DUR_64MS (1 << 8)
|
||||
#define WM8350_ISINK_FLASH_DUR_96MS (2 << 8)
|
||||
#define WM8350_ISINK_FLASH_DUR_1024MS (3 << 8)
|
||||
#define WM8350_ISINK_FLASH_ON_INSTANT (0 << 4)
|
||||
#define WM8350_ISINK_FLASH_ON_0_25S (1 << 4)
|
||||
#define WM8350_ISINK_FLASH_ON_0_50S (2 << 4)
|
||||
#define WM8350_ISINK_FLASH_ON_1_00S (3 << 4)
|
||||
#define WM8350_ISINK_FLASH_ON_1_95S (1 << 4)
|
||||
#define WM8350_ISINK_FLASH_ON_3_91S (2 << 4)
|
||||
#define WM8350_ISINK_FLASH_ON_7_80S (3 << 4)
|
||||
#define WM8350_ISINK_FLASH_OFF_INSTANT (0 << 0)
|
||||
#define WM8350_ISINK_FLASH_OFF_0_25S (1 << 0)
|
||||
#define WM8350_ISINK_FLASH_OFF_0_50S (2 << 0)
|
||||
#define WM8350_ISINK_FLASH_OFF_1_00S (3 << 0)
|
||||
#define WM8350_ISINK_FLASH_OFF_1_95S (1 << 0)
|
||||
#define WM8350_ISINK_FLASH_OFF_3_91S (2 << 0)
|
||||
#define WM8350_ISINK_FLASH_OFF_7_80S (3 << 0)
|
||||
#define WM8350_ISINK_FLASH_ON_INSTANT (0 << 0)
|
||||
#define WM8350_ISINK_FLASH_ON_0_25S (1 << 0)
|
||||
#define WM8350_ISINK_FLASH_ON_0_50S (2 << 0)
|
||||
#define WM8350_ISINK_FLASH_ON_1_00S (3 << 0)
|
||||
#define WM8350_ISINK_FLASH_ON_1_95S (1 << 0)
|
||||
#define WM8350_ISINK_FLASH_ON_3_91S (2 << 0)
|
||||
#define WM8350_ISINK_FLASH_ON_7_80S (3 << 0)
|
||||
#define WM8350_ISINK_FLASH_OFF_INSTANT (0 << 4)
|
||||
#define WM8350_ISINK_FLASH_OFF_0_25S (1 << 4)
|
||||
#define WM8350_ISINK_FLASH_OFF_0_50S (2 << 4)
|
||||
#define WM8350_ISINK_FLASH_OFF_1_00S (3 << 4)
|
||||
#define WM8350_ISINK_FLASH_OFF_1_95S (1 << 4)
|
||||
#define WM8350_ISINK_FLASH_OFF_3_91S (2 << 4)
|
||||
#define WM8350_ISINK_FLASH_OFF_7_80S (3 << 4)
|
||||
|
||||
/*
|
||||
* Regulator Interrupts.
|
||||
|
||||
@@ -12,7 +12,8 @@ typedef struct page *new_page_t(struct page *, unsigned long private, int **);
|
||||
extern int putback_lru_pages(struct list_head *l);
|
||||
extern int migrate_page(struct address_space *,
|
||||
struct page *, struct page *);
|
||||
extern int migrate_pages(struct list_head *l, new_page_t x, unsigned long);
|
||||
extern int migrate_pages(struct list_head *l, new_page_t x,
|
||||
unsigned long private, int offlining);
|
||||
|
||||
extern int fail_migrate_page(struct address_space *,
|
||||
struct page *, struct page *);
|
||||
@@ -26,10 +27,7 @@ extern int migrate_vmas(struct mm_struct *mm,
|
||||
|
||||
static inline int putback_lru_pages(struct list_head *l) { return 0; }
|
||||
static inline int migrate_pages(struct list_head *l, new_page_t x,
|
||||
unsigned long private) { return -ENOSYS; }
|
||||
|
||||
static inline int migrate_pages_to(struct list_head *pagelist,
|
||||
struct vm_area_struct *vma, int dest) { return 0; }
|
||||
unsigned long private, int offlining) { return -ENOSYS; }
|
||||
|
||||
static inline int migrate_prep(void) { return -ENOSYS; }
|
||||
|
||||
|
||||
@@ -61,6 +61,7 @@ enum {
|
||||
MLX4_DEV_CAP_FLAG_BAD_PKEY_CNTR = 1 << 8,
|
||||
MLX4_DEV_CAP_FLAG_BAD_QKEY_CNTR = 1 << 9,
|
||||
MLX4_DEV_CAP_FLAG_DPDP = 1 << 12,
|
||||
MLX4_DEV_CAP_FLAG_BLH = 1 << 15,
|
||||
MLX4_DEV_CAP_FLAG_MEM_WINDOW = 1 << 16,
|
||||
MLX4_DEV_CAP_FLAG_APM = 1 << 17,
|
||||
MLX4_DEV_CAP_FLAG_ATOMIC = 1 << 18,
|
||||
|
||||
+31
-6
@@ -620,13 +620,22 @@ void page_address_init(void);
|
||||
/*
|
||||
* On an anonymous page mapped into a user virtual memory area,
|
||||
* page->mapping points to its anon_vma, not to a struct address_space;
|
||||
* with the PAGE_MAPPING_ANON bit set to distinguish it.
|
||||
* with the PAGE_MAPPING_ANON bit set to distinguish it. See rmap.h.
|
||||
*
|
||||
* On an anonymous page in a VM_MERGEABLE area, if CONFIG_KSM is enabled,
|
||||
* the PAGE_MAPPING_KSM bit may be set along with the PAGE_MAPPING_ANON bit;
|
||||
* and then page->mapping points, not to an anon_vma, but to a private
|
||||
* structure which KSM associates with that merged page. See ksm.h.
|
||||
*
|
||||
* PAGE_MAPPING_KSM without PAGE_MAPPING_ANON is currently never used.
|
||||
*
|
||||
* Please note that, confusingly, "page_mapping" refers to the inode
|
||||
* address_space which maps the page from disk; whereas "page_mapped"
|
||||
* refers to user virtual address space into which the page is mapped.
|
||||
*/
|
||||
#define PAGE_MAPPING_ANON 1
|
||||
#define PAGE_MAPPING_KSM 2
|
||||
#define PAGE_MAPPING_FLAGS (PAGE_MAPPING_ANON | PAGE_MAPPING_KSM)
|
||||
|
||||
extern struct address_space swapper_space;
|
||||
static inline struct address_space *page_mapping(struct page *page)
|
||||
@@ -634,16 +643,19 @@ static inline struct address_space *page_mapping(struct page *page)
|
||||
struct address_space *mapping = page->mapping;
|
||||
|
||||
VM_BUG_ON(PageSlab(page));
|
||||
#ifdef CONFIG_SWAP
|
||||
if (unlikely(PageSwapCache(page)))
|
||||
mapping = &swapper_space;
|
||||
else
|
||||
#endif
|
||||
if (unlikely((unsigned long)mapping & PAGE_MAPPING_ANON))
|
||||
else if (unlikely((unsigned long)mapping & PAGE_MAPPING_ANON))
|
||||
mapping = NULL;
|
||||
return mapping;
|
||||
}
|
||||
|
||||
/* Neutral page->mapping pointer to address_space or anon_vma or other */
|
||||
static inline void *page_rmapping(struct page *page)
|
||||
{
|
||||
return (void *)((unsigned long)page->mapping & ~PAGE_MAPPING_FLAGS);
|
||||
}
|
||||
|
||||
static inline int PageAnon(struct page *page)
|
||||
{
|
||||
return ((unsigned long)page->mapping & PAGE_MAPPING_ANON) != 0;
|
||||
@@ -758,6 +770,7 @@ unsigned long unmap_vmas(struct mmu_gather **tlb,
|
||||
* @pmd_entry: if set, called for each non-empty PMD (3rd-level) entry
|
||||
* @pte_entry: if set, called for each non-empty PTE (4th-level) entry
|
||||
* @pte_hole: if set, called for each hole at all levels
|
||||
* @hugetlb_entry: if set, called for each hugetlb entry
|
||||
*
|
||||
* (see walk_page_range for more details)
|
||||
*/
|
||||
@@ -767,6 +780,8 @@ struct mm_walk {
|
||||
int (*pmd_entry)(pmd_t *, unsigned long, unsigned long, struct mm_walk *);
|
||||
int (*pte_entry)(pte_t *, unsigned long, unsigned long, struct mm_walk *);
|
||||
int (*pte_hole)(unsigned long, unsigned long, struct mm_walk *);
|
||||
int (*hugetlb_entry)(pte_t *, unsigned long, unsigned long,
|
||||
struct mm_walk *);
|
||||
struct mm_struct *mm;
|
||||
void *private;
|
||||
};
|
||||
@@ -1022,6 +1037,9 @@ extern void add_active_range(unsigned int nid, unsigned long start_pfn,
|
||||
extern void remove_active_range(unsigned int nid, unsigned long start_pfn,
|
||||
unsigned long end_pfn);
|
||||
extern void remove_all_active_ranges(void);
|
||||
void sort_node_map(void);
|
||||
unsigned long __absent_pages_in_range(int nid, unsigned long start_pfn,
|
||||
unsigned long end_pfn);
|
||||
extern unsigned long absent_pages_in_range(unsigned long start_pfn,
|
||||
unsigned long end_pfn);
|
||||
extern void get_pfn_range_for_nid(unsigned int nid,
|
||||
@@ -1071,6 +1089,7 @@ extern void zone_pcp_update(struct zone *zone);
|
||||
|
||||
/* nommu.c */
|
||||
extern atomic_long_t mmap_pages_allocated;
|
||||
extern int nommu_shrink_inode_mappings(struct inode *, size_t, size_t);
|
||||
|
||||
/* prio_tree.c */
|
||||
void vma_prio_tree_add(struct vm_area_struct *, struct vm_area_struct *old);
|
||||
@@ -1316,11 +1335,17 @@ extern int account_locked_memory(struct mm_struct *mm, struct rlimit *rlim,
|
||||
size_t size);
|
||||
extern void refund_locked_memory(struct mm_struct *mm, size_t size);
|
||||
|
||||
enum mf_flags {
|
||||
MF_COUNT_INCREASED = 1 << 0,
|
||||
};
|
||||
extern void memory_failure(unsigned long pfn, int trapno);
|
||||
extern int __memory_failure(unsigned long pfn, int trapno, int ref);
|
||||
extern int __memory_failure(unsigned long pfn, int trapno, int flags);
|
||||
extern int unpoison_memory(unsigned long pfn);
|
||||
extern int sysctl_memory_failure_early_kill;
|
||||
extern int sysctl_memory_failure_recovery;
|
||||
extern void shake_page(struct page *p, int access);
|
||||
extern atomic_long_t mce_bad_pages;
|
||||
extern int soft_offline_page(struct page *page, int flags);
|
||||
|
||||
#endif /* __KERNEL__ */
|
||||
#endif /* _LINUX_MM_H */
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user