Merge branch 'linus' into perfcounters/core
Conflicts: arch/x86/include/asm/kmap_types.h include/linux/mm.h include/asm-generic/kmap_types.h Merge reason: We crossed changes with kmap_types.h cleanups in mainline. Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
@@ -47,7 +47,7 @@
|
||||
|
||||
/* Current ACPICA subsystem version in YYYYMMDD format */
|
||||
|
||||
#define ACPI_CA_VERSION 0x20090320
|
||||
#define ACPI_CA_VERSION 0x20090521
|
||||
|
||||
#include "actypes.h"
|
||||
#include "actbl.h"
|
||||
@@ -201,6 +201,8 @@ acpi_evaluate_object_typed(acpi_handle object,
|
||||
acpi_status
|
||||
acpi_get_object_info(acpi_handle handle, struct acpi_buffer *return_buffer);
|
||||
|
||||
acpi_status acpi_install_method(u8 *buffer);
|
||||
|
||||
acpi_status
|
||||
acpi_get_next_object(acpi_object_type type,
|
||||
acpi_handle parent,
|
||||
@@ -375,7 +377,7 @@ acpi_status acpi_leave_sleep_state_prep(u8 sleep_state);
|
||||
acpi_status acpi_leave_sleep_state(u8 sleep_state);
|
||||
|
||||
/*
|
||||
* Debug output
|
||||
* Error/Warning output
|
||||
*/
|
||||
void ACPI_INTERNAL_VAR_XFACE
|
||||
acpi_error(const char *module_name,
|
||||
@@ -394,6 +396,9 @@ void ACPI_INTERNAL_VAR_XFACE
|
||||
acpi_info(const char *module_name,
|
||||
u32 line_number, const char *format, ...) ACPI_PRINTF_LIKE(3);
|
||||
|
||||
/*
|
||||
* Debug output
|
||||
*/
|
||||
#ifdef ACPI_DEBUG_OUTPUT
|
||||
|
||||
void ACPI_INTERNAL_VAR_XFACE
|
||||
|
||||
@@ -429,20 +429,12 @@ typedef unsigned long long acpi_integer;
|
||||
|
||||
/* Data manipulation */
|
||||
|
||||
#define ACPI_LOWORD(l) ((u16)(u32)(l))
|
||||
#define ACPI_HIWORD(l) ((u16)((((u32)(l)) >> 16) & 0xFFFF))
|
||||
#define ACPI_LOBYTE(l) ((u8)(u16)(l))
|
||||
#define ACPI_HIBYTE(l) ((u8)((((u16)(l)) >> 8) & 0xFF))
|
||||
|
||||
/* Full 64-bit integer must be available on both 32-bit and 64-bit platforms */
|
||||
|
||||
struct acpi_integer_overlay {
|
||||
u32 lo_dword;
|
||||
u32 hi_dword;
|
||||
};
|
||||
|
||||
#define ACPI_LODWORD(integer) (ACPI_CAST_PTR (struct acpi_integer_overlay, &integer)->lo_dword)
|
||||
#define ACPI_HIDWORD(integer) (ACPI_CAST_PTR (struct acpi_integer_overlay, &integer)->hi_dword)
|
||||
#define ACPI_LOBYTE(integer) ((u8) (u16)(integer))
|
||||
#define ACPI_HIBYTE(integer) ((u8) (((u16)(integer)) >> 8))
|
||||
#define ACPI_LOWORD(integer) ((u16) (u32)(integer))
|
||||
#define ACPI_HIWORD(integer) ((u16)(((u32)(integer)) >> 16))
|
||||
#define ACPI_LODWORD(integer64) ((u32) (u64)(integer64))
|
||||
#define ACPI_HIDWORD(integer64) ((u32)(((u64)(integer64)) >> 32))
|
||||
|
||||
#define ACPI_SET_BIT(target,bit) ((target) |= (bit))
|
||||
#define ACPI_CLEAR_BIT(target,bit) ((target) &= ~(bit))
|
||||
|
||||
@@ -62,4 +62,8 @@
|
||||
*/
|
||||
#define ACPI_UNUSED_VAR __attribute__ ((unused))
|
||||
|
||||
#ifdef _ANSI
|
||||
#define inline
|
||||
#endif
|
||||
|
||||
#endif /* __ACGCC_H__ */
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Name: aclinux.h - OS specific defines, etc.
|
||||
* Name: aclinux.h - OS specific defines, etc. for Linux
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2008, Intel Corp.
|
||||
* Copyright (C) 2000 - 2009, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -44,10 +44,13 @@
|
||||
#ifndef __ACLINUX_H__
|
||||
#define __ACLINUX_H__
|
||||
|
||||
/* Common (in-kernel/user-space) ACPICA configuration */
|
||||
|
||||
#define ACPI_USE_SYSTEM_CLIBRARY
|
||||
#define ACPI_USE_DO_WHILE_0
|
||||
#define ACPI_MUTEX_TYPE ACPI_BINARY_SEMAPHORE
|
||||
|
||||
|
||||
#ifdef __KERNEL__
|
||||
|
||||
#include <linux/string.h>
|
||||
@@ -63,15 +66,18 @@
|
||||
#include <linux/spinlock_types.h>
|
||||
#include <asm/current.h>
|
||||
|
||||
/* Host-dependent types and defines */
|
||||
/* Host-dependent types and defines for in-kernel ACPICA */
|
||||
|
||||
#define ACPI_MACHINE_WIDTH BITS_PER_LONG
|
||||
#define acpi_cache_t struct kmem_cache
|
||||
#define acpi_spinlock spinlock_t *
|
||||
#define ACPI_EXPORT_SYMBOL(symbol) EXPORT_SYMBOL(symbol);
|
||||
#define strtoul simple_strtoul
|
||||
|
||||
#else /* !__KERNEL__ */
|
||||
#define acpi_cache_t struct kmem_cache
|
||||
#define acpi_spinlock spinlock_t *
|
||||
#define acpi_cpu_flags unsigned long
|
||||
#define acpi_thread_id struct task_struct *
|
||||
|
||||
#else /* !__KERNEL__ */
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
@@ -79,6 +85,11 @@
|
||||
#include <ctype.h>
|
||||
#include <unistd.h>
|
||||
|
||||
/* Host-dependent types and defines for user-space ACPICA */
|
||||
|
||||
#define ACPI_FLUSH_CPU_CACHE()
|
||||
#define acpi_thread_id pthread_t
|
||||
|
||||
#if defined(__ia64__) || defined(__x86_64__)
|
||||
#define ACPI_MACHINE_WIDTH 64
|
||||
#define COMPILER_DEPENDENT_INT64 long
|
||||
@@ -94,17 +105,17 @@
|
||||
#define __cdecl
|
||||
#endif
|
||||
|
||||
#define ACPI_FLUSH_CPU_CACHE()
|
||||
#endif /* __KERNEL__ */
|
||||
#endif /* __KERNEL__ */
|
||||
|
||||
/* Linux uses GCC */
|
||||
|
||||
#include "acgcc.h"
|
||||
|
||||
#define acpi_cpu_flags unsigned long
|
||||
|
||||
#define acpi_thread_id struct task_struct *
|
||||
|
||||
#ifdef __KERNEL__
|
||||
/*
|
||||
* Overrides for in-kernel ACPICA
|
||||
*/
|
||||
static inline acpi_thread_id acpi_os_get_thread_id(void)
|
||||
{
|
||||
return current;
|
||||
@@ -119,30 +130,32 @@ static inline acpi_thread_id acpi_os_get_thread_id(void)
|
||||
#include <acpi/actypes.h>
|
||||
static inline void *acpi_os_allocate(acpi_size size)
|
||||
{
|
||||
return kmalloc(size, irqs_disabled()? GFP_ATOMIC : GFP_KERNEL);
|
||||
return kmalloc(size, irqs_disabled() ? GFP_ATOMIC : GFP_KERNEL);
|
||||
}
|
||||
|
||||
static inline void *acpi_os_allocate_zeroed(acpi_size size)
|
||||
{
|
||||
return kzalloc(size, irqs_disabled()? GFP_ATOMIC : GFP_KERNEL);
|
||||
return kzalloc(size, irqs_disabled() ? GFP_ATOMIC : GFP_KERNEL);
|
||||
}
|
||||
|
||||
static inline void *acpi_os_acquire_object(acpi_cache_t * cache)
|
||||
{
|
||||
return kmem_cache_zalloc(cache,
|
||||
irqs_disabled()? GFP_ATOMIC : GFP_KERNEL);
|
||||
irqs_disabled() ? GFP_ATOMIC : GFP_KERNEL);
|
||||
}
|
||||
|
||||
#define ACPI_ALLOCATE(a) acpi_os_allocate(a)
|
||||
#define ACPI_ALLOCATE_ZEROED(a) acpi_os_allocate_zeroed(a)
|
||||
#define ACPI_FREE(a) kfree(a)
|
||||
#define ACPI_ALLOCATE(a) acpi_os_allocate(a)
|
||||
#define ACPI_ALLOCATE_ZEROED(a) acpi_os_allocate_zeroed(a)
|
||||
#define ACPI_FREE(a) kfree(a)
|
||||
|
||||
/*
|
||||
* We need to show where it is safe to preempt execution of ACPICA
|
||||
*/
|
||||
#define ACPI_PREEMPTION_POINT() \
|
||||
do { \
|
||||
if (!irqs_disabled()) \
|
||||
cond_resched(); \
|
||||
/* Used within ACPICA to show where it is safe to preempt execution */
|
||||
|
||||
#define ACPI_PREEMPTION_POINT() \
|
||||
do { \
|
||||
if (!irqs_disabled()) \
|
||||
cond_resched(); \
|
||||
} while (0)
|
||||
|
||||
#endif /* __ACLINUX_H__ */
|
||||
#endif /* __KERNEL__ */
|
||||
|
||||
#endif /* __ACLINUX_H__ */
|
||||
|
||||
42
include/asm-generic/atomic64.h
Normal file
42
include/asm-generic/atomic64.h
Normal file
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Generic implementation of 64-bit atomics using spinlocks,
|
||||
* useful on processors that don't have 64-bit atomic instructions.
|
||||
*
|
||||
* Copyright © 2009 Paul Mackerras, IBM Corp. <paulus@au1.ibm.com>
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
#ifndef _ASM_GENERIC_ATOMIC64_H
|
||||
#define _ASM_GENERIC_ATOMIC64_H
|
||||
|
||||
typedef struct {
|
||||
long long counter;
|
||||
} atomic64_t;
|
||||
|
||||
#define ATOMIC64_INIT(i) { (i) }
|
||||
|
||||
extern long long atomic64_read(const atomic64_t *v);
|
||||
extern void atomic64_set(atomic64_t *v, long long i);
|
||||
extern void atomic64_add(long long a, atomic64_t *v);
|
||||
extern long long atomic64_add_return(long long a, atomic64_t *v);
|
||||
extern void atomic64_sub(long long a, atomic64_t *v);
|
||||
extern long long atomic64_sub_return(long long a, atomic64_t *v);
|
||||
extern long long atomic64_dec_if_positive(atomic64_t *v);
|
||||
extern long long atomic64_cmpxchg(atomic64_t *v, long long o, long long n);
|
||||
extern long long atomic64_xchg(atomic64_t *v, long long new);
|
||||
extern int atomic64_add_unless(atomic64_t *v, long long a, long long u);
|
||||
|
||||
#define atomic64_add_negative(a, v) (atomic64_add_return((a), (v)) < 0)
|
||||
#define atomic64_inc(v) atomic64_add(1LL, (v))
|
||||
#define atomic64_inc_return(v) atomic64_add_return(1LL, (v))
|
||||
#define atomic64_inc_and_test(v) (atomic64_inc_return(v) == 0)
|
||||
#define atomic64_sub_and_test(a, v) (atomic64_sub_return((a), (v)) == 0)
|
||||
#define atomic64_dec(v) atomic64_sub(1LL, (v))
|
||||
#define atomic64_dec_return(v) atomic64_sub_return(1LL, (v))
|
||||
#define atomic64_dec_and_test(v) (atomic64_dec_return((v)) == 0)
|
||||
#define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1LL, 0LL)
|
||||
|
||||
#endif /* _ASM_GENERIC_ATOMIC64_H */
|
||||
@@ -106,4 +106,6 @@
|
||||
#define EOWNERDEAD 130 /* Owner died */
|
||||
#define ENOTRECOVERABLE 131 /* State not recoverable */
|
||||
|
||||
#define ERFKILL 132 /* Operation not possible due to RF-kill */
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef _ASM_GENERIC_KMAP_TYPES_H
|
||||
#define _ASM_GENERIC_KMAP_TYPES_H
|
||||
|
||||
#ifdef CONFIG_DEBUG_HIGHMEM
|
||||
#ifdef __WITH_KM_FENCE
|
||||
# define D(n) __KM_FENCE_##n ,
|
||||
#else
|
||||
# define D(n)
|
||||
@@ -24,7 +24,10 @@ D(12) KM_SOFTIRQ1,
|
||||
D(13) KM_SYNC_ICACHE,
|
||||
D(14) KM_SYNC_DCACHE,
|
||||
D(15) KM_UML_USERCOPY, /* UML specific, for copy_*_user - used in do_op_one_page */
|
||||
D(16) KM_TYPE_NR
|
||||
D(16) KM_IRQ_PTE,
|
||||
D(17) KM_NMI,
|
||||
D(18) KM_NMI_PTE,
|
||||
D(19) KM_TYPE_NR
|
||||
};
|
||||
|
||||
#undef D
|
||||
|
||||
@@ -1,4 +1,57 @@
|
||||
#include <linux/section-names.h>
|
||||
/*
|
||||
* Helper macros to support writing architecture specific
|
||||
* linker scripts.
|
||||
*
|
||||
* A minimal linker scripts has following content:
|
||||
* [This is a sample, architectures may have special requiriements]
|
||||
*
|
||||
* OUTPUT_FORMAT(...)
|
||||
* OUTPUT_ARCH(...)
|
||||
* ENTRY(...)
|
||||
* SECTIONS
|
||||
* {
|
||||
* . = START;
|
||||
* __init_begin = .;
|
||||
* HEAD_TEXT_SECTION
|
||||
* INIT_TEXT_SECTION(PAGE_SIZE)
|
||||
* INIT_DATA_SECTION(...)
|
||||
* PERCPU(PAGE_SIZE)
|
||||
* __init_end = .;
|
||||
*
|
||||
* _stext = .;
|
||||
* TEXT_SECTION = 0
|
||||
* _etext = .;
|
||||
*
|
||||
* _sdata = .;
|
||||
* RO_DATA_SECTION(PAGE_SIZE)
|
||||
* RW_DATA_SECTION(...)
|
||||
* _edata = .;
|
||||
*
|
||||
* EXCEPTION_TABLE(...)
|
||||
* NOTES
|
||||
*
|
||||
* __bss_start = .;
|
||||
* BSS_SECTION(0, 0)
|
||||
* __bss_stop = .;
|
||||
* _end = .;
|
||||
*
|
||||
* /DISCARD/ : {
|
||||
* EXIT_TEXT
|
||||
* EXIT_DATA
|
||||
* EXIT_CALL
|
||||
* }
|
||||
* STABS_DEBUG
|
||||
* DWARF_DEBUG
|
||||
* }
|
||||
*
|
||||
* [__init_begin, __init_end] is the init section that may be freed after init
|
||||
* [_stext, _etext] is the text section
|
||||
* [_sdata, _edata] is the data section
|
||||
*
|
||||
* Some of the included output section have their own set of constants.
|
||||
* Examples are: [__initramfs_start, __initramfs_end] for initramfs and
|
||||
* [__nosave_begin, __nosave_end] for the nosave data
|
||||
*/
|
||||
|
||||
#ifndef LOAD_OFFSET
|
||||
#define LOAD_OFFSET 0
|
||||
@@ -116,7 +169,36 @@
|
||||
FTRACE_EVENTS() \
|
||||
TRACE_SYSCALLS()
|
||||
|
||||
#define RO_DATA(align) \
|
||||
/*
|
||||
* Data section helpers
|
||||
*/
|
||||
#define NOSAVE_DATA \
|
||||
. = ALIGN(PAGE_SIZE); \
|
||||
VMLINUX_SYMBOL(__nosave_begin) = .; \
|
||||
*(.data.nosave) \
|
||||
. = ALIGN(PAGE_SIZE); \
|
||||
VMLINUX_SYMBOL(__nosave_end) = .;
|
||||
|
||||
#define PAGE_ALIGNED_DATA(page_align) \
|
||||
. = ALIGN(page_align); \
|
||||
*(.data.page_aligned)
|
||||
|
||||
#define READ_MOSTLY_DATA(align) \
|
||||
. = ALIGN(align); \
|
||||
*(.data.read_mostly)
|
||||
|
||||
#define CACHELINE_ALIGNED_DATA(align) \
|
||||
. = ALIGN(align); \
|
||||
*(.data.cacheline_aligned)
|
||||
|
||||
#define INIT_TASK(align) \
|
||||
. = ALIGN(align); \
|
||||
*(.data.init_task)
|
||||
|
||||
/*
|
||||
* Read only Data
|
||||
*/
|
||||
#define RO_DATA_SECTION(align) \
|
||||
. = ALIGN((align)); \
|
||||
.rodata : AT(ADDR(.rodata) - LOAD_OFFSET) { \
|
||||
VMLINUX_SYMBOL(__start_rodata) = .; \
|
||||
@@ -270,9 +352,10 @@
|
||||
} \
|
||||
. = ALIGN((align));
|
||||
|
||||
/* RODATA provided for backward compatibility.
|
||||
/* RODATA & RO_DATA provided for backward compatibility.
|
||||
* All archs are supposed to use RO_DATA() */
|
||||
#define RODATA RO_DATA(4096)
|
||||
#define RODATA RO_DATA_SECTION(4096)
|
||||
#define RO_DATA(align) RO_DATA_SECTION(align)
|
||||
|
||||
#define SECURITY_INIT \
|
||||
.security_initcall.init : AT(ADDR(.security_initcall.init) - LOAD_OFFSET) { \
|
||||
@@ -330,16 +413,42 @@
|
||||
#endif
|
||||
|
||||
/* Section used for early init (in .S files) */
|
||||
#define HEAD_TEXT *(HEAD_TEXT_SECTION)
|
||||
#define HEAD_TEXT *(.head.text)
|
||||
|
||||
#define HEAD_TEXT_SECTION \
|
||||
.head.text : AT(ADDR(.head.text) - LOAD_OFFSET) { \
|
||||
HEAD_TEXT \
|
||||
}
|
||||
|
||||
/*
|
||||
* Exception table
|
||||
*/
|
||||
#define EXCEPTION_TABLE(align) \
|
||||
. = ALIGN(align); \
|
||||
__ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) { \
|
||||
VMLINUX_SYMBOL(__start___ex_table) = .; \
|
||||
*(__ex_table) \
|
||||
VMLINUX_SYMBOL(__stop___ex_table) = .; \
|
||||
}
|
||||
|
||||
/*
|
||||
* Init task
|
||||
*/
|
||||
#define INIT_TASK_DATA(align) \
|
||||
. = ALIGN(align); \
|
||||
.data.init_task : { \
|
||||
INIT_TASK \
|
||||
}
|
||||
|
||||
/* init and exit section handling */
|
||||
#define INIT_DATA \
|
||||
*(.init.data) \
|
||||
DEV_DISCARD(init.data) \
|
||||
DEV_DISCARD(init.rodata) \
|
||||
CPU_DISCARD(init.data) \
|
||||
CPU_DISCARD(init.rodata) \
|
||||
MEM_DISCARD(init.data) \
|
||||
*(.init.rodata) \
|
||||
DEV_DISCARD(init.rodata) \
|
||||
CPU_DISCARD(init.rodata) \
|
||||
MEM_DISCARD(init.rodata)
|
||||
|
||||
#define INIT_TEXT \
|
||||
@@ -363,9 +472,35 @@
|
||||
CPU_DISCARD(exit.text) \
|
||||
MEM_DISCARD(exit.text)
|
||||
|
||||
/* DWARF debug sections.
|
||||
Symbols in the DWARF debugging sections are relative to
|
||||
the beginning of the section so we begin them at 0. */
|
||||
#define EXIT_CALL \
|
||||
*(.exitcall.exit)
|
||||
|
||||
/*
|
||||
* bss (Block Started by Symbol) - uninitialized data
|
||||
* zeroed during startup
|
||||
*/
|
||||
#define SBSS \
|
||||
.sbss : AT(ADDR(.sbss) - LOAD_OFFSET) { \
|
||||
*(.sbss) \
|
||||
*(.scommon) \
|
||||
}
|
||||
|
||||
#define BSS(bss_align) \
|
||||
. = ALIGN(bss_align); \
|
||||
.bss : AT(ADDR(.bss) - LOAD_OFFSET) { \
|
||||
VMLINUX_SYMBOL(__bss_start) = .; \
|
||||
*(.bss.page_aligned) \
|
||||
*(.dynbss) \
|
||||
*(.bss) \
|
||||
*(COMMON) \
|
||||
VMLINUX_SYMBOL(__bss_stop) = .; \
|
||||
}
|
||||
|
||||
/*
|
||||
* DWARF debug sections.
|
||||
* Symbols in the DWARF debugging sections are relative to
|
||||
* the beginning of the section so we begin them at 0.
|
||||
*/
|
||||
#define DWARF_DEBUG \
|
||||
/* DWARF 1 */ \
|
||||
.debug 0 : { *(.debug) } \
|
||||
@@ -432,6 +567,12 @@
|
||||
VMLINUX_SYMBOL(__stop_notes) = .; \
|
||||
}
|
||||
|
||||
#define INIT_SETUP(initsetup_align) \
|
||||
. = ALIGN(initsetup_align); \
|
||||
VMLINUX_SYMBOL(__setup_start) = .; \
|
||||
*(.init.setup) \
|
||||
VMLINUX_SYMBOL(__setup_end) = .;
|
||||
|
||||
#define INITCALLS \
|
||||
*(.initcallearly.init) \
|
||||
VMLINUX_SYMBOL(__early_initcall_end) = .; \
|
||||
@@ -453,6 +594,31 @@
|
||||
*(.initcall7.init) \
|
||||
*(.initcall7s.init)
|
||||
|
||||
#define INIT_CALLS \
|
||||
VMLINUX_SYMBOL(__initcall_start) = .; \
|
||||
INITCALLS \
|
||||
VMLINUX_SYMBOL(__initcall_end) = .;
|
||||
|
||||
#define CON_INITCALL \
|
||||
VMLINUX_SYMBOL(__con_initcall_start) = .; \
|
||||
*(.con_initcall.init) \
|
||||
VMLINUX_SYMBOL(__con_initcall_end) = .;
|
||||
|
||||
#define SECURITY_INITCALL \
|
||||
VMLINUX_SYMBOL(__security_initcall_start) = .; \
|
||||
*(.security_initcall.init) \
|
||||
VMLINUX_SYMBOL(__security_initcall_end) = .;
|
||||
|
||||
#ifdef CONFIG_BLK_DEV_INITRD
|
||||
#define INIT_RAM_FS \
|
||||
. = ALIGN(PAGE_SIZE); \
|
||||
VMLINUX_SYMBOL(__initramfs_start) = .; \
|
||||
*(.init.ramfs) \
|
||||
VMLINUX_SYMBOL(__initramfs_end) = .;
|
||||
#else
|
||||
#define INITRAMFS
|
||||
#endif
|
||||
|
||||
/**
|
||||
* PERCPU_VADDR - define output section for percpu area
|
||||
* @vaddr: explicit base address (optional)
|
||||
@@ -509,3 +675,58 @@
|
||||
*(.data.percpu.shared_aligned) \
|
||||
VMLINUX_SYMBOL(__per_cpu_end) = .; \
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Definition of the high level *_SECTION macros
|
||||
* They will fit only a subset of the architectures
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Writeable data.
|
||||
* All sections are combined in a single .data section.
|
||||
* The sections following CONSTRUCTORS are arranged so their
|
||||
* typical alignment matches.
|
||||
* A cacheline is typical/always less than a PAGE_SIZE so
|
||||
* the sections that has this restriction (or similar)
|
||||
* is located before the ones requiring PAGE_SIZE alignment.
|
||||
* NOSAVE_DATA starts and ends with a PAGE_SIZE alignment which
|
||||
* matches the requirment of PAGE_ALIGNED_DATA.
|
||||
*
|
||||
* use 0 as page_align if page_aligned data is not used */
|
||||
#define RW_DATA_SECTION(cacheline, nosave, pagealigned, inittask) \
|
||||
. = ALIGN(PAGE_SIZE); \
|
||||
.data : AT(ADDR(.data) - LOAD_OFFSET) { \
|
||||
INIT_TASK(inittask) \
|
||||
CACHELINE_ALIGNED_DATA(cacheline) \
|
||||
READ_MOSTLY_DATA(cacheline) \
|
||||
DATA_DATA \
|
||||
CONSTRUCTORS \
|
||||
NOSAVE_DATA(nosave) \
|
||||
PAGE_ALIGNED_DATA(pagealigned) \
|
||||
}
|
||||
|
||||
#define INIT_TEXT_SECTION(inittext_align) \
|
||||
. = ALIGN(inittext_align); \
|
||||
.init.text : AT(ADDR(.init.text) - LOAD_OFFSET) { \
|
||||
VMLINUX_SYMBOL(_sinittext) = .; \
|
||||
INIT_TEXT \
|
||||
VMLINUX_SYMBOL(_einittext) = .; \
|
||||
}
|
||||
|
||||
#define INIT_DATA_SECTION(initsetup_align) \
|
||||
.init.data : AT(ADDR(.init.data) - LOAD_OFFSET) { \
|
||||
INIT_DATA \
|
||||
INIT_SETUP(initsetup_align) \
|
||||
INIT_CALLS \
|
||||
CON_INITCALL \
|
||||
SECURITY_INITCALL \
|
||||
INIT_RAM_FS \
|
||||
}
|
||||
|
||||
#define BSS_SECTION(sbss_align, bss_align) \
|
||||
SBSS \
|
||||
BSS(bss_align) \
|
||||
. = ALIGN(4);
|
||||
|
||||
|
||||
@@ -254,8 +254,8 @@
|
||||
{0x1002, 0x940A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R600|RADEON_NEW_MEMMAP}, \
|
||||
{0x1002, 0x940B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R600|RADEON_NEW_MEMMAP}, \
|
||||
{0x1002, 0x940F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R600|RADEON_NEW_MEMMAP}, \
|
||||
{0x1002, 0x94A0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV740|RADEON_NEW_MEMMAP}, \
|
||||
{0x1002, 0x94A1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV740|RADEON_NEW_MEMMAP}, \
|
||||
{0x1002, 0x94A0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV740|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
|
||||
{0x1002, 0x94A1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV740|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
|
||||
{0x1002, 0x94B1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV740|RADEON_NEW_MEMMAP}, \
|
||||
{0x1002, 0x94B3, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV740|RADEON_NEW_MEMMAP}, \
|
||||
{0x1002, 0x94B5, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV740|RADEON_NEW_MEMMAP}, \
|
||||
@@ -273,8 +273,8 @@
|
||||
{0x1002, 0x9456, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_NEW_MEMMAP}, \
|
||||
{0x1002, 0x945A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
|
||||
{0x1002, 0x945B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
|
||||
{0x1002, 0x9460, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
|
||||
{0x1002, 0x9462, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
|
||||
{0x1002, 0x9460, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_NEW_MEMMAP}, \
|
||||
{0x1002, 0x9462, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_NEW_MEMMAP}, \
|
||||
{0x1002, 0x946A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
|
||||
{0x1002, 0x946B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
|
||||
{0x1002, 0x947A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
|
||||
|
||||
@@ -496,6 +496,16 @@ typedef struct {
|
||||
#define DRM_RADEON_SETPARAM 0x19
|
||||
#define DRM_RADEON_SURF_ALLOC 0x1a
|
||||
#define DRM_RADEON_SURF_FREE 0x1b
|
||||
/* KMS ioctl */
|
||||
#define DRM_RADEON_GEM_INFO 0x1c
|
||||
#define DRM_RADEON_GEM_CREATE 0x1d
|
||||
#define DRM_RADEON_GEM_MMAP 0x1e
|
||||
#define DRM_RADEON_GEM_PREAD 0x21
|
||||
#define DRM_RADEON_GEM_PWRITE 0x22
|
||||
#define DRM_RADEON_GEM_SET_DOMAIN 0x23
|
||||
#define DRM_RADEON_GEM_WAIT_IDLE 0x24
|
||||
#define DRM_RADEON_CS 0x26
|
||||
#define DRM_RADEON_INFO 0x27
|
||||
|
||||
#define DRM_IOCTL_RADEON_CP_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_CP_INIT, drm_radeon_init_t)
|
||||
#define DRM_IOCTL_RADEON_CP_START DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_CP_START)
|
||||
@@ -524,6 +534,17 @@ typedef struct {
|
||||
#define DRM_IOCTL_RADEON_SETPARAM DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_SETPARAM, drm_radeon_setparam_t)
|
||||
#define DRM_IOCTL_RADEON_SURF_ALLOC DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_SURF_ALLOC, drm_radeon_surface_alloc_t)
|
||||
#define DRM_IOCTL_RADEON_SURF_FREE DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_SURF_FREE, drm_radeon_surface_free_t)
|
||||
/* KMS */
|
||||
#define DRM_IOCTL_RADEON_GEM_INFO DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_INFO, struct drm_radeon_gem_info)
|
||||
#define DRM_IOCTL_RADEON_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_CREATE, struct drm_radeon_gem_create)
|
||||
#define DRM_IOCTL_RADEON_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_MMAP, struct drm_radeon_gem_mmap)
|
||||
#define DRM_IOCTL_RADEON_GEM_PREAD DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_PREAD, struct drm_radeon_gem_pread)
|
||||
#define DRM_IOCTL_RADEON_GEM_PWRITE DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_PWRITE, struct drm_radeon_gem_pwrite)
|
||||
#define DRM_IOCTL_RADEON_GEM_SET_DOMAIN DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_SET_DOMAIN, struct drm_radeon_gem_set_domain)
|
||||
#define DRM_IOCTL_RADEON_GEM_WAIT_IDLE DRM_IOW(DRM_COMMAND_BASE + DRM_RADEON_GEM_WAIT_IDLE, struct drm_radeon_gem_wait_idle)
|
||||
#define DRM_IOCTL_RADEON_CS DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_CS, struct drm_radeon_cs)
|
||||
#define DRM_IOCTL_RADEON_INFO DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_INFO, struct drm_radeon_info)
|
||||
|
||||
|
||||
typedef struct drm_radeon_init {
|
||||
enum {
|
||||
@@ -682,6 +703,7 @@ typedef struct drm_radeon_indirect {
|
||||
#define RADEON_PARAM_VBLANK_CRTC 13 /* VBLANK CRTC */
|
||||
#define RADEON_PARAM_FB_LOCATION 14 /* FB location */
|
||||
#define RADEON_PARAM_NUM_GB_PIPES 15 /* num GB pipes */
|
||||
#define RADEON_PARAM_DEVICE_ID 16
|
||||
|
||||
typedef struct drm_radeon_getparam {
|
||||
int param;
|
||||
@@ -751,4 +773,112 @@ typedef struct drm_radeon_surface_free {
|
||||
#define DRM_RADEON_VBLANK_CRTC1 1
|
||||
#define DRM_RADEON_VBLANK_CRTC2 2
|
||||
|
||||
/*
|
||||
* Kernel modesetting world below.
|
||||
*/
|
||||
#define RADEON_GEM_DOMAIN_CPU 0x1
|
||||
#define RADEON_GEM_DOMAIN_GTT 0x2
|
||||
#define RADEON_GEM_DOMAIN_VRAM 0x4
|
||||
|
||||
struct drm_radeon_gem_info {
|
||||
uint64_t gart_size;
|
||||
uint64_t vram_size;
|
||||
uint64_t vram_visible;
|
||||
};
|
||||
|
||||
#define RADEON_GEM_NO_BACKING_STORE 1
|
||||
|
||||
struct drm_radeon_gem_create {
|
||||
uint64_t size;
|
||||
uint64_t alignment;
|
||||
uint32_t handle;
|
||||
uint32_t initial_domain;
|
||||
uint32_t flags;
|
||||
};
|
||||
|
||||
struct drm_radeon_gem_mmap {
|
||||
uint32_t handle;
|
||||
uint32_t pad;
|
||||
uint64_t offset;
|
||||
uint64_t size;
|
||||
uint64_t addr_ptr;
|
||||
};
|
||||
|
||||
struct drm_radeon_gem_set_domain {
|
||||
uint32_t handle;
|
||||
uint32_t read_domains;
|
||||
uint32_t write_domain;
|
||||
};
|
||||
|
||||
struct drm_radeon_gem_wait_idle {
|
||||
uint32_t handle;
|
||||
uint32_t pad;
|
||||
};
|
||||
|
||||
struct drm_radeon_gem_busy {
|
||||
uint32_t handle;
|
||||
uint32_t busy;
|
||||
};
|
||||
|
||||
struct drm_radeon_gem_pread {
|
||||
/** Handle for the object being read. */
|
||||
uint32_t handle;
|
||||
uint32_t pad;
|
||||
/** Offset into the object to read from */
|
||||
uint64_t offset;
|
||||
/** Length of data to read */
|
||||
uint64_t size;
|
||||
/** Pointer to write the data into. */
|
||||
/* void *, but pointers are not 32/64 compatible */
|
||||
uint64_t data_ptr;
|
||||
};
|
||||
|
||||
struct drm_radeon_gem_pwrite {
|
||||
/** Handle for the object being written to. */
|
||||
uint32_t handle;
|
||||
uint32_t pad;
|
||||
/** Offset into the object to write to */
|
||||
uint64_t offset;
|
||||
/** Length of data to write */
|
||||
uint64_t size;
|
||||
/** Pointer to read the data from. */
|
||||
/* void *, but pointers are not 32/64 compatible */
|
||||
uint64_t data_ptr;
|
||||
};
|
||||
|
||||
#define RADEON_CHUNK_ID_RELOCS 0x01
|
||||
#define RADEON_CHUNK_ID_IB 0x02
|
||||
|
||||
struct drm_radeon_cs_chunk {
|
||||
uint32_t chunk_id;
|
||||
uint32_t length_dw;
|
||||
uint64_t chunk_data;
|
||||
};
|
||||
|
||||
struct drm_radeon_cs_reloc {
|
||||
uint32_t handle;
|
||||
uint32_t read_domains;
|
||||
uint32_t write_domain;
|
||||
uint32_t flags;
|
||||
};
|
||||
|
||||
struct drm_radeon_cs {
|
||||
uint32_t num_chunks;
|
||||
uint32_t cs_id;
|
||||
/* this points to uint64_t * which point to cs chunks */
|
||||
uint64_t chunks;
|
||||
/* updates to the limits after this CS ioctl */
|
||||
uint64_t gart_limit;
|
||||
uint64_t vram_limit;
|
||||
};
|
||||
|
||||
#define RADEON_INFO_DEVICE_ID 0x00
|
||||
#define RADEON_INFO_NUM_GB_PIPES 0x01
|
||||
|
||||
struct drm_radeon_info {
|
||||
uint32_t request;
|
||||
uint32_t pad;
|
||||
uint64_t value;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
618
include/drm/ttm/ttm_bo_api.h
Normal file
618
include/drm/ttm/ttm_bo_api.h
Normal file
@@ -0,0 +1,618 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright (c) 2006-2009 VMware, Inc., Palo Alto, CA., USA
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sub license, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the
|
||||
* next paragraph) shall be included in all copies or substantial portions
|
||||
* of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
|
||||
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
* USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
**************************************************************************/
|
||||
/*
|
||||
* Authors: Thomas Hellstrom <thellstrom-at-vmware-dot-com>
|
||||
*/
|
||||
|
||||
#ifndef _TTM_BO_API_H_
|
||||
#define _TTM_BO_API_H_
|
||||
|
||||
#include "drm_hashtab.h"
|
||||
#include <linux/kref.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/wait.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/mm.h>
|
||||
#include <linux/rbtree.h>
|
||||
#include <linux/bitmap.h>
|
||||
|
||||
struct ttm_bo_device;
|
||||
|
||||
struct drm_mm_node;
|
||||
|
||||
/**
|
||||
* struct ttm_mem_reg
|
||||
*
|
||||
* @mm_node: Memory manager node.
|
||||
* @size: Requested size of memory region.
|
||||
* @num_pages: Actual size of memory region in pages.
|
||||
* @page_alignment: Page alignment.
|
||||
* @placement: Placement flags.
|
||||
*
|
||||
* Structure indicating the placement and space resources used by a
|
||||
* buffer object.
|
||||
*/
|
||||
|
||||
struct ttm_mem_reg {
|
||||
struct drm_mm_node *mm_node;
|
||||
unsigned long size;
|
||||
unsigned long num_pages;
|
||||
uint32_t page_alignment;
|
||||
uint32_t mem_type;
|
||||
uint32_t placement;
|
||||
};
|
||||
|
||||
/**
|
||||
* enum ttm_bo_type
|
||||
*
|
||||
* @ttm_bo_type_device: These are 'normal' buffers that can
|
||||
* be mmapped by user space. Each of these bos occupy a slot in the
|
||||
* device address space, that can be used for normal vm operations.
|
||||
*
|
||||
* @ttm_bo_type_user: These are user-space memory areas that are made
|
||||
* available to the GPU by mapping the buffer pages into the GPU aperture
|
||||
* space. These buffers cannot be mmaped from the device address space.
|
||||
*
|
||||
* @ttm_bo_type_kernel: These buffers are like ttm_bo_type_device buffers,
|
||||
* but they cannot be accessed from user-space. For kernel-only use.
|
||||
*/
|
||||
|
||||
enum ttm_bo_type {
|
||||
ttm_bo_type_device,
|
||||
ttm_bo_type_user,
|
||||
ttm_bo_type_kernel
|
||||
};
|
||||
|
||||
struct ttm_tt;
|
||||
|
||||
/**
|
||||
* struct ttm_buffer_object
|
||||
*
|
||||
* @bdev: Pointer to the buffer object device structure.
|
||||
* @buffer_start: The virtual user-space start address of ttm_bo_type_user
|
||||
* buffers.
|
||||
* @type: The bo type.
|
||||
* @destroy: Destruction function. If NULL, kfree is used.
|
||||
* @num_pages: Actual number of pages.
|
||||
* @addr_space_offset: Address space offset.
|
||||
* @acc_size: Accounted size for this object.
|
||||
* @kref: Reference count of this buffer object. When this refcount reaches
|
||||
* zero, the object is put on the delayed delete list.
|
||||
* @list_kref: List reference count of this buffer object. This member is
|
||||
* used to avoid destruction while the buffer object is still on a list.
|
||||
* Lru lists may keep one refcount, the delayed delete list, and kref != 0
|
||||
* keeps one refcount. When this refcount reaches zero,
|
||||
* the object is destroyed.
|
||||
* @event_queue: Queue for processes waiting on buffer object status change.
|
||||
* @lock: spinlock protecting mostly synchronization members.
|
||||
* @proposed_placement: Proposed placement for the buffer. Changed only by the
|
||||
* creator prior to validation as opposed to bo->mem.proposed_flags which is
|
||||
* changed by the implementation prior to a buffer move if it wants to outsmart
|
||||
* the buffer creator / user. This latter happens, for example, at eviction.
|
||||
* @mem: structure describing current placement.
|
||||
* @persistant_swap_storage: Usually the swap storage is deleted for buffers
|
||||
* pinned in physical memory. If this behaviour is not desired, this member
|
||||
* holds a pointer to a persistant shmem object.
|
||||
* @ttm: TTM structure holding system pages.
|
||||
* @evicted: Whether the object was evicted without user-space knowing.
|
||||
* @cpu_writes: For synchronization. Number of cpu writers.
|
||||
* @lru: List head for the lru list.
|
||||
* @ddestroy: List head for the delayed destroy list.
|
||||
* @swap: List head for swap LRU list.
|
||||
* @val_seq: Sequence of the validation holding the @reserved lock.
|
||||
* Used to avoid starvation when many processes compete to validate the
|
||||
* buffer. This member is protected by the bo_device::lru_lock.
|
||||
* @seq_valid: The value of @val_seq is valid. This value is protected by
|
||||
* the bo_device::lru_lock.
|
||||
* @reserved: Deadlock-free lock used for synchronization state transitions.
|
||||
* @sync_obj_arg: Opaque argument to synchronization object function.
|
||||
* @sync_obj: Pointer to a synchronization object.
|
||||
* @priv_flags: Flags describing buffer object internal state.
|
||||
* @vm_rb: Rb node for the vm rb tree.
|
||||
* @vm_node: Address space manager node.
|
||||
* @offset: The current GPU offset, which can have different meanings
|
||||
* depending on the memory type. For SYSTEM type memory, it should be 0.
|
||||
* @cur_placement: Hint of current placement.
|
||||
*
|
||||
* Base class for TTM buffer object, that deals with data placement and CPU
|
||||
* mappings. GPU mappings are really up to the driver, but for simpler GPUs
|
||||
* the driver can usually use the placement offset @offset directly as the
|
||||
* GPU virtual address. For drivers implementing multiple
|
||||
* GPU memory manager contexts, the driver should manage the address space
|
||||
* in these contexts separately and use these objects to get the correct
|
||||
* placement and caching for these GPU maps. This makes it possible to use
|
||||
* these objects for even quite elaborate memory management schemes.
|
||||
* The destroy member, the API visibility of this object makes it possible
|
||||
* to derive driver specific types.
|
||||
*/
|
||||
|
||||
struct ttm_buffer_object {
|
||||
/**
|
||||
* Members constant at init.
|
||||
*/
|
||||
|
||||
struct ttm_bo_device *bdev;
|
||||
unsigned long buffer_start;
|
||||
enum ttm_bo_type type;
|
||||
void (*destroy) (struct ttm_buffer_object *);
|
||||
unsigned long num_pages;
|
||||
uint64_t addr_space_offset;
|
||||
size_t acc_size;
|
||||
|
||||
/**
|
||||
* Members not needing protection.
|
||||
*/
|
||||
|
||||
struct kref kref;
|
||||
struct kref list_kref;
|
||||
wait_queue_head_t event_queue;
|
||||
spinlock_t lock;
|
||||
|
||||
/**
|
||||
* Members protected by the bo::reserved lock.
|
||||
*/
|
||||
|
||||
uint32_t proposed_placement;
|
||||
struct ttm_mem_reg mem;
|
||||
struct file *persistant_swap_storage;
|
||||
struct ttm_tt *ttm;
|
||||
bool evicted;
|
||||
|
||||
/**
|
||||
* Members protected by the bo::reserved lock only when written to.
|
||||
*/
|
||||
|
||||
atomic_t cpu_writers;
|
||||
|
||||
/**
|
||||
* Members protected by the bdev::lru_lock.
|
||||
*/
|
||||
|
||||
struct list_head lru;
|
||||
struct list_head ddestroy;
|
||||
struct list_head swap;
|
||||
uint32_t val_seq;
|
||||
bool seq_valid;
|
||||
|
||||
/**
|
||||
* Members protected by the bdev::lru_lock
|
||||
* only when written to.
|
||||
*/
|
||||
|
||||
atomic_t reserved;
|
||||
|
||||
|
||||
/**
|
||||
* Members protected by the bo::lock
|
||||
*/
|
||||
|
||||
void *sync_obj_arg;
|
||||
void *sync_obj;
|
||||
unsigned long priv_flags;
|
||||
|
||||
/**
|
||||
* Members protected by the bdev::vm_lock
|
||||
*/
|
||||
|
||||
struct rb_node vm_rb;
|
||||
struct drm_mm_node *vm_node;
|
||||
|
||||
|
||||
/**
|
||||
* Special members that are protected by the reserve lock
|
||||
* and the bo::lock when written to. Can be read with
|
||||
* either of these locks held.
|
||||
*/
|
||||
|
||||
unsigned long offset;
|
||||
uint32_t cur_placement;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct ttm_bo_kmap_obj
|
||||
*
|
||||
* @virtual: The current kernel virtual address.
|
||||
* @page: The page when kmap'ing a single page.
|
||||
* @bo_kmap_type: Type of bo_kmap.
|
||||
*
|
||||
* Object describing a kernel mapping. Since a TTM bo may be located
|
||||
* in various memory types with various caching policies, the
|
||||
* mapping can either be an ioremap, a vmap, a kmap or part of a
|
||||
* premapped region.
|
||||
*/
|
||||
|
||||
struct ttm_bo_kmap_obj {
|
||||
void *virtual;
|
||||
struct page *page;
|
||||
enum {
|
||||
ttm_bo_map_iomap,
|
||||
ttm_bo_map_vmap,
|
||||
ttm_bo_map_kmap,
|
||||
ttm_bo_map_premapped,
|
||||
} bo_kmap_type;
|
||||
};
|
||||
|
||||
/**
|
||||
* ttm_bo_reference - reference a struct ttm_buffer_object
|
||||
*
|
||||
* @bo: The buffer object.
|
||||
*
|
||||
* Returns a refcounted pointer to a buffer object.
|
||||
*/
|
||||
|
||||
static inline struct ttm_buffer_object *
|
||||
ttm_bo_reference(struct ttm_buffer_object *bo)
|
||||
{
|
||||
kref_get(&bo->kref);
|
||||
return bo;
|
||||
}
|
||||
|
||||
/**
|
||||
* ttm_bo_wait - wait for buffer idle.
|
||||
*
|
||||
* @bo: The buffer object.
|
||||
* @interruptible: Use interruptible wait.
|
||||
* @no_wait: Return immediately if buffer is busy.
|
||||
*
|
||||
* This function must be called with the bo::mutex held, and makes
|
||||
* sure any previous rendering to the buffer is completed.
|
||||
* Note: It might be necessary to block validations before the
|
||||
* wait by reserving the buffer.
|
||||
* Returns -EBUSY if no_wait is true and the buffer is busy.
|
||||
* Returns -ERESTART if interrupted by a signal.
|
||||
*/
|
||||
extern int ttm_bo_wait(struct ttm_buffer_object *bo, bool lazy,
|
||||
bool interruptible, bool no_wait);
|
||||
/**
|
||||
* ttm_buffer_object_validate
|
||||
*
|
||||
* @bo: The buffer object.
|
||||
* @proposed_placement: Proposed_placement for the buffer object.
|
||||
* @interruptible: Sleep interruptible if sleeping.
|
||||
* @no_wait: Return immediately if the buffer is busy.
|
||||
*
|
||||
* Changes placement and caching policy of the buffer object
|
||||
* according to bo::proposed_flags.
|
||||
* Returns
|
||||
* -EINVAL on invalid proposed_flags.
|
||||
* -ENOMEM on out-of-memory condition.
|
||||
* -EBUSY if no_wait is true and buffer busy.
|
||||
* -ERESTART if interrupted by a signal.
|
||||
*/
|
||||
extern int ttm_buffer_object_validate(struct ttm_buffer_object *bo,
|
||||
uint32_t proposed_placement,
|
||||
bool interruptible, bool no_wait);
|
||||
/**
|
||||
* ttm_bo_unref
|
||||
*
|
||||
* @bo: The buffer object.
|
||||
*
|
||||
* Unreference and clear a pointer to a buffer object.
|
||||
*/
|
||||
extern void ttm_bo_unref(struct ttm_buffer_object **bo);
|
||||
|
||||
/**
|
||||
* ttm_bo_synccpu_write_grab
|
||||
*
|
||||
* @bo: The buffer object:
|
||||
* @no_wait: Return immediately if buffer is busy.
|
||||
*
|
||||
* Synchronizes a buffer object for CPU RW access. This means
|
||||
* blocking command submission that affects the buffer and
|
||||
* waiting for buffer idle. This lock is recursive.
|
||||
* Returns
|
||||
* -EBUSY if the buffer is busy and no_wait is true.
|
||||
* -ERESTART if interrupted by a signal.
|
||||
*/
|
||||
|
||||
extern int
|
||||
ttm_bo_synccpu_write_grab(struct ttm_buffer_object *bo, bool no_wait);
|
||||
/**
|
||||
* ttm_bo_synccpu_write_release:
|
||||
*
|
||||
* @bo : The buffer object.
|
||||
*
|
||||
* Releases a synccpu lock.
|
||||
*/
|
||||
extern void ttm_bo_synccpu_write_release(struct ttm_buffer_object *bo);
|
||||
|
||||
/**
|
||||
* ttm_buffer_object_init
|
||||
*
|
||||
* @bdev: Pointer to a ttm_bo_device struct.
|
||||
* @bo: Pointer to a ttm_buffer_object to be initialized.
|
||||
* @size: Requested size of buffer object.
|
||||
* @type: Requested type of buffer object.
|
||||
* @flags: Initial placement flags.
|
||||
* @page_alignment: Data alignment in pages.
|
||||
* @buffer_start: Virtual address of user space data backing a
|
||||
* user buffer object.
|
||||
* @interruptible: If needing to sleep to wait for GPU resources,
|
||||
* sleep interruptible.
|
||||
* @persistant_swap_storage: Usually the swap storage is deleted for buffers
|
||||
* pinned in physical memory. If this behaviour is not desired, this member
|
||||
* holds a pointer to a persistant shmem object. Typically, this would
|
||||
* point to the shmem object backing a GEM object if TTM is used to back a
|
||||
* GEM user interface.
|
||||
* @acc_size: Accounted size for this object.
|
||||
* @destroy: Destroy function. Use NULL for kfree().
|
||||
*
|
||||
* This function initializes a pre-allocated struct ttm_buffer_object.
|
||||
* As this object may be part of a larger structure, this function,
|
||||
* together with the @destroy function,
|
||||
* enables driver-specific objects derived from a ttm_buffer_object.
|
||||
* On successful return, the object kref and list_kref are set to 1.
|
||||
* Returns
|
||||
* -ENOMEM: Out of memory.
|
||||
* -EINVAL: Invalid placement flags.
|
||||
* -ERESTART: Interrupted by signal while sleeping waiting for resources.
|
||||
*/
|
||||
|
||||
extern int ttm_buffer_object_init(struct ttm_bo_device *bdev,
|
||||
struct ttm_buffer_object *bo,
|
||||
unsigned long size,
|
||||
enum ttm_bo_type type,
|
||||
uint32_t flags,
|
||||
uint32_t page_alignment,
|
||||
unsigned long buffer_start,
|
||||
bool interrubtible,
|
||||
struct file *persistant_swap_storage,
|
||||
size_t acc_size,
|
||||
void (*destroy) (struct ttm_buffer_object *));
|
||||
/**
|
||||
* ttm_bo_synccpu_object_init
|
||||
*
|
||||
* @bdev: Pointer to a ttm_bo_device struct.
|
||||
* @bo: Pointer to a ttm_buffer_object to be initialized.
|
||||
* @size: Requested size of buffer object.
|
||||
* @type: Requested type of buffer object.
|
||||
* @flags: Initial placement flags.
|
||||
* @page_alignment: Data alignment in pages.
|
||||
* @buffer_start: Virtual address of user space data backing a
|
||||
* user buffer object.
|
||||
* @interruptible: If needing to sleep while waiting for GPU resources,
|
||||
* sleep interruptible.
|
||||
* @persistant_swap_storage: Usually the swap storage is deleted for buffers
|
||||
* pinned in physical memory. If this behaviour is not desired, this member
|
||||
* holds a pointer to a persistant shmem object. Typically, this would
|
||||
* point to the shmem object backing a GEM object if TTM is used to back a
|
||||
* GEM user interface.
|
||||
* @p_bo: On successful completion *p_bo points to the created object.
|
||||
*
|
||||
* This function allocates a ttm_buffer_object, and then calls
|
||||
* ttm_buffer_object_init on that object.
|
||||
* The destroy function is set to kfree().
|
||||
* Returns
|
||||
* -ENOMEM: Out of memory.
|
||||
* -EINVAL: Invalid placement flags.
|
||||
* -ERESTART: Interrupted by signal while waiting for resources.
|
||||
*/
|
||||
|
||||
extern int ttm_buffer_object_create(struct ttm_bo_device *bdev,
|
||||
unsigned long size,
|
||||
enum ttm_bo_type type,
|
||||
uint32_t flags,
|
||||
uint32_t page_alignment,
|
||||
unsigned long buffer_start,
|
||||
bool interruptible,
|
||||
struct file *persistant_swap_storage,
|
||||
struct ttm_buffer_object **p_bo);
|
||||
|
||||
/**
|
||||
* ttm_bo_check_placement
|
||||
*
|
||||
* @bo: the buffer object.
|
||||
* @set_flags: placement flags to set.
|
||||
* @clr_flags: placement flags to clear.
|
||||
*
|
||||
* Performs minimal validity checking on an intended change of
|
||||
* placement flags.
|
||||
* Returns
|
||||
* -EINVAL: Intended change is invalid or not allowed.
|
||||
*/
|
||||
|
||||
extern int ttm_bo_check_placement(struct ttm_buffer_object *bo,
|
||||
uint32_t set_flags, uint32_t clr_flags);
|
||||
|
||||
/**
|
||||
* ttm_bo_init_mm
|
||||
*
|
||||
* @bdev: Pointer to a ttm_bo_device struct.
|
||||
* @mem_type: The memory type.
|
||||
* @p_offset: offset for managed area in pages.
|
||||
* @p_size: size managed area in pages.
|
||||
*
|
||||
* Initialize a manager for a given memory type.
|
||||
* Note: if part of driver firstopen, it must be protected from a
|
||||
* potentially racing lastclose.
|
||||
* Returns:
|
||||
* -EINVAL: invalid size or memory type.
|
||||
* -ENOMEM: Not enough memory.
|
||||
* May also return driver-specified errors.
|
||||
*/
|
||||
|
||||
extern int ttm_bo_init_mm(struct ttm_bo_device *bdev, unsigned type,
|
||||
unsigned long p_offset, unsigned long p_size);
|
||||
/**
|
||||
* ttm_bo_clean_mm
|
||||
*
|
||||
* @bdev: Pointer to a ttm_bo_device struct.
|
||||
* @mem_type: The memory type.
|
||||
*
|
||||
* Take down a manager for a given memory type after first walking
|
||||
* the LRU list to evict any buffers left alive.
|
||||
*
|
||||
* Normally, this function is part of lastclose() or unload(), and at that
|
||||
* point there shouldn't be any buffers left created by user-space, since
|
||||
* there should've been removed by the file descriptor release() method.
|
||||
* However, before this function is run, make sure to signal all sync objects,
|
||||
* and verify that the delayed delete queue is empty. The driver must also
|
||||
* make sure that there are no NO_EVICT buffers present in this memory type
|
||||
* when the call is made.
|
||||
*
|
||||
* If this function is part of a VT switch, the caller must make sure that
|
||||
* there are no appications currently validating buffers before this
|
||||
* function is called. The caller can do that by first taking the
|
||||
* struct ttm_bo_device::ttm_lock in write mode.
|
||||
*
|
||||
* Returns:
|
||||
* -EINVAL: invalid or uninitialized memory type.
|
||||
* -EBUSY: There are still buffers left in this memory type.
|
||||
*/
|
||||
|
||||
extern int ttm_bo_clean_mm(struct ttm_bo_device *bdev, unsigned mem_type);
|
||||
|
||||
/**
|
||||
* ttm_bo_evict_mm
|
||||
*
|
||||
* @bdev: Pointer to a ttm_bo_device struct.
|
||||
* @mem_type: The memory type.
|
||||
*
|
||||
* Evicts all buffers on the lru list of the memory type.
|
||||
* This is normally part of a VT switch or an
|
||||
* out-of-memory-space-due-to-fragmentation handler.
|
||||
* The caller must make sure that there are no other processes
|
||||
* currently validating buffers, and can do that by taking the
|
||||
* struct ttm_bo_device::ttm_lock in write mode.
|
||||
*
|
||||
* Returns:
|
||||
* -EINVAL: Invalid or uninitialized memory type.
|
||||
* -ERESTART: The call was interrupted by a signal while waiting to
|
||||
* evict a buffer.
|
||||
*/
|
||||
|
||||
extern int ttm_bo_evict_mm(struct ttm_bo_device *bdev, unsigned mem_type);
|
||||
|
||||
/**
|
||||
* ttm_kmap_obj_virtual
|
||||
*
|
||||
* @map: A struct ttm_bo_kmap_obj returned from ttm_bo_kmap.
|
||||
* @is_iomem: Pointer to an integer that on return indicates 1 if the
|
||||
* virtual map is io memory, 0 if normal memory.
|
||||
*
|
||||
* Returns the virtual address of a buffer object area mapped by ttm_bo_kmap.
|
||||
* If *is_iomem is 1 on return, the virtual address points to an io memory area,
|
||||
* that should strictly be accessed by the iowriteXX() and similar functions.
|
||||
*/
|
||||
|
||||
static inline void *ttm_kmap_obj_virtual(struct ttm_bo_kmap_obj *map,
|
||||
bool *is_iomem)
|
||||
{
|
||||
*is_iomem = (map->bo_kmap_type == ttm_bo_map_iomap ||
|
||||
map->bo_kmap_type == ttm_bo_map_premapped);
|
||||
return map->virtual;
|
||||
}
|
||||
|
||||
/**
|
||||
* ttm_bo_kmap
|
||||
*
|
||||
* @bo: The buffer object.
|
||||
* @start_page: The first page to map.
|
||||
* @num_pages: Number of pages to map.
|
||||
* @map: pointer to a struct ttm_bo_kmap_obj representing the map.
|
||||
*
|
||||
* Sets up a kernel virtual mapping, using ioremap, vmap or kmap to the
|
||||
* data in the buffer object. The ttm_kmap_obj_virtual function can then be
|
||||
* used to obtain a virtual address to the data.
|
||||
*
|
||||
* Returns
|
||||
* -ENOMEM: Out of memory.
|
||||
* -EINVAL: Invalid range.
|
||||
*/
|
||||
|
||||
extern int ttm_bo_kmap(struct ttm_buffer_object *bo, unsigned long start_page,
|
||||
unsigned long num_pages, struct ttm_bo_kmap_obj *map);
|
||||
|
||||
/**
|
||||
* ttm_bo_kunmap
|
||||
*
|
||||
* @map: Object describing the map to unmap.
|
||||
*
|
||||
* Unmaps a kernel map set up by ttm_bo_kmap.
|
||||
*/
|
||||
|
||||
extern void ttm_bo_kunmap(struct ttm_bo_kmap_obj *map);
|
||||
|
||||
#if 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* ttm_fbdev_mmap - mmap fbdev memory backed by a ttm buffer object.
|
||||
*
|
||||
* @vma: vma as input from the fbdev mmap method.
|
||||
* @bo: The bo backing the address space. The address space will
|
||||
* have the same size as the bo, and start at offset 0.
|
||||
*
|
||||
* This function is intended to be called by the fbdev mmap method
|
||||
* if the fbdev address space is to be backed by a bo.
|
||||
*/
|
||||
|
||||
extern int ttm_fbdev_mmap(struct vm_area_struct *vma,
|
||||
struct ttm_buffer_object *bo);
|
||||
|
||||
/**
|
||||
* ttm_bo_mmap - mmap out of the ttm device address space.
|
||||
*
|
||||
* @filp: filp as input from the mmap method.
|
||||
* @vma: vma as input from the mmap method.
|
||||
* @bdev: Pointer to the ttm_bo_device with the address space manager.
|
||||
*
|
||||
* This function is intended to be called by the device mmap method.
|
||||
* if the device address space is to be backed by the bo manager.
|
||||
*/
|
||||
|
||||
extern int ttm_bo_mmap(struct file *filp, struct vm_area_struct *vma,
|
||||
struct ttm_bo_device *bdev);
|
||||
|
||||
/**
|
||||
* ttm_bo_io
|
||||
*
|
||||
* @bdev: Pointer to the struct ttm_bo_device.
|
||||
* @filp: Pointer to the struct file attempting to read / write.
|
||||
* @wbuf: User-space pointer to address of buffer to write. NULL on read.
|
||||
* @rbuf: User-space pointer to address of buffer to read into.
|
||||
* Null on write.
|
||||
* @count: Number of bytes to read / write.
|
||||
* @f_pos: Pointer to current file position.
|
||||
* @write: 1 for read, 0 for write.
|
||||
*
|
||||
* This function implements read / write into ttm buffer objects, and is
|
||||
* intended to
|
||||
* be called from the fops::read and fops::write method.
|
||||
* Returns:
|
||||
* See man (2) write, man(2) read. In particular,
|
||||
* the function may return -EINTR if
|
||||
* interrupted by a signal.
|
||||
*/
|
||||
|
||||
extern ssize_t ttm_bo_io(struct ttm_bo_device *bdev, struct file *filp,
|
||||
const char __user *wbuf, char __user *rbuf,
|
||||
size_t count, loff_t *f_pos, bool write);
|
||||
|
||||
extern void ttm_bo_swapout_all(struct ttm_bo_device *bdev);
|
||||
|
||||
#endif
|
||||
867
include/drm/ttm/ttm_bo_driver.h
Normal file
867
include/drm/ttm/ttm_bo_driver.h
Normal file
@@ -0,0 +1,867 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright (c) 2006-2009 Vmware, Inc., Palo Alto, CA., USA
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sub license, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the
|
||||
* next paragraph) shall be included in all copies or substantial portions
|
||||
* of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
|
||||
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
* USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
**************************************************************************/
|
||||
/*
|
||||
* Authors: Thomas Hellstrom <thellstrom-at-vmware-dot-com>
|
||||
*/
|
||||
#ifndef _TTM_BO_DRIVER_H_
|
||||
#define _TTM_BO_DRIVER_H_
|
||||
|
||||
#include "ttm/ttm_bo_api.h"
|
||||
#include "ttm/ttm_memory.h"
|
||||
#include "drm_mm.h"
|
||||
#include "linux/workqueue.h"
|
||||
#include "linux/fs.h"
|
||||
#include "linux/spinlock.h"
|
||||
|
||||
struct ttm_backend;
|
||||
|
||||
struct ttm_backend_func {
|
||||
/**
|
||||
* struct ttm_backend_func member populate
|
||||
*
|
||||
* @backend: Pointer to a struct ttm_backend.
|
||||
* @num_pages: Number of pages to populate.
|
||||
* @pages: Array of pointers to ttm pages.
|
||||
* @dummy_read_page: Page to be used instead of NULL pages in the
|
||||
* array @pages.
|
||||
*
|
||||
* Populate the backend with ttm pages. Depending on the backend,
|
||||
* it may or may not copy the @pages array.
|
||||
*/
|
||||
int (*populate) (struct ttm_backend *backend,
|
||||
unsigned long num_pages, struct page **pages,
|
||||
struct page *dummy_read_page);
|
||||
/**
|
||||
* struct ttm_backend_func member clear
|
||||
*
|
||||
* @backend: Pointer to a struct ttm_backend.
|
||||
*
|
||||
* This is an "unpopulate" function. Release all resources
|
||||
* allocated with populate.
|
||||
*/
|
||||
void (*clear) (struct ttm_backend *backend);
|
||||
|
||||
/**
|
||||
* struct ttm_backend_func member bind
|
||||
*
|
||||
* @backend: Pointer to a struct ttm_backend.
|
||||
* @bo_mem: Pointer to a struct ttm_mem_reg describing the
|
||||
* memory type and location for binding.
|
||||
*
|
||||
* Bind the backend pages into the aperture in the location
|
||||
* indicated by @bo_mem. This function should be able to handle
|
||||
* differences between aperture- and system page sizes.
|
||||
*/
|
||||
int (*bind) (struct ttm_backend *backend, struct ttm_mem_reg *bo_mem);
|
||||
|
||||
/**
|
||||
* struct ttm_backend_func member unbind
|
||||
*
|
||||
* @backend: Pointer to a struct ttm_backend.
|
||||
*
|
||||
* Unbind previously bound backend pages. This function should be
|
||||
* able to handle differences between aperture- and system page sizes.
|
||||
*/
|
||||
int (*unbind) (struct ttm_backend *backend);
|
||||
|
||||
/**
|
||||
* struct ttm_backend_func member destroy
|
||||
*
|
||||
* @backend: Pointer to a struct ttm_backend.
|
||||
*
|
||||
* Destroy the backend.
|
||||
*/
|
||||
void (*destroy) (struct ttm_backend *backend);
|
||||
};
|
||||
|
||||
/**
|
||||
* struct ttm_backend
|
||||
*
|
||||
* @bdev: Pointer to a struct ttm_bo_device.
|
||||
* @flags: For driver use.
|
||||
* @func: Pointer to a struct ttm_backend_func that describes
|
||||
* the backend methods.
|
||||
*
|
||||
*/
|
||||
|
||||
struct ttm_backend {
|
||||
struct ttm_bo_device *bdev;
|
||||
uint32_t flags;
|
||||
struct ttm_backend_func *func;
|
||||
};
|
||||
|
||||
#define TTM_PAGE_FLAG_VMALLOC (1 << 0)
|
||||
#define TTM_PAGE_FLAG_USER (1 << 1)
|
||||
#define TTM_PAGE_FLAG_USER_DIRTY (1 << 2)
|
||||
#define TTM_PAGE_FLAG_WRITE (1 << 3)
|
||||
#define TTM_PAGE_FLAG_SWAPPED (1 << 4)
|
||||
#define TTM_PAGE_FLAG_PERSISTANT_SWAP (1 << 5)
|
||||
#define TTM_PAGE_FLAG_ZERO_ALLOC (1 << 6)
|
||||
|
||||
enum ttm_caching_state {
|
||||
tt_uncached,
|
||||
tt_wc,
|
||||
tt_cached
|
||||
};
|
||||
|
||||
/**
|
||||
* struct ttm_tt
|
||||
*
|
||||
* @dummy_read_page: Page to map where the ttm_tt page array contains a NULL
|
||||
* pointer.
|
||||
* @pages: Array of pages backing the data.
|
||||
* @first_himem_page: Himem pages are put last in the page array, which
|
||||
* enables us to run caching attribute changes on only the first part
|
||||
* of the page array containing lomem pages. This is the index of the
|
||||
* first himem page.
|
||||
* @last_lomem_page: Index of the last lomem page in the page array.
|
||||
* @num_pages: Number of pages in the page array.
|
||||
* @bdev: Pointer to the current struct ttm_bo_device.
|
||||
* @be: Pointer to the ttm backend.
|
||||
* @tsk: The task for user ttm.
|
||||
* @start: virtual address for user ttm.
|
||||
* @swap_storage: Pointer to shmem struct file for swap storage.
|
||||
* @caching_state: The current caching state of the pages.
|
||||
* @state: The current binding state of the pages.
|
||||
*
|
||||
* This is a structure holding the pages, caching- and aperture binding
|
||||
* status for a buffer object that isn't backed by fixed (VRAM / AGP)
|
||||
* memory.
|
||||
*/
|
||||
|
||||
struct ttm_tt {
|
||||
struct page *dummy_read_page;
|
||||
struct page **pages;
|
||||
long first_himem_page;
|
||||
long last_lomem_page;
|
||||
uint32_t page_flags;
|
||||
unsigned long num_pages;
|
||||
struct ttm_bo_device *bdev;
|
||||
struct ttm_backend *be;
|
||||
struct task_struct *tsk;
|
||||
unsigned long start;
|
||||
struct file *swap_storage;
|
||||
enum ttm_caching_state caching_state;
|
||||
enum {
|
||||
tt_bound,
|
||||
tt_unbound,
|
||||
tt_unpopulated,
|
||||
} state;
|
||||
};
|
||||
|
||||
#define TTM_MEMTYPE_FLAG_FIXED (1 << 0) /* Fixed (on-card) PCI memory */
|
||||
#define TTM_MEMTYPE_FLAG_MAPPABLE (1 << 1) /* Memory mappable */
|
||||
#define TTM_MEMTYPE_FLAG_NEEDS_IOREMAP (1 << 2) /* Fixed memory needs ioremap
|
||||
before kernel access. */
|
||||
#define TTM_MEMTYPE_FLAG_CMA (1 << 3) /* Can't map aperture */
|
||||
|
||||
/**
|
||||
* struct ttm_mem_type_manager
|
||||
*
|
||||
* @has_type: The memory type has been initialized.
|
||||
* @use_type: The memory type is enabled.
|
||||
* @flags: TTM_MEMTYPE_XX flags identifying the traits of the memory
|
||||
* managed by this memory type.
|
||||
* @gpu_offset: If used, the GPU offset of the first managed page of
|
||||
* fixed memory or the first managed location in an aperture.
|
||||
* @io_offset: The io_offset of the first managed page of IO memory or
|
||||
* the first managed location in an aperture. For TTM_MEMTYPE_FLAG_CMA
|
||||
* memory, this should be set to NULL.
|
||||
* @io_size: The size of a managed IO region (fixed memory or aperture).
|
||||
* @io_addr: Virtual kernel address if the io region is pre-mapped. For
|
||||
* TTM_MEMTYPE_FLAG_NEEDS_IOREMAP there is no pre-mapped io map and
|
||||
* @io_addr should be set to NULL.
|
||||
* @size: Size of the managed region.
|
||||
* @available_caching: A mask of available caching types, TTM_PL_FLAG_XX,
|
||||
* as defined in ttm_placement_common.h
|
||||
* @default_caching: The default caching policy used for a buffer object
|
||||
* placed in this memory type if the user doesn't provide one.
|
||||
* @manager: The range manager used for this memory type. FIXME: If the aperture
|
||||
* has a page size different from the underlying system, the granularity
|
||||
* of this manager should take care of this. But the range allocating code
|
||||
* in ttm_bo.c needs to be modified for this.
|
||||
* @lru: The lru list for this memory type.
|
||||
*
|
||||
* This structure is used to identify and manage memory types for a device.
|
||||
* It's set up by the ttm_bo_driver::init_mem_type method.
|
||||
*/
|
||||
|
||||
struct ttm_mem_type_manager {
|
||||
|
||||
/*
|
||||
* No protection. Constant from start.
|
||||
*/
|
||||
|
||||
bool has_type;
|
||||
bool use_type;
|
||||
uint32_t flags;
|
||||
unsigned long gpu_offset;
|
||||
unsigned long io_offset;
|
||||
unsigned long io_size;
|
||||
void *io_addr;
|
||||
uint64_t size;
|
||||
uint32_t available_caching;
|
||||
uint32_t default_caching;
|
||||
|
||||
/*
|
||||
* Protected by the bdev->lru_lock.
|
||||
* TODO: Consider one lru_lock per ttm_mem_type_manager.
|
||||
* Plays ill with list removal, though.
|
||||
*/
|
||||
|
||||
struct drm_mm manager;
|
||||
struct list_head lru;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct ttm_bo_driver
|
||||
*
|
||||
* @mem_type_prio: Priority array of memory types to place a buffer object in
|
||||
* if it fits without evicting buffers from any of these memory types.
|
||||
* @mem_busy_prio: Priority array of memory types to place a buffer object in
|
||||
* if it needs to evict buffers to make room.
|
||||
* @num_mem_type_prio: Number of elements in the @mem_type_prio array.
|
||||
* @num_mem_busy_prio: Number of elements in the @num_mem_busy_prio array.
|
||||
* @create_ttm_backend_entry: Callback to create a struct ttm_backend.
|
||||
* @invalidate_caches: Callback to invalidate read caches when a buffer object
|
||||
* has been evicted.
|
||||
* @init_mem_type: Callback to initialize a struct ttm_mem_type_manager
|
||||
* structure.
|
||||
* @evict_flags: Callback to obtain placement flags when a buffer is evicted.
|
||||
* @move: Callback for a driver to hook in accelerated functions to
|
||||
* move a buffer.
|
||||
* If set to NULL, a potentially slow memcpy() move is used.
|
||||
* @sync_obj_signaled: See ttm_fence_api.h
|
||||
* @sync_obj_wait: See ttm_fence_api.h
|
||||
* @sync_obj_flush: See ttm_fence_api.h
|
||||
* @sync_obj_unref: See ttm_fence_api.h
|
||||
* @sync_obj_ref: See ttm_fence_api.h
|
||||
*/
|
||||
|
||||
struct ttm_bo_driver {
|
||||
const uint32_t *mem_type_prio;
|
||||
const uint32_t *mem_busy_prio;
|
||||
uint32_t num_mem_type_prio;
|
||||
uint32_t num_mem_busy_prio;
|
||||
|
||||
/**
|
||||
* struct ttm_bo_driver member create_ttm_backend_entry
|
||||
*
|
||||
* @bdev: The buffer object device.
|
||||
*
|
||||
* Create a driver specific struct ttm_backend.
|
||||
*/
|
||||
|
||||
struct ttm_backend *(*create_ttm_backend_entry)
|
||||
(struct ttm_bo_device *bdev);
|
||||
|
||||
/**
|
||||
* struct ttm_bo_driver member invalidate_caches
|
||||
*
|
||||
* @bdev: the buffer object device.
|
||||
* @flags: new placement of the rebound buffer object.
|
||||
*
|
||||
* A previosly evicted buffer has been rebound in a
|
||||
* potentially new location. Tell the driver that it might
|
||||
* consider invalidating read (texture) caches on the next command
|
||||
* submission as a consequence.
|
||||
*/
|
||||
|
||||
int (*invalidate_caches) (struct ttm_bo_device *bdev, uint32_t flags);
|
||||
int (*init_mem_type) (struct ttm_bo_device *bdev, uint32_t type,
|
||||
struct ttm_mem_type_manager *man);
|
||||
/**
|
||||
* struct ttm_bo_driver member evict_flags:
|
||||
*
|
||||
* @bo: the buffer object to be evicted
|
||||
*
|
||||
* Return the bo flags for a buffer which is not mapped to the hardware.
|
||||
* These will be placed in proposed_flags so that when the move is
|
||||
* finished, they'll end up in bo->mem.flags
|
||||
*/
|
||||
|
||||
uint32_t(*evict_flags) (struct ttm_buffer_object *bo);
|
||||
/**
|
||||
* struct ttm_bo_driver member move:
|
||||
*
|
||||
* @bo: the buffer to move
|
||||
* @evict: whether this motion is evicting the buffer from
|
||||
* the graphics address space
|
||||
* @interruptible: Use interruptible sleeps if possible when sleeping.
|
||||
* @no_wait: whether this should give up and return -EBUSY
|
||||
* if this move would require sleeping
|
||||
* @new_mem: the new memory region receiving the buffer
|
||||
*
|
||||
* Move a buffer between two memory regions.
|
||||
*/
|
||||
int (*move) (struct ttm_buffer_object *bo,
|
||||
bool evict, bool interruptible,
|
||||
bool no_wait, struct ttm_mem_reg *new_mem);
|
||||
|
||||
/**
|
||||
* struct ttm_bo_driver_member verify_access
|
||||
*
|
||||
* @bo: Pointer to a buffer object.
|
||||
* @filp: Pointer to a struct file trying to access the object.
|
||||
*
|
||||
* Called from the map / write / read methods to verify that the
|
||||
* caller is permitted to access the buffer object.
|
||||
* This member may be set to NULL, which will refuse this kind of
|
||||
* access for all buffer objects.
|
||||
* This function should return 0 if access is granted, -EPERM otherwise.
|
||||
*/
|
||||
int (*verify_access) (struct ttm_buffer_object *bo,
|
||||
struct file *filp);
|
||||
|
||||
/**
|
||||
* In case a driver writer dislikes the TTM fence objects,
|
||||
* the driver writer can replace those with sync objects of
|
||||
* his / her own. If it turns out that no driver writer is
|
||||
* using these. I suggest we remove these hooks and plug in
|
||||
* fences directly. The bo driver needs the following functionality:
|
||||
* See the corresponding functions in the fence object API
|
||||
* documentation.
|
||||
*/
|
||||
|
||||
bool (*sync_obj_signaled) (void *sync_obj, void *sync_arg);
|
||||
int (*sync_obj_wait) (void *sync_obj, void *sync_arg,
|
||||
bool lazy, bool interruptible);
|
||||
int (*sync_obj_flush) (void *sync_obj, void *sync_arg);
|
||||
void (*sync_obj_unref) (void **sync_obj);
|
||||
void *(*sync_obj_ref) (void *sync_obj);
|
||||
};
|
||||
|
||||
#define TTM_NUM_MEM_TYPES 8
|
||||
|
||||
#define TTM_BO_PRIV_FLAG_MOVING 0 /* Buffer object is moving and needs
|
||||
idling before CPU mapping */
|
||||
#define TTM_BO_PRIV_FLAG_MAX 1
|
||||
/**
|
||||
* struct ttm_bo_device - Buffer object driver device-specific data.
|
||||
*
|
||||
* @mem_glob: Pointer to a struct ttm_mem_global object for accounting.
|
||||
* @driver: Pointer to a struct ttm_bo_driver struct setup by the driver.
|
||||
* @count: Current number of buffer object.
|
||||
* @pages: Current number of pinned pages.
|
||||
* @dummy_read_page: Pointer to a dummy page used for mapping requests
|
||||
* of unpopulated pages.
|
||||
* @shrink: A shrink callback object used for buffre object swap.
|
||||
* @ttm_bo_extra_size: Extra size (sizeof(struct ttm_buffer_object) excluded)
|
||||
* used by a buffer object. This is excluding page arrays and backing pages.
|
||||
* @ttm_bo_size: This is @ttm_bo_extra_size + sizeof(struct ttm_buffer_object).
|
||||
* @man: An array of mem_type_managers.
|
||||
* @addr_space_mm: Range manager for the device address space.
|
||||
* lru_lock: Spinlock that protects the buffer+device lru lists and
|
||||
* ddestroy lists.
|
||||
* @nice_mode: Try nicely to wait for buffer idle when cleaning a manager.
|
||||
* If a GPU lockup has been detected, this is forced to 0.
|
||||
* @dev_mapping: A pointer to the struct address_space representing the
|
||||
* device address space.
|
||||
* @wq: Work queue structure for the delayed delete workqueue.
|
||||
*
|
||||
*/
|
||||
|
||||
struct ttm_bo_device {
|
||||
|
||||
/*
|
||||
* Constant after bo device init / atomic.
|
||||
*/
|
||||
|
||||
struct ttm_mem_global *mem_glob;
|
||||
struct ttm_bo_driver *driver;
|
||||
struct page *dummy_read_page;
|
||||
struct ttm_mem_shrink shrink;
|
||||
|
||||
size_t ttm_bo_extra_size;
|
||||
size_t ttm_bo_size;
|
||||
|
||||
rwlock_t vm_lock;
|
||||
/*
|
||||
* Protected by the vm lock.
|
||||
*/
|
||||
struct ttm_mem_type_manager man[TTM_NUM_MEM_TYPES];
|
||||
struct rb_root addr_space_rb;
|
||||
struct drm_mm addr_space_mm;
|
||||
|
||||
/*
|
||||
* Might want to change this to one lock per manager.
|
||||
*/
|
||||
spinlock_t lru_lock;
|
||||
/*
|
||||
* Protected by the lru lock.
|
||||
*/
|
||||
struct list_head ddestroy;
|
||||
struct list_head swap_lru;
|
||||
|
||||
/*
|
||||
* Protected by load / firstopen / lastclose /unload sync.
|
||||
*/
|
||||
|
||||
bool nice_mode;
|
||||
struct address_space *dev_mapping;
|
||||
|
||||
/*
|
||||
* Internal protection.
|
||||
*/
|
||||
|
||||
struct delayed_work wq;
|
||||
};
|
||||
|
||||
/**
|
||||
* ttm_flag_masked
|
||||
*
|
||||
* @old: Pointer to the result and original value.
|
||||
* @new: New value of bits.
|
||||
* @mask: Mask of bits to change.
|
||||
*
|
||||
* Convenience function to change a number of bits identified by a mask.
|
||||
*/
|
||||
|
||||
static inline uint32_t
|
||||
ttm_flag_masked(uint32_t *old, uint32_t new, uint32_t mask)
|
||||
{
|
||||
*old ^= (*old ^ new) & mask;
|
||||
return *old;
|
||||
}
|
||||
|
||||
/**
|
||||
* ttm_tt_create
|
||||
*
|
||||
* @bdev: pointer to a struct ttm_bo_device:
|
||||
* @size: Size of the data needed backing.
|
||||
* @page_flags: Page flags as identified by TTM_PAGE_FLAG_XX flags.
|
||||
* @dummy_read_page: See struct ttm_bo_device.
|
||||
*
|
||||
* Create a struct ttm_tt to back data with system memory pages.
|
||||
* No pages are actually allocated.
|
||||
* Returns:
|
||||
* NULL: Out of memory.
|
||||
*/
|
||||
extern struct ttm_tt *ttm_tt_create(struct ttm_bo_device *bdev,
|
||||
unsigned long size,
|
||||
uint32_t page_flags,
|
||||
struct page *dummy_read_page);
|
||||
|
||||
/**
|
||||
* ttm_tt_set_user:
|
||||
*
|
||||
* @ttm: The struct ttm_tt to populate.
|
||||
* @tsk: A struct task_struct for which @start is a valid user-space address.
|
||||
* @start: A valid user-space address.
|
||||
* @num_pages: Size in pages of the user memory area.
|
||||
*
|
||||
* Populate a struct ttm_tt with a user-space memory area after first pinning
|
||||
* the pages backing it.
|
||||
* Returns:
|
||||
* !0: Error.
|
||||
*/
|
||||
|
||||
extern int ttm_tt_set_user(struct ttm_tt *ttm,
|
||||
struct task_struct *tsk,
|
||||
unsigned long start, unsigned long num_pages);
|
||||
|
||||
/**
|
||||
* ttm_ttm_bind:
|
||||
*
|
||||
* @ttm: The struct ttm_tt containing backing pages.
|
||||
* @bo_mem: The struct ttm_mem_reg identifying the binding location.
|
||||
*
|
||||
* Bind the pages of @ttm to an aperture location identified by @bo_mem
|
||||
*/
|
||||
extern int ttm_tt_bind(struct ttm_tt *ttm, struct ttm_mem_reg *bo_mem);
|
||||
|
||||
/**
|
||||
* ttm_ttm_destroy:
|
||||
*
|
||||
* @ttm: The struct ttm_tt.
|
||||
*
|
||||
* Unbind, unpopulate and destroy a struct ttm_tt.
|
||||
*/
|
||||
extern void ttm_tt_destroy(struct ttm_tt *ttm);
|
||||
|
||||
/**
|
||||
* ttm_ttm_unbind:
|
||||
*
|
||||
* @ttm: The struct ttm_tt.
|
||||
*
|
||||
* Unbind a struct ttm_tt.
|
||||
*/
|
||||
extern void ttm_tt_unbind(struct ttm_tt *ttm);
|
||||
|
||||
/**
|
||||
* ttm_ttm_destroy:
|
||||
*
|
||||
* @ttm: The struct ttm_tt.
|
||||
* @index: Index of the desired page.
|
||||
*
|
||||
* Return a pointer to the struct page backing @ttm at page
|
||||
* index @index. If the page is unpopulated, one will be allocated to
|
||||
* populate that index.
|
||||
*
|
||||
* Returns:
|
||||
* NULL on OOM.
|
||||
*/
|
||||
extern struct page *ttm_tt_get_page(struct ttm_tt *ttm, int index);
|
||||
|
||||
/**
|
||||
* ttm_tt_cache_flush:
|
||||
*
|
||||
* @pages: An array of pointers to struct page:s to flush.
|
||||
* @num_pages: Number of pages to flush.
|
||||
*
|
||||
* Flush the data of the indicated pages from the cpu caches.
|
||||
* This is used when changing caching attributes of the pages from
|
||||
* cache-coherent.
|
||||
*/
|
||||
extern void ttm_tt_cache_flush(struct page *pages[], unsigned long num_pages);
|
||||
|
||||
/**
|
||||
* ttm_tt_set_placement_caching:
|
||||
*
|
||||
* @ttm A struct ttm_tt the backing pages of which will change caching policy.
|
||||
* @placement: Flag indicating the desired caching policy.
|
||||
*
|
||||
* This function will change caching policy of any default kernel mappings of
|
||||
* the pages backing @ttm. If changing from cached to uncached or
|
||||
* write-combined,
|
||||
* all CPU caches will first be flushed to make sure the data of the pages
|
||||
* hit RAM. This function may be very costly as it involves global TLB
|
||||
* and cache flushes and potential page splitting / combining.
|
||||
*/
|
||||
extern int ttm_tt_set_placement_caching(struct ttm_tt *ttm, uint32_t placement);
|
||||
extern int ttm_tt_swapout(struct ttm_tt *ttm,
|
||||
struct file *persistant_swap_storage);
|
||||
|
||||
/*
|
||||
* ttm_bo.c
|
||||
*/
|
||||
|
||||
/**
|
||||
* ttm_mem_reg_is_pci
|
||||
*
|
||||
* @bdev: Pointer to a struct ttm_bo_device.
|
||||
* @mem: A valid struct ttm_mem_reg.
|
||||
*
|
||||
* Returns true if the memory described by @mem is PCI memory,
|
||||
* false otherwise.
|
||||
*/
|
||||
extern bool ttm_mem_reg_is_pci(struct ttm_bo_device *bdev,
|
||||
struct ttm_mem_reg *mem);
|
||||
|
||||
/**
|
||||
* ttm_bo_mem_space
|
||||
*
|
||||
* @bo: Pointer to a struct ttm_buffer_object. the data of which
|
||||
* we want to allocate space for.
|
||||
* @proposed_placement: Proposed new placement for the buffer object.
|
||||
* @mem: A struct ttm_mem_reg.
|
||||
* @interruptible: Sleep interruptible when sliping.
|
||||
* @no_wait: Don't sleep waiting for space to become available.
|
||||
*
|
||||
* Allocate memory space for the buffer object pointed to by @bo, using
|
||||
* the placement flags in @mem, potentially evicting other idle buffer objects.
|
||||
* This function may sleep while waiting for space to become available.
|
||||
* Returns:
|
||||
* -EBUSY: No space available (only if no_wait == 1).
|
||||
* -ENOMEM: Could not allocate memory for the buffer object, either due to
|
||||
* fragmentation or concurrent allocators.
|
||||
* -ERESTART: An interruptible sleep was interrupted by a signal.
|
||||
*/
|
||||
extern int ttm_bo_mem_space(struct ttm_buffer_object *bo,
|
||||
uint32_t proposed_placement,
|
||||
struct ttm_mem_reg *mem,
|
||||
bool interruptible, bool no_wait);
|
||||
/**
|
||||
* ttm_bo_wait_for_cpu
|
||||
*
|
||||
* @bo: Pointer to a struct ttm_buffer_object.
|
||||
* @no_wait: Don't sleep while waiting.
|
||||
*
|
||||
* Wait until a buffer object is no longer sync'ed for CPU access.
|
||||
* Returns:
|
||||
* -EBUSY: Buffer object was sync'ed for CPU access. (only if no_wait == 1).
|
||||
* -ERESTART: An interruptible sleep was interrupted by a signal.
|
||||
*/
|
||||
|
||||
extern int ttm_bo_wait_cpu(struct ttm_buffer_object *bo, bool no_wait);
|
||||
|
||||
/**
|
||||
* ttm_bo_pci_offset - Get the PCI offset for the buffer object memory.
|
||||
*
|
||||
* @bo Pointer to a struct ttm_buffer_object.
|
||||
* @bus_base On return the base of the PCI region
|
||||
* @bus_offset On return the byte offset into the PCI region
|
||||
* @bus_size On return the byte size of the buffer object or zero if
|
||||
* the buffer object memory is not accessible through a PCI region.
|
||||
*
|
||||
* Returns:
|
||||
* -EINVAL if the buffer object is currently not mappable.
|
||||
* 0 otherwise.
|
||||
*/
|
||||
|
||||
extern int ttm_bo_pci_offset(struct ttm_bo_device *bdev,
|
||||
struct ttm_mem_reg *mem,
|
||||
unsigned long *bus_base,
|
||||
unsigned long *bus_offset,
|
||||
unsigned long *bus_size);
|
||||
|
||||
extern int ttm_bo_device_release(struct ttm_bo_device *bdev);
|
||||
|
||||
/**
|
||||
* ttm_bo_device_init
|
||||
*
|
||||
* @bdev: A pointer to a struct ttm_bo_device to initialize.
|
||||
* @mem_global: A pointer to an initialized struct ttm_mem_global.
|
||||
* @driver: A pointer to a struct ttm_bo_driver set up by the caller.
|
||||
* @file_page_offset: Offset into the device address space that is available
|
||||
* for buffer data. This ensures compatibility with other users of the
|
||||
* address space.
|
||||
*
|
||||
* Initializes a struct ttm_bo_device:
|
||||
* Returns:
|
||||
* !0: Failure.
|
||||
*/
|
||||
extern int ttm_bo_device_init(struct ttm_bo_device *bdev,
|
||||
struct ttm_mem_global *mem_glob,
|
||||
struct ttm_bo_driver *driver,
|
||||
uint64_t file_page_offset);
|
||||
|
||||
/**
|
||||
* ttm_bo_reserve:
|
||||
*
|
||||
* @bo: A pointer to a struct ttm_buffer_object.
|
||||
* @interruptible: Sleep interruptible if waiting.
|
||||
* @no_wait: Don't sleep while trying to reserve, rather return -EBUSY.
|
||||
* @use_sequence: If @bo is already reserved, Only sleep waiting for
|
||||
* it to become unreserved if @sequence < (@bo)->sequence.
|
||||
*
|
||||
* Locks a buffer object for validation. (Or prevents other processes from
|
||||
* locking it for validation) and removes it from lru lists, while taking
|
||||
* a number of measures to prevent deadlocks.
|
||||
*
|
||||
* Deadlocks may occur when two processes try to reserve multiple buffers in
|
||||
* different order, either by will or as a result of a buffer being evicted
|
||||
* to make room for a buffer already reserved. (Buffers are reserved before
|
||||
* they are evicted). The following algorithm prevents such deadlocks from
|
||||
* occuring:
|
||||
* 1) Buffers are reserved with the lru spinlock held. Upon successful
|
||||
* reservation they are removed from the lru list. This stops a reserved buffer
|
||||
* from being evicted. However the lru spinlock is released between the time
|
||||
* a buffer is selected for eviction and the time it is reserved.
|
||||
* Therefore a check is made when a buffer is reserved for eviction, that it
|
||||
* is still the first buffer in the lru list, before it is removed from the
|
||||
* list. @check_lru == 1 forces this check. If it fails, the function returns
|
||||
* -EINVAL, and the caller should then choose a new buffer to evict and repeat
|
||||
* the procedure.
|
||||
* 2) Processes attempting to reserve multiple buffers other than for eviction,
|
||||
* (typically execbuf), should first obtain a unique 32-bit
|
||||
* validation sequence number,
|
||||
* and call this function with @use_sequence == 1 and @sequence == the unique
|
||||
* sequence number. If upon call of this function, the buffer object is already
|
||||
* reserved, the validation sequence is checked against the validation
|
||||
* sequence of the process currently reserving the buffer,
|
||||
* and if the current validation sequence is greater than that of the process
|
||||
* holding the reservation, the function returns -EAGAIN. Otherwise it sleeps
|
||||
* waiting for the buffer to become unreserved, after which it retries
|
||||
* reserving.
|
||||
* The caller should, when receiving an -EAGAIN error
|
||||
* release all its buffer reservations, wait for @bo to become unreserved, and
|
||||
* then rerun the validation with the same validation sequence. This procedure
|
||||
* will always guarantee that the process with the lowest validation sequence
|
||||
* will eventually succeed, preventing both deadlocks and starvation.
|
||||
*
|
||||
* Returns:
|
||||
* -EAGAIN: The reservation may cause a deadlock.
|
||||
* Release all buffer reservations, wait for @bo to become unreserved and
|
||||
* try again. (only if use_sequence == 1).
|
||||
* -ERESTART: A wait for the buffer to become unreserved was interrupted by
|
||||
* a signal. Release all buffer reservations and return to user-space.
|
||||
*/
|
||||
extern int ttm_bo_reserve(struct ttm_buffer_object *bo,
|
||||
bool interruptible,
|
||||
bool no_wait, bool use_sequence, uint32_t sequence);
|
||||
|
||||
/**
|
||||
* ttm_bo_unreserve
|
||||
*
|
||||
* @bo: A pointer to a struct ttm_buffer_object.
|
||||
*
|
||||
* Unreserve a previous reservation of @bo.
|
||||
*/
|
||||
extern void ttm_bo_unreserve(struct ttm_buffer_object *bo);
|
||||
|
||||
/**
|
||||
* ttm_bo_wait_unreserved
|
||||
*
|
||||
* @bo: A pointer to a struct ttm_buffer_object.
|
||||
*
|
||||
* Wait for a struct ttm_buffer_object to become unreserved.
|
||||
* This is typically used in the execbuf code to relax cpu-usage when
|
||||
* a potential deadlock condition backoff.
|
||||
*/
|
||||
extern int ttm_bo_wait_unreserved(struct ttm_buffer_object *bo,
|
||||
bool interruptible);
|
||||
|
||||
/**
|
||||
* ttm_bo_block_reservation
|
||||
*
|
||||
* @bo: A pointer to a struct ttm_buffer_object.
|
||||
* @interruptible: Use interruptible sleep when waiting.
|
||||
* @no_wait: Don't sleep, but rather return -EBUSY.
|
||||
*
|
||||
* Block reservation for validation by simply reserving the buffer.
|
||||
* This is intended for single buffer use only without eviction,
|
||||
* and thus needs no deadlock protection.
|
||||
*
|
||||
* Returns:
|
||||
* -EBUSY: If no_wait == 1 and the buffer is already reserved.
|
||||
* -ERESTART: If interruptible == 1 and the process received a signal
|
||||
* while sleeping.
|
||||
*/
|
||||
extern int ttm_bo_block_reservation(struct ttm_buffer_object *bo,
|
||||
bool interruptible, bool no_wait);
|
||||
|
||||
/**
|
||||
* ttm_bo_unblock_reservation
|
||||
*
|
||||
* @bo: A pointer to a struct ttm_buffer_object.
|
||||
*
|
||||
* Unblocks reservation leaving lru lists untouched.
|
||||
*/
|
||||
extern void ttm_bo_unblock_reservation(struct ttm_buffer_object *bo);
|
||||
|
||||
/*
|
||||
* ttm_bo_util.c
|
||||
*/
|
||||
|
||||
/**
|
||||
* ttm_bo_move_ttm
|
||||
*
|
||||
* @bo: A pointer to a struct ttm_buffer_object.
|
||||
* @evict: 1: This is an eviction. Don't try to pipeline.
|
||||
* @no_wait: Never sleep, but rather return with -EBUSY.
|
||||
* @new_mem: struct ttm_mem_reg indicating where to move.
|
||||
*
|
||||
* Optimized move function for a buffer object with both old and
|
||||
* new placement backed by a TTM. The function will, if successful,
|
||||
* free any old aperture space, and set (@new_mem)->mm_node to NULL,
|
||||
* and update the (@bo)->mem placement flags. If unsuccessful, the old
|
||||
* data remains untouched, and it's up to the caller to free the
|
||||
* memory space indicated by @new_mem.
|
||||
* Returns:
|
||||
* !0: Failure.
|
||||
*/
|
||||
|
||||
extern int ttm_bo_move_ttm(struct ttm_buffer_object *bo,
|
||||
bool evict, bool no_wait,
|
||||
struct ttm_mem_reg *new_mem);
|
||||
|
||||
/**
|
||||
* ttm_bo_move_memcpy
|
||||
*
|
||||
* @bo: A pointer to a struct ttm_buffer_object.
|
||||
* @evict: 1: This is an eviction. Don't try to pipeline.
|
||||
* @no_wait: Never sleep, but rather return with -EBUSY.
|
||||
* @new_mem: struct ttm_mem_reg indicating where to move.
|
||||
*
|
||||
* Fallback move function for a mappable buffer object in mappable memory.
|
||||
* The function will, if successful,
|
||||
* free any old aperture space, and set (@new_mem)->mm_node to NULL,
|
||||
* and update the (@bo)->mem placement flags. If unsuccessful, the old
|
||||
* data remains untouched, and it's up to the caller to free the
|
||||
* memory space indicated by @new_mem.
|
||||
* Returns:
|
||||
* !0: Failure.
|
||||
*/
|
||||
|
||||
extern int ttm_bo_move_memcpy(struct ttm_buffer_object *bo,
|
||||
bool evict,
|
||||
bool no_wait, struct ttm_mem_reg *new_mem);
|
||||
|
||||
/**
|
||||
* ttm_bo_free_old_node
|
||||
*
|
||||
* @bo: A pointer to a struct ttm_buffer_object.
|
||||
*
|
||||
* Utility function to free an old placement after a successful move.
|
||||
*/
|
||||
extern void ttm_bo_free_old_node(struct ttm_buffer_object *bo);
|
||||
|
||||
/**
|
||||
* ttm_bo_move_accel_cleanup.
|
||||
*
|
||||
* @bo: A pointer to a struct ttm_buffer_object.
|
||||
* @sync_obj: A sync object that signals when moving is complete.
|
||||
* @sync_obj_arg: An argument to pass to the sync object idle / wait
|
||||
* functions.
|
||||
* @evict: This is an evict move. Don't return until the buffer is idle.
|
||||
* @no_wait: Never sleep, but rather return with -EBUSY.
|
||||
* @new_mem: struct ttm_mem_reg indicating where to move.
|
||||
*
|
||||
* Accelerated move function to be called when an accelerated move
|
||||
* has been scheduled. The function will create a new temporary buffer object
|
||||
* representing the old placement, and put the sync object on both buffer
|
||||
* objects. After that the newly created buffer object is unref'd to be
|
||||
* destroyed when the move is complete. This will help pipeline
|
||||
* buffer moves.
|
||||
*/
|
||||
|
||||
extern int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo,
|
||||
void *sync_obj,
|
||||
void *sync_obj_arg,
|
||||
bool evict, bool no_wait,
|
||||
struct ttm_mem_reg *new_mem);
|
||||
/**
|
||||
* ttm_io_prot
|
||||
*
|
||||
* @c_state: Caching state.
|
||||
* @tmp: Page protection flag for a normal, cached mapping.
|
||||
*
|
||||
* Utility function that returns the pgprot_t that should be used for
|
||||
* setting up a PTE with the caching model indicated by @c_state.
|
||||
*/
|
||||
extern pgprot_t ttm_io_prot(enum ttm_caching_state c_state, pgprot_t tmp);
|
||||
|
||||
#if (defined(CONFIG_AGP) || (defined(CONFIG_AGP_MODULE) && defined(MODULE)))
|
||||
#define TTM_HAS_AGP
|
||||
#include <linux/agp_backend.h>
|
||||
|
||||
/**
|
||||
* ttm_agp_backend_init
|
||||
*
|
||||
* @bdev: Pointer to a struct ttm_bo_device.
|
||||
* @bridge: The agp bridge this device is sitting on.
|
||||
*
|
||||
* Create a TTM backend that uses the indicated AGP bridge as an aperture
|
||||
* for TT memory. This function uses the linux agpgart interface to
|
||||
* bind and unbind memory backing a ttm_tt.
|
||||
*/
|
||||
extern struct ttm_backend *ttm_agp_backend_init(struct ttm_bo_device *bdev,
|
||||
struct agp_bridge_data *bridge);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
153
include/drm/ttm/ttm_memory.h
Normal file
153
include/drm/ttm/ttm_memory.h
Normal file
@@ -0,0 +1,153 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright (c) 2006-2009 VMware, Inc., Palo Alto, CA., USA
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sub license, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the
|
||||
* next paragraph) shall be included in all copies or substantial portions
|
||||
* of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
|
||||
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
* USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef TTM_MEMORY_H
|
||||
#define TTM_MEMORY_H
|
||||
|
||||
#include <linux/workqueue.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/wait.h>
|
||||
#include <linux/errno.h>
|
||||
|
||||
/**
|
||||
* struct ttm_mem_shrink - callback to shrink TTM memory usage.
|
||||
*
|
||||
* @do_shrink: The callback function.
|
||||
*
|
||||
* Arguments to the do_shrink functions are intended to be passed using
|
||||
* inheritance. That is, the argument class derives from struct ttm_mem_srink,
|
||||
* and can be accessed using container_of().
|
||||
*/
|
||||
|
||||
struct ttm_mem_shrink {
|
||||
int (*do_shrink) (struct ttm_mem_shrink *);
|
||||
};
|
||||
|
||||
/**
|
||||
* struct ttm_mem_global - Global memory accounting structure.
|
||||
*
|
||||
* @shrink: A single callback to shrink TTM memory usage. Extend this
|
||||
* to a linked list to be able to handle multiple callbacks when needed.
|
||||
* @swap_queue: A workqueue to handle shrinking in low memory situations. We
|
||||
* need a separate workqueue since it will spend a lot of time waiting
|
||||
* for the GPU, and this will otherwise block other workqueue tasks(?)
|
||||
* At this point we use only a single-threaded workqueue.
|
||||
* @work: The workqueue callback for the shrink queue.
|
||||
* @queue: Wait queue for processes suspended waiting for memory.
|
||||
* @lock: Lock to protect the @shrink - and the memory accounting members,
|
||||
* that is, essentially the whole structure with some exceptions.
|
||||
* @emer_memory: Lowmem memory limit available for root.
|
||||
* @max_memory: Lowmem memory limit available for non-root.
|
||||
* @swap_limit: Lowmem memory limit where the shrink workqueue kicks in.
|
||||
* @used_memory: Currently used lowmem memory.
|
||||
* @used_total_memory: Currently used total (lowmem + highmem) memory.
|
||||
* @total_memory_swap_limit: Total memory limit where the shrink workqueue
|
||||
* kicks in.
|
||||
* @max_total_memory: Total memory available to non-root processes.
|
||||
* @emer_total_memory: Total memory available to root processes.
|
||||
*
|
||||
* Note that this structure is not per device. It should be global for all
|
||||
* graphics devices.
|
||||
*/
|
||||
|
||||
struct ttm_mem_global {
|
||||
struct ttm_mem_shrink *shrink;
|
||||
struct workqueue_struct *swap_queue;
|
||||
struct work_struct work;
|
||||
wait_queue_head_t queue;
|
||||
spinlock_t lock;
|
||||
uint64_t emer_memory;
|
||||
uint64_t max_memory;
|
||||
uint64_t swap_limit;
|
||||
uint64_t used_memory;
|
||||
uint64_t used_total_memory;
|
||||
uint64_t total_memory_swap_limit;
|
||||
uint64_t max_total_memory;
|
||||
uint64_t emer_total_memory;
|
||||
};
|
||||
|
||||
/**
|
||||
* ttm_mem_init_shrink - initialize a struct ttm_mem_shrink object
|
||||
*
|
||||
* @shrink: The object to initialize.
|
||||
* @func: The callback function.
|
||||
*/
|
||||
|
||||
static inline void ttm_mem_init_shrink(struct ttm_mem_shrink *shrink,
|
||||
int (*func) (struct ttm_mem_shrink *))
|
||||
{
|
||||
shrink->do_shrink = func;
|
||||
}
|
||||
|
||||
/**
|
||||
* ttm_mem_register_shrink - register a struct ttm_mem_shrink object.
|
||||
*
|
||||
* @glob: The struct ttm_mem_global object to register with.
|
||||
* @shrink: An initialized struct ttm_mem_shrink object to register.
|
||||
*
|
||||
* Returns:
|
||||
* -EBUSY: There's already a callback registered. (May change).
|
||||
*/
|
||||
|
||||
static inline int ttm_mem_register_shrink(struct ttm_mem_global *glob,
|
||||
struct ttm_mem_shrink *shrink)
|
||||
{
|
||||
spin_lock(&glob->lock);
|
||||
if (glob->shrink != NULL) {
|
||||
spin_unlock(&glob->lock);
|
||||
return -EBUSY;
|
||||
}
|
||||
glob->shrink = shrink;
|
||||
spin_unlock(&glob->lock);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* ttm_mem_unregister_shrink - unregister a struct ttm_mem_shrink object.
|
||||
*
|
||||
* @glob: The struct ttm_mem_global object to unregister from.
|
||||
* @shrink: A previously registert struct ttm_mem_shrink object.
|
||||
*
|
||||
*/
|
||||
|
||||
static inline void ttm_mem_unregister_shrink(struct ttm_mem_global *glob,
|
||||
struct ttm_mem_shrink *shrink)
|
||||
{
|
||||
spin_lock(&glob->lock);
|
||||
BUG_ON(glob->shrink != shrink);
|
||||
glob->shrink = NULL;
|
||||
spin_unlock(&glob->lock);
|
||||
}
|
||||
|
||||
extern int ttm_mem_global_init(struct ttm_mem_global *glob);
|
||||
extern void ttm_mem_global_release(struct ttm_mem_global *glob);
|
||||
extern int ttm_mem_global_alloc(struct ttm_mem_global *glob, uint64_t memory,
|
||||
bool no_wait, bool interruptible, bool himem);
|
||||
extern void ttm_mem_global_free(struct ttm_mem_global *glob,
|
||||
uint64_t amount, bool himem);
|
||||
extern size_t ttm_round_pot(size_t size);
|
||||
#endif
|
||||
58
include/drm/ttm/ttm_module.h
Normal file
58
include/drm/ttm/ttm_module.h
Normal file
@@ -0,0 +1,58 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright 2008-2009 VMware, Inc., Palo Alto, CA., USA
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sub license, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the
|
||||
* next paragraph) shall be included in all copies or substantial portions
|
||||
* of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
|
||||
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
* USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
**************************************************************************/
|
||||
/*
|
||||
* Authors: Thomas Hellstrom <thellstrom-at-vmware-dot-com>
|
||||
*/
|
||||
|
||||
#ifndef _TTM_MODULE_H_
|
||||
#define _TTM_MODULE_H_
|
||||
|
||||
#include <linux/kernel.h>
|
||||
|
||||
#define TTM_PFX "[TTM]"
|
||||
|
||||
enum ttm_global_types {
|
||||
TTM_GLOBAL_TTM_MEM = 0,
|
||||
TTM_GLOBAL_TTM_BO,
|
||||
TTM_GLOBAL_TTM_OBJECT,
|
||||
TTM_GLOBAL_NUM
|
||||
};
|
||||
|
||||
struct ttm_global_reference {
|
||||
enum ttm_global_types global_type;
|
||||
size_t size;
|
||||
void *object;
|
||||
int (*init) (struct ttm_global_reference *);
|
||||
void (*release) (struct ttm_global_reference *);
|
||||
};
|
||||
|
||||
extern void ttm_global_init(void);
|
||||
extern void ttm_global_release(void);
|
||||
extern int ttm_global_item_ref(struct ttm_global_reference *ref);
|
||||
extern void ttm_global_item_unref(struct ttm_global_reference *ref);
|
||||
|
||||
#endif /* _TTM_MODULE_H_ */
|
||||
92
include/drm/ttm/ttm_placement.h
Normal file
92
include/drm/ttm/ttm_placement.h
Normal file
@@ -0,0 +1,92 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright (c) 2006-2009 VMware, Inc., Palo Alto, CA., USA
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sub license, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the
|
||||
* next paragraph) shall be included in all copies or substantial portions
|
||||
* of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
|
||||
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
* USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
**************************************************************************/
|
||||
/*
|
||||
* Authors: Thomas Hellstrom <thellstrom-at-vmware-dot-com>
|
||||
*/
|
||||
|
||||
#ifndef _TTM_PLACEMENT_H_
|
||||
#define _TTM_PLACEMENT_H_
|
||||
/*
|
||||
* Memory regions for data placement.
|
||||
*/
|
||||
|
||||
#define TTM_PL_SYSTEM 0
|
||||
#define TTM_PL_TT 1
|
||||
#define TTM_PL_VRAM 2
|
||||
#define TTM_PL_PRIV0 3
|
||||
#define TTM_PL_PRIV1 4
|
||||
#define TTM_PL_PRIV2 5
|
||||
#define TTM_PL_PRIV3 6
|
||||
#define TTM_PL_PRIV4 7
|
||||
#define TTM_PL_PRIV5 8
|
||||
#define TTM_PL_SWAPPED 15
|
||||
|
||||
#define TTM_PL_FLAG_SYSTEM (1 << TTM_PL_SYSTEM)
|
||||
#define TTM_PL_FLAG_TT (1 << TTM_PL_TT)
|
||||
#define TTM_PL_FLAG_VRAM (1 << TTM_PL_VRAM)
|
||||
#define TTM_PL_FLAG_PRIV0 (1 << TTM_PL_PRIV0)
|
||||
#define TTM_PL_FLAG_PRIV1 (1 << TTM_PL_PRIV1)
|
||||
#define TTM_PL_FLAG_PRIV2 (1 << TTM_PL_PRIV2)
|
||||
#define TTM_PL_FLAG_PRIV3 (1 << TTM_PL_PRIV3)
|
||||
#define TTM_PL_FLAG_PRIV4 (1 << TTM_PL_PRIV4)
|
||||
#define TTM_PL_FLAG_PRIV5 (1 << TTM_PL_PRIV5)
|
||||
#define TTM_PL_FLAG_SWAPPED (1 << TTM_PL_SWAPPED)
|
||||
#define TTM_PL_MASK_MEM 0x0000FFFF
|
||||
|
||||
/*
|
||||
* Other flags that affects data placement.
|
||||
* TTM_PL_FLAG_CACHED indicates cache-coherent mappings
|
||||
* if available.
|
||||
* TTM_PL_FLAG_SHARED means that another application may
|
||||
* reference the buffer.
|
||||
* TTM_PL_FLAG_NO_EVICT means that the buffer may never
|
||||
* be evicted to make room for other buffers.
|
||||
*/
|
||||
|
||||
#define TTM_PL_FLAG_CACHED (1 << 16)
|
||||
#define TTM_PL_FLAG_UNCACHED (1 << 17)
|
||||
#define TTM_PL_FLAG_WC (1 << 18)
|
||||
#define TTM_PL_FLAG_SHARED (1 << 20)
|
||||
#define TTM_PL_FLAG_NO_EVICT (1 << 21)
|
||||
|
||||
#define TTM_PL_MASK_CACHING (TTM_PL_FLAG_CACHED | \
|
||||
TTM_PL_FLAG_UNCACHED | \
|
||||
TTM_PL_FLAG_WC)
|
||||
|
||||
#define TTM_PL_MASK_MEMTYPE (TTM_PL_MASK_MEM | TTM_PL_MASK_CACHING)
|
||||
|
||||
/*
|
||||
* Access flags to be used for CPU- and GPU- mappings.
|
||||
* The idea is that the TTM synchronization mechanism will
|
||||
* allow concurrent READ access and exclusive write access.
|
||||
* Currently GPU- and CPU accesses are exclusive.
|
||||
*/
|
||||
|
||||
#define TTM_ACCESS_READ (1 << 0)
|
||||
#define TTM_ACCESS_WRITE (1 << 1)
|
||||
|
||||
#endif
|
||||
@@ -311,6 +311,7 @@ unifdef-y += ppp-comp.h
|
||||
unifdef-y += ptrace.h
|
||||
unifdef-y += quota.h
|
||||
unifdef-y += random.h
|
||||
unifdef-y += rfkill.h
|
||||
unifdef-y += irqnr.h
|
||||
unifdef-y += reboot.h
|
||||
unifdef-y += reiserfs_fs.h
|
||||
|
||||
264
include/linux/amba/pl022.h
Normal file
264
include/linux/amba/pl022.h
Normal file
@@ -0,0 +1,264 @@
|
||||
/*
|
||||
* include/linux/amba/pl022.h
|
||||
*
|
||||
* Copyright (C) 2008-2009 ST-Ericsson AB
|
||||
* Copyright (C) 2006 STMicroelectronics Pvt. Ltd.
|
||||
*
|
||||
* Author: Linus Walleij <linus.walleij@stericsson.com>
|
||||
*
|
||||
* Initial version inspired by:
|
||||
* linux-2.6.17-rc3-mm1/drivers/spi/pxa2xx_spi.c
|
||||
* Initial adoption to PL022 by:
|
||||
* Sachin Verma <sachin.verma@st.com>
|
||||
*
|
||||
* 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 _SSP_PL022_H
|
||||
#define _SSP_PL022_H
|
||||
|
||||
#include <linux/device.h>
|
||||
|
||||
/**
|
||||
* whether SSP is in loopback mode or not
|
||||
*/
|
||||
enum ssp_loopback {
|
||||
LOOPBACK_DISABLED,
|
||||
LOOPBACK_ENABLED
|
||||
};
|
||||
|
||||
/**
|
||||
* enum ssp_interface - interfaces allowed for this SSP Controller
|
||||
* @SSP_INTERFACE_MOTOROLA_SPI: Motorola Interface
|
||||
* @SSP_INTERFACE_TI_SYNC_SERIAL: Texas Instrument Synchronous Serial
|
||||
* interface
|
||||
* @SSP_INTERFACE_NATIONAL_MICROWIRE: National Semiconductor Microwire
|
||||
* interface
|
||||
* @SSP_INTERFACE_UNIDIRECTIONAL: Unidirectional interface (STn8810
|
||||
* &STn8815 only)
|
||||
*/
|
||||
enum ssp_interface {
|
||||
SSP_INTERFACE_MOTOROLA_SPI,
|
||||
SSP_INTERFACE_TI_SYNC_SERIAL,
|
||||
SSP_INTERFACE_NATIONAL_MICROWIRE,
|
||||
SSP_INTERFACE_UNIDIRECTIONAL
|
||||
};
|
||||
|
||||
/**
|
||||
* enum ssp_hierarchy - whether SSP is configured as Master or Slave
|
||||
*/
|
||||
enum ssp_hierarchy {
|
||||
SSP_MASTER,
|
||||
SSP_SLAVE
|
||||
};
|
||||
|
||||
/**
|
||||
* enum ssp_clock_params - clock parameters, to set SSP clock at a
|
||||
* desired freq
|
||||
*/
|
||||
struct ssp_clock_params {
|
||||
u8 cpsdvsr; /* value from 2 to 254 (even only!) */
|
||||
u8 scr; /* value from 0 to 255 */
|
||||
};
|
||||
|
||||
/**
|
||||
* enum ssp_rx_endian - endianess of Rx FIFO Data
|
||||
*/
|
||||
enum ssp_rx_endian {
|
||||
SSP_RX_MSB,
|
||||
SSP_RX_LSB
|
||||
};
|
||||
|
||||
/**
|
||||
* enum ssp_tx_endian - endianess of Tx FIFO Data
|
||||
*/
|
||||
enum ssp_tx_endian {
|
||||
SSP_TX_MSB,
|
||||
SSP_TX_LSB
|
||||
};
|
||||
|
||||
/**
|
||||
* enum ssp_data_size - number of bits in one data element
|
||||
*/
|
||||
enum ssp_data_size {
|
||||
SSP_DATA_BITS_4 = 0x03, SSP_DATA_BITS_5, SSP_DATA_BITS_6,
|
||||
SSP_DATA_BITS_7, SSP_DATA_BITS_8, SSP_DATA_BITS_9,
|
||||
SSP_DATA_BITS_10, SSP_DATA_BITS_11, SSP_DATA_BITS_12,
|
||||
SSP_DATA_BITS_13, SSP_DATA_BITS_14, SSP_DATA_BITS_15,
|
||||
SSP_DATA_BITS_16, SSP_DATA_BITS_17, SSP_DATA_BITS_18,
|
||||
SSP_DATA_BITS_19, SSP_DATA_BITS_20, SSP_DATA_BITS_21,
|
||||
SSP_DATA_BITS_22, SSP_DATA_BITS_23, SSP_DATA_BITS_24,
|
||||
SSP_DATA_BITS_25, SSP_DATA_BITS_26, SSP_DATA_BITS_27,
|
||||
SSP_DATA_BITS_28, SSP_DATA_BITS_29, SSP_DATA_BITS_30,
|
||||
SSP_DATA_BITS_31, SSP_DATA_BITS_32
|
||||
};
|
||||
|
||||
/**
|
||||
* enum ssp_mode - SSP mode of operation (Communication modes)
|
||||
*/
|
||||
enum ssp_mode {
|
||||
INTERRUPT_TRANSFER,
|
||||
POLLING_TRANSFER,
|
||||
DMA_TRANSFER
|
||||
};
|
||||
|
||||
/**
|
||||
* enum ssp_rx_level_trig - receive FIFO watermark level which triggers
|
||||
* IT: Interrupt fires when _N_ or more elements in RX FIFO.
|
||||
*/
|
||||
enum ssp_rx_level_trig {
|
||||
SSP_RX_1_OR_MORE_ELEM,
|
||||
SSP_RX_4_OR_MORE_ELEM,
|
||||
SSP_RX_8_OR_MORE_ELEM,
|
||||
SSP_RX_16_OR_MORE_ELEM,
|
||||
SSP_RX_32_OR_MORE_ELEM
|
||||
};
|
||||
|
||||
/**
|
||||
* Transmit FIFO watermark level which triggers (IT Interrupt fires
|
||||
* when _N_ or more empty locations in TX FIFO)
|
||||
*/
|
||||
enum ssp_tx_level_trig {
|
||||
SSP_TX_1_OR_MORE_EMPTY_LOC,
|
||||
SSP_TX_4_OR_MORE_EMPTY_LOC,
|
||||
SSP_TX_8_OR_MORE_EMPTY_LOC,
|
||||
SSP_TX_16_OR_MORE_EMPTY_LOC,
|
||||
SSP_TX_32_OR_MORE_EMPTY_LOC
|
||||
};
|
||||
|
||||
/**
|
||||
* enum SPI Clock Phase - clock phase (Motorola SPI interface only)
|
||||
* @SSP_CLK_RISING_EDGE: Receive data on rising edge
|
||||
* @SSP_CLK_FALLING_EDGE: Receive data on falling edge
|
||||
*/
|
||||
enum ssp_spi_clk_phase {
|
||||
SSP_CLK_RISING_EDGE,
|
||||
SSP_CLK_FALLING_EDGE
|
||||
};
|
||||
|
||||
/**
|
||||
* enum SPI Clock Polarity - clock polarity (Motorola SPI interface only)
|
||||
* @SSP_CLK_POL_IDLE_LOW: Low inactive level
|
||||
* @SSP_CLK_POL_IDLE_HIGH: High inactive level
|
||||
*/
|
||||
enum ssp_spi_clk_pol {
|
||||
SSP_CLK_POL_IDLE_LOW,
|
||||
SSP_CLK_POL_IDLE_HIGH
|
||||
};
|
||||
|
||||
/**
|
||||
* Microwire Conrol Lengths Command size in microwire format
|
||||
*/
|
||||
enum ssp_microwire_ctrl_len {
|
||||
SSP_BITS_4 = 0x03, SSP_BITS_5, SSP_BITS_6,
|
||||
SSP_BITS_7, SSP_BITS_8, SSP_BITS_9,
|
||||
SSP_BITS_10, SSP_BITS_11, SSP_BITS_12,
|
||||
SSP_BITS_13, SSP_BITS_14, SSP_BITS_15,
|
||||
SSP_BITS_16, SSP_BITS_17, SSP_BITS_18,
|
||||
SSP_BITS_19, SSP_BITS_20, SSP_BITS_21,
|
||||
SSP_BITS_22, SSP_BITS_23, SSP_BITS_24,
|
||||
SSP_BITS_25, SSP_BITS_26, SSP_BITS_27,
|
||||
SSP_BITS_28, SSP_BITS_29, SSP_BITS_30,
|
||||
SSP_BITS_31, SSP_BITS_32
|
||||
};
|
||||
|
||||
/**
|
||||
* enum Microwire Wait State
|
||||
* @SSP_MWIRE_WAIT_ZERO: No wait state inserted after last command bit
|
||||
* @SSP_MWIRE_WAIT_ONE: One wait state inserted after last command bit
|
||||
*/
|
||||
enum ssp_microwire_wait_state {
|
||||
SSP_MWIRE_WAIT_ZERO,
|
||||
SSP_MWIRE_WAIT_ONE
|
||||
};
|
||||
|
||||
/**
|
||||
* enum Microwire - whether Full/Half Duplex
|
||||
* @SSP_MICROWIRE_CHANNEL_FULL_DUPLEX: SSPTXD becomes bi-directional,
|
||||
* SSPRXD not used
|
||||
* @SSP_MICROWIRE_CHANNEL_HALF_DUPLEX: SSPTXD is an output, SSPRXD is
|
||||
* an input.
|
||||
*/
|
||||
enum ssp_duplex {
|
||||
SSP_MICROWIRE_CHANNEL_FULL_DUPLEX,
|
||||
SSP_MICROWIRE_CHANNEL_HALF_DUPLEX
|
||||
};
|
||||
|
||||
/**
|
||||
* CHIP select/deselect commands
|
||||
*/
|
||||
enum ssp_chip_select {
|
||||
SSP_CHIP_SELECT,
|
||||
SSP_CHIP_DESELECT
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* struct pl022_ssp_master - device.platform_data for SPI controller devices.
|
||||
* @num_chipselect: chipselects are used to distinguish individual
|
||||
* SPI slaves, and are numbered from zero to num_chipselects - 1.
|
||||
* each slave has a chipselect signal, but it's common that not
|
||||
* every chipselect is connected to a slave.
|
||||
* @enable_dma: if true enables DMA driven transfers.
|
||||
*/
|
||||
struct pl022_ssp_controller {
|
||||
u16 bus_id;
|
||||
u8 num_chipselect;
|
||||
u8 enable_dma:1;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct ssp_config_chip - spi_board_info.controller_data for SPI
|
||||
* slave devices, copied to spi_device.controller_data.
|
||||
*
|
||||
* @lbm: used for test purpose to internally connect RX and TX
|
||||
* @iface: Interface type(Motorola, TI, Microwire, Universal)
|
||||
* @hierarchy: sets whether interface is master or slave
|
||||
* @slave_tx_disable: SSPTXD is disconnected (in slave mode only)
|
||||
* @clk_freq: Tune freq parameters of SSP(when in master mode)
|
||||
* @endian_rx: Endianess of Data in Rx FIFO
|
||||
* @endian_tx: Endianess of Data in Tx FIFO
|
||||
* @data_size: Width of data element(4 to 32 bits)
|
||||
* @com_mode: communication mode: polling, Interrupt or DMA
|
||||
* @rx_lev_trig: Rx FIFO watermark level (for IT & DMA mode)
|
||||
* @tx_lev_trig: Tx FIFO watermark level (for IT & DMA mode)
|
||||
* @clk_phase: Motorola SPI interface Clock phase
|
||||
* @clk_pol: Motorola SPI interface Clock polarity
|
||||
* @ctrl_len: Microwire interface: Control length
|
||||
* @wait_state: Microwire interface: Wait state
|
||||
* @duplex: Microwire interface: Full/Half duplex
|
||||
* @cs_control: function pointer to board-specific function to
|
||||
* assert/deassert I/O port to control HW generation of devices chip-select.
|
||||
* @dma_xfer_type: Type of DMA xfer (Mem-to-periph or Periph-to-Periph)
|
||||
* @dma_config: DMA configuration for SSP controller and peripheral
|
||||
*/
|
||||
struct pl022_config_chip {
|
||||
struct device *dev;
|
||||
enum ssp_loopback lbm;
|
||||
enum ssp_interface iface;
|
||||
enum ssp_hierarchy hierarchy;
|
||||
bool slave_tx_disable;
|
||||
struct ssp_clock_params clk_freq;
|
||||
enum ssp_rx_endian endian_rx;
|
||||
enum ssp_tx_endian endian_tx;
|
||||
enum ssp_data_size data_size;
|
||||
enum ssp_mode com_mode;
|
||||
enum ssp_rx_level_trig rx_lev_trig;
|
||||
enum ssp_tx_level_trig tx_lev_trig;
|
||||
enum ssp_spi_clk_phase clk_phase;
|
||||
enum ssp_spi_clk_pol clk_pol;
|
||||
enum ssp_microwire_ctrl_len ctrl_len;
|
||||
enum ssp_microwire_wait_state wait_state;
|
||||
enum ssp_duplex duplex;
|
||||
void (*cs_control) (u32 control);
|
||||
};
|
||||
|
||||
#endif /* _SSP_PL022_H */
|
||||
@@ -114,6 +114,9 @@
|
||||
#define UART011_IFLS_TX4_8 (2 << 0)
|
||||
#define UART011_IFLS_TX6_8 (3 << 0)
|
||||
#define UART011_IFLS_TX7_8 (4 << 0)
|
||||
/* special values for ST vendor with deeper fifo */
|
||||
#define UART011_IFLS_RX_HALF (5 << 3)
|
||||
#define UART011_IFLS_TX_HALF (5 << 0)
|
||||
|
||||
#define UART011_OEIM (1 << 10) /* overrun error interrupt mask */
|
||||
#define UART011_BEIM (1 << 9) /* break error interrupt mask */
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
* @bus_width: Number of data lines wired up the slot
|
||||
* @detect_pin: GPIO pin wired to the card detect switch
|
||||
* @wp_pin: GPIO pin wired to the write protect sensor
|
||||
* @detect_is_active_high: The state of the detect pin when it is active
|
||||
*
|
||||
* If a given slot is not present on the board, @bus_width should be
|
||||
* set to 0. The other fields are ignored in this case.
|
||||
@@ -24,6 +25,7 @@ struct mci_slot_pdata {
|
||||
unsigned int bus_width;
|
||||
int detect_pin;
|
||||
int wp_pin;
|
||||
bool detect_is_active_high;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -590,6 +590,11 @@ static inline void bio_list_merge_head(struct bio_list *bl,
|
||||
bl->head = bl2->head;
|
||||
}
|
||||
|
||||
static inline struct bio *bio_list_peek(struct bio_list *bl)
|
||||
{
|
||||
return bl->head;
|
||||
}
|
||||
|
||||
static inline struct bio *bio_list_pop(struct bio_list *bl)
|
||||
{
|
||||
struct bio *bio = bl->head;
|
||||
|
||||
@@ -926,6 +926,7 @@ extern void blk_queue_alignment_offset(struct request_queue *q,
|
||||
unsigned int alignment);
|
||||
extern void blk_queue_io_min(struct request_queue *q, unsigned int min);
|
||||
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 void disk_stack_limits(struct gendisk *disk, struct block_device *bdev,
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#ifndef _LINUX_BUG_H
|
||||
#define _LINUX_BUG_H
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <asm/bug.h>
|
||||
|
||||
enum bug_trap_type {
|
||||
@@ -24,10 +23,6 @@ const struct bug_entry *find_bug(unsigned long bugaddr);
|
||||
|
||||
enum bug_trap_type report_bug(unsigned long bug_addr, struct pt_regs *regs);
|
||||
|
||||
int module_bug_finalize(const Elf_Ehdr *, const Elf_Shdr *,
|
||||
struct module *);
|
||||
void module_bug_cleanup(struct module *);
|
||||
|
||||
/* These are defined by the architecture */
|
||||
int is_valid_bugaddr(unsigned long addr);
|
||||
|
||||
@@ -38,13 +33,6 @@ static inline enum bug_trap_type report_bug(unsigned long bug_addr,
|
||||
{
|
||||
return BUG_TRAP_TYPE_BUG;
|
||||
}
|
||||
static inline int module_bug_finalize(const Elf_Ehdr *hdr,
|
||||
const Elf_Shdr *sechdrs,
|
||||
struct module *mod)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
static inline void module_bug_cleanup(struct module *mod) {}
|
||||
|
||||
#endif /* CONFIG_GENERIC_BUG */
|
||||
#endif /* _LINUX_BUG_H */
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
*/
|
||||
|
||||
#include <linux/device.h>
|
||||
#include <linux/kmemcheck.h>
|
||||
|
||||
#define C2PORT_NAME_LEN 32
|
||||
|
||||
@@ -20,8 +21,10 @@
|
||||
/* Main struct */
|
||||
struct c2port_ops;
|
||||
struct c2port_device {
|
||||
kmemcheck_bitfield_begin(flags);
|
||||
unsigned int access:1;
|
||||
unsigned int flash_access:1;
|
||||
kmemcheck_bitfield_end(flags);
|
||||
|
||||
int id;
|
||||
char name[C2PORT_NAME_LEN];
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
header-y += raw.h
|
||||
header-y += bcm.h
|
||||
header-y += error.h
|
||||
header-y += netlink.h
|
||||
|
||||
70
include/linux/can/dev.h
Normal file
70
include/linux/can/dev.h
Normal file
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* linux/can/dev.h
|
||||
*
|
||||
* Definitions for the CAN network device driver interface
|
||||
*
|
||||
* Copyright (C) 2006 Andrey Volkov <avolkov@varma-el.com>
|
||||
* Varma Electronics Oy
|
||||
*
|
||||
* Copyright (C) 2008 Wolfgang Grandegger <wg@grandegger.com>
|
||||
*
|
||||
* Send feedback to <socketcan-users@lists.berlios.de>
|
||||
*/
|
||||
|
||||
#ifndef CAN_DEV_H
|
||||
#define CAN_DEV_H
|
||||
|
||||
#include <linux/can/netlink.h>
|
||||
#include <linux/can/error.h>
|
||||
|
||||
/*
|
||||
* CAN mode
|
||||
*/
|
||||
enum can_mode {
|
||||
CAN_MODE_STOP = 0,
|
||||
CAN_MODE_START,
|
||||
CAN_MODE_SLEEP
|
||||
};
|
||||
|
||||
/*
|
||||
* CAN common private data
|
||||
*/
|
||||
#define CAN_ECHO_SKB_MAX 4
|
||||
|
||||
struct can_priv {
|
||||
struct can_device_stats can_stats;
|
||||
|
||||
struct can_bittiming bittiming;
|
||||
struct can_bittiming_const *bittiming_const;
|
||||
struct can_clock clock;
|
||||
|
||||
enum can_state state;
|
||||
u32 ctrlmode;
|
||||
|
||||
int restart_ms;
|
||||
struct timer_list restart_timer;
|
||||
|
||||
struct sk_buff *echo_skb[CAN_ECHO_SKB_MAX];
|
||||
|
||||
int (*do_set_bittiming)(struct net_device *dev);
|
||||
int (*do_set_mode)(struct net_device *dev, enum can_mode mode);
|
||||
int (*do_get_state)(const struct net_device *dev,
|
||||
enum can_state *state);
|
||||
};
|
||||
|
||||
struct net_device *alloc_candev(int sizeof_priv);
|
||||
void free_candev(struct net_device *dev);
|
||||
|
||||
int open_candev(struct net_device *dev);
|
||||
void close_candev(struct net_device *dev);
|
||||
|
||||
int register_candev(struct net_device *dev);
|
||||
void unregister_candev(struct net_device *dev);
|
||||
|
||||
int can_restart_now(struct net_device *dev);
|
||||
void can_bus_off(struct net_device *dev);
|
||||
|
||||
void can_put_echo_skb(struct sk_buff *skb, struct net_device *dev, int idx);
|
||||
void can_get_echo_skb(struct net_device *dev, int idx);
|
||||
|
||||
#endif /* CAN_DEV_H */
|
||||
113
include/linux/can/netlink.h
Normal file
113
include/linux/can/netlink.h
Normal file
@@ -0,0 +1,113 @@
|
||||
/*
|
||||
* linux/can/netlink.h
|
||||
*
|
||||
* Definitions for the CAN netlink interface
|
||||
*
|
||||
* Copyright (c) 2009 Wolfgang Grandegger <wg@grandegger.com>
|
||||
*
|
||||
* Send feedback to <socketcan-users@lists.berlios.de>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef CAN_NETLINK_H
|
||||
#define CAN_NETLINK_H
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
/*
|
||||
* CAN bit-timing parameters
|
||||
*
|
||||
* For futher information, please read chapter "8 BIT TIMING
|
||||
* REQUIREMENTS" of the "Bosch CAN Specification version 2.0"
|
||||
* at http://www.semiconductors.bosch.de/pdf/can2spec.pdf.
|
||||
*/
|
||||
struct can_bittiming {
|
||||
__u32 bitrate; /* Bit-rate in bits/second */
|
||||
__u32 sample_point; /* Sample point in one-tenth of a percent */
|
||||
__u32 tq; /* Time quanta (TQ) in nanoseconds */
|
||||
__u32 prop_seg; /* Propagation segment in TQs */
|
||||
__u32 phase_seg1; /* Phase buffer segment 1 in TQs */
|
||||
__u32 phase_seg2; /* Phase buffer segment 2 in TQs */
|
||||
__u32 sjw; /* Synchronisation jump width in TQs */
|
||||
__u32 brp; /* Bit-rate prescaler */
|
||||
};
|
||||
|
||||
/*
|
||||
* CAN harware-dependent bit-timing constant
|
||||
*
|
||||
* Used for calculating and checking bit-timing parameters
|
||||
*/
|
||||
struct can_bittiming_const {
|
||||
char name[16]; /* Name of the CAN controller hardware */
|
||||
__u32 tseg1_min; /* Time segement 1 = prop_seg + phase_seg1 */
|
||||
__u32 tseg1_max;
|
||||
__u32 tseg2_min; /* Time segement 2 = phase_seg2 */
|
||||
__u32 tseg2_max;
|
||||
__u32 sjw_max; /* Synchronisation jump width */
|
||||
__u32 brp_min; /* Bit-rate prescaler */
|
||||
__u32 brp_max;
|
||||
__u32 brp_inc;
|
||||
};
|
||||
|
||||
/*
|
||||
* CAN clock parameters
|
||||
*/
|
||||
struct can_clock {
|
||||
__u32 freq; /* CAN system clock frequency in Hz */
|
||||
};
|
||||
|
||||
/*
|
||||
* CAN operational and error states
|
||||
*/
|
||||
enum can_state {
|
||||
CAN_STATE_ERROR_ACTIVE = 0, /* RX/TX error count < 96 */
|
||||
CAN_STATE_ERROR_WARNING, /* RX/TX error count < 128 */
|
||||
CAN_STATE_ERROR_PASSIVE, /* RX/TX error count < 256 */
|
||||
CAN_STATE_BUS_OFF, /* RX/TX error count >= 256 */
|
||||
CAN_STATE_STOPPED, /* Device is stopped */
|
||||
CAN_STATE_SLEEPING, /* Device is sleeping */
|
||||
CAN_STATE_MAX
|
||||
};
|
||||
|
||||
/*
|
||||
* CAN controller mode
|
||||
*/
|
||||
struct can_ctrlmode {
|
||||
__u32 mask;
|
||||
__u32 flags;
|
||||
};
|
||||
|
||||
#define CAN_CTRLMODE_LOOPBACK 0x1 /* Loopback mode */
|
||||
#define CAN_CTRLMODE_LISTENONLY 0x2 /* Listen-only mode */
|
||||
#define CAN_CTRLMODE_3_SAMPLES 0x4 /* Triple sampling mode */
|
||||
|
||||
/*
|
||||
* CAN device statistics
|
||||
*/
|
||||
struct can_device_stats {
|
||||
__u32 bus_error; /* Bus errors */
|
||||
__u32 error_warning; /* Changes to error warning state */
|
||||
__u32 error_passive; /* Changes to error passive state */
|
||||
__u32 bus_off; /* Changes to bus off state */
|
||||
__u32 arbitration_lost; /* Arbitration lost errors */
|
||||
__u32 restarts; /* CAN controller re-starts */
|
||||
};
|
||||
|
||||
/*
|
||||
* CAN netlink interface
|
||||
*/
|
||||
enum {
|
||||
IFLA_CAN_UNSPEC,
|
||||
IFLA_CAN_BITTIMING,
|
||||
IFLA_CAN_BITTIMING_CONST,
|
||||
IFLA_CAN_CLOCK,
|
||||
IFLA_CAN_STATE,
|
||||
IFLA_CAN_CTRLMODE,
|
||||
IFLA_CAN_RESTART_MS,
|
||||
IFLA_CAN_RESTART,
|
||||
__IFLA_CAN_MAX
|
||||
};
|
||||
|
||||
#define IFLA_CAN_MAX (__IFLA_CAN_MAX - 1)
|
||||
|
||||
#endif /* CAN_NETLINK_H */
|
||||
35
include/linux/can/platform/sja1000.h
Normal file
35
include/linux/can/platform/sja1000.h
Normal file
@@ -0,0 +1,35 @@
|
||||
#ifndef _CAN_PLATFORM_SJA1000_H_
|
||||
#define _CAN_PLATFORM_SJA1000_H_
|
||||
|
||||
/* clock divider register */
|
||||
#define CDR_CLKOUT_MASK 0x07
|
||||
#define CDR_CLK_OFF 0x08 /* Clock off (CLKOUT pin) */
|
||||
#define CDR_RXINPEN 0x20 /* TX1 output is RX irq output */
|
||||
#define CDR_CBP 0x40 /* CAN input comparator bypass */
|
||||
#define CDR_PELICAN 0x80 /* PeliCAN mode */
|
||||
|
||||
/* output control register */
|
||||
#define OCR_MODE_BIPHASE 0x00
|
||||
#define OCR_MODE_TEST 0x01
|
||||
#define OCR_MODE_NORMAL 0x02
|
||||
#define OCR_MODE_CLOCK 0x03
|
||||
#define OCR_MODE_MASK 0x07
|
||||
#define OCR_TX0_INVERT 0x04
|
||||
#define OCR_TX0_PULLDOWN 0x08
|
||||
#define OCR_TX0_PULLUP 0x10
|
||||
#define OCR_TX0_PUSHPULL 0x18
|
||||
#define OCR_TX1_INVERT 0x20
|
||||
#define OCR_TX1_PULLDOWN 0x40
|
||||
#define OCR_TX1_PULLUP 0x80
|
||||
#define OCR_TX1_PUSHPULL 0xc0
|
||||
#define OCR_TX_MASK 0xfc
|
||||
#define OCR_TX_SHIFT 2
|
||||
|
||||
struct sja1000_platform_data {
|
||||
u32 clock; /* CAN bus oscillator frequency in Hz */
|
||||
|
||||
u8 ocr; /* output control register */
|
||||
u8 cdr; /* clock divider register */
|
||||
};
|
||||
|
||||
#endif /* !_CAN_PLATFORM_SJA1000_H_ */
|
||||
231
include/linux/cb710.h
Normal file
231
include/linux/cb710.h
Normal file
@@ -0,0 +1,231 @@
|
||||
/*
|
||||
* cb710/cb710.h
|
||||
*
|
||||
* Copyright by Michał Mirosław, 2008-2009
|
||||
*
|
||||
* 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_CB710_DRIVER_H
|
||||
#define LINUX_CB710_DRIVER_H
|
||||
|
||||
#include <linux/io.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/mmc/host.h>
|
||||
|
||||
struct cb710_slot;
|
||||
|
||||
typedef int (*cb710_irq_handler_t)(struct cb710_slot *);
|
||||
|
||||
/* per-virtual-slot structure */
|
||||
struct cb710_slot {
|
||||
struct platform_device pdev;
|
||||
void __iomem *iobase;
|
||||
cb710_irq_handler_t irq_handler;
|
||||
};
|
||||
|
||||
/* per-device structure */
|
||||
struct cb710_chip {
|
||||
struct pci_dev *pdev;
|
||||
void __iomem *iobase;
|
||||
unsigned platform_id;
|
||||
#ifdef CONFIG_CB710_DEBUG_ASSUMPTIONS
|
||||
atomic_t slot_refs_count;
|
||||
#endif
|
||||
unsigned slot_mask;
|
||||
unsigned slots;
|
||||
spinlock_t irq_lock;
|
||||
struct cb710_slot slot[0];
|
||||
};
|
||||
|
||||
/* NOTE: cb710_chip.slots is modified only during device init/exit and
|
||||
* they are all serialized wrt themselves */
|
||||
|
||||
/* cb710_chip.slot_mask values */
|
||||
#define CB710_SLOT_MMC 1
|
||||
#define CB710_SLOT_MS 2
|
||||
#define CB710_SLOT_SM 4
|
||||
|
||||
/* slot port accessors - so the logic is more clear in the code */
|
||||
#define CB710_PORT_ACCESSORS(t) \
|
||||
static inline void cb710_write_port_##t(struct cb710_slot *slot, \
|
||||
unsigned port, u##t value) \
|
||||
{ \
|
||||
iowrite##t(value, slot->iobase + port); \
|
||||
} \
|
||||
\
|
||||
static inline u##t cb710_read_port_##t(struct cb710_slot *slot, \
|
||||
unsigned port) \
|
||||
{ \
|
||||
return ioread##t(slot->iobase + port); \
|
||||
} \
|
||||
\
|
||||
static inline void cb710_modify_port_##t(struct cb710_slot *slot, \
|
||||
unsigned port, u##t set, u##t clear) \
|
||||
{ \
|
||||
iowrite##t( \
|
||||
(ioread##t(slot->iobase + port) & ~clear)|set, \
|
||||
slot->iobase + port); \
|
||||
}
|
||||
|
||||
CB710_PORT_ACCESSORS(8)
|
||||
CB710_PORT_ACCESSORS(16)
|
||||
CB710_PORT_ACCESSORS(32)
|
||||
|
||||
void cb710_pci_update_config_reg(struct pci_dev *pdev,
|
||||
int reg, uint32_t and, uint32_t xor);
|
||||
void cb710_set_irq_handler(struct cb710_slot *slot,
|
||||
cb710_irq_handler_t handler);
|
||||
|
||||
/* some device struct walking */
|
||||
|
||||
static inline struct cb710_slot *cb710_pdev_to_slot(
|
||||
struct platform_device *pdev)
|
||||
{
|
||||
return container_of(pdev, struct cb710_slot, pdev);
|
||||
}
|
||||
|
||||
static inline struct cb710_chip *cb710_slot_to_chip(struct cb710_slot *slot)
|
||||
{
|
||||
return dev_get_drvdata(slot->pdev.dev.parent);
|
||||
}
|
||||
|
||||
static inline struct device *cb710_slot_dev(struct cb710_slot *slot)
|
||||
{
|
||||
return &slot->pdev.dev;
|
||||
}
|
||||
|
||||
static inline struct device *cb710_chip_dev(struct cb710_chip *chip)
|
||||
{
|
||||
return &chip->pdev->dev;
|
||||
}
|
||||
|
||||
/* debugging aids */
|
||||
|
||||
#ifdef CONFIG_CB710_DEBUG
|
||||
void cb710_dump_regs(struct cb710_chip *chip, unsigned dump);
|
||||
#else
|
||||
#define cb710_dump_regs(c, d) do {} while (0)
|
||||
#endif
|
||||
|
||||
#define CB710_DUMP_REGS_MMC 0x0F
|
||||
#define CB710_DUMP_REGS_MS 0x30
|
||||
#define CB710_DUMP_REGS_SM 0xC0
|
||||
#define CB710_DUMP_REGS_ALL 0xFF
|
||||
#define CB710_DUMP_REGS_MASK 0xFF
|
||||
|
||||
#define CB710_DUMP_ACCESS_8 0x100
|
||||
#define CB710_DUMP_ACCESS_16 0x200
|
||||
#define CB710_DUMP_ACCESS_32 0x400
|
||||
#define CB710_DUMP_ACCESS_ALL 0x700
|
||||
#define CB710_DUMP_ACCESS_MASK 0x700
|
||||
|
||||
#endif /* LINUX_CB710_DRIVER_H */
|
||||
/*
|
||||
* cb710/sgbuf2.h
|
||||
*
|
||||
* Copyright by Michał Mirosław, 2008-2009
|
||||
*
|
||||
* 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_CB710_SG_H
|
||||
#define LINUX_CB710_SG_H
|
||||
|
||||
#include <linux/highmem.h>
|
||||
#include <linux/scatterlist.h>
|
||||
|
||||
/**
|
||||
* cb710_sg_miter_stop_writing - stop mapping iteration after writing
|
||||
* @miter: sg mapping iter to be stopped
|
||||
*
|
||||
* Description:
|
||||
* Stops mapping iterator @miter. @miter should have been started
|
||||
* started using sg_miter_start(). A stopped iteration can be
|
||||
* resumed by calling sg_miter_next() on it. This is useful when
|
||||
* resources (kmap) need to be released during iteration.
|
||||
*
|
||||
* This is a convenience wrapper that will be optimized out for arches
|
||||
* that don't need flush_kernel_dcache_page().
|
||||
*
|
||||
* Context:
|
||||
* IRQ disabled if the SG_MITER_ATOMIC is set. Don't care otherwise.
|
||||
*/
|
||||
static inline void cb710_sg_miter_stop_writing(struct sg_mapping_iter *miter)
|
||||
{
|
||||
if (miter->page)
|
||||
flush_kernel_dcache_page(miter->page);
|
||||
sg_miter_stop(miter);
|
||||
}
|
||||
|
||||
/*
|
||||
* 32-bit PIO mapping sg iterator
|
||||
*
|
||||
* Hides scatterlist access issues - fragment boundaries, alignment, page
|
||||
* mapping - for drivers using 32-bit-word-at-a-time-PIO (ie. PCI devices
|
||||
* without DMA support).
|
||||
*
|
||||
* Best-case reading (transfer from device):
|
||||
* sg_miter_start();
|
||||
* cb710_sg_dwiter_write_from_io();
|
||||
* cb710_sg_miter_stop_writing();
|
||||
*
|
||||
* Best-case writing (transfer to device):
|
||||
* sg_miter_start();
|
||||
* cb710_sg_dwiter_read_to_io();
|
||||
* sg_miter_stop();
|
||||
*/
|
||||
|
||||
uint32_t cb710_sg_dwiter_read_next_block(struct sg_mapping_iter *miter);
|
||||
void cb710_sg_dwiter_write_next_block(struct sg_mapping_iter *miter, uint32_t data);
|
||||
|
||||
/**
|
||||
* cb710_sg_dwiter_write_from_io - transfer data to mapped buffer from 32-bit IO port
|
||||
* @miter: sg mapping iter
|
||||
* @port: PIO port - IO or MMIO address
|
||||
* @count: number of 32-bit words to transfer
|
||||
*
|
||||
* Description:
|
||||
* Reads @count 32-bit words from register @port and stores it in
|
||||
* buffer iterated by @miter. Data that would overflow the buffer
|
||||
* is silently ignored. Iterator is advanced by 4*@count bytes
|
||||
* or to the buffer's end whichever is closer.
|
||||
*
|
||||
* Context:
|
||||
* IRQ disabled if the SG_MITER_ATOMIC is set. Don't care otherwise.
|
||||
*/
|
||||
static inline void cb710_sg_dwiter_write_from_io(struct sg_mapping_iter *miter,
|
||||
void __iomem *port, size_t count)
|
||||
{
|
||||
while (count-- > 0)
|
||||
cb710_sg_dwiter_write_next_block(miter, ioread32(port));
|
||||
}
|
||||
|
||||
/**
|
||||
* cb710_sg_dwiter_read_to_io - transfer data to 32-bit IO port from mapped buffer
|
||||
* @miter: sg mapping iter
|
||||
* @port: PIO port - IO or MMIO address
|
||||
* @count: number of 32-bit words to transfer
|
||||
*
|
||||
* Description:
|
||||
* Writes @count 32-bit words to register @port from buffer iterated
|
||||
* through @miter. If buffer ends before @count words are written
|
||||
* missing data is replaced by zeroes. @miter is advanced by 4*@count
|
||||
* bytes or to the buffer's end whichever is closer.
|
||||
*
|
||||
* Context:
|
||||
* IRQ disabled if the SG_MITER_ATOMIC is set. Don't care otherwise.
|
||||
*/
|
||||
static inline void cb710_sg_dwiter_read_to_io(struct sg_mapping_iter *miter,
|
||||
void __iomem *port, size_t count)
|
||||
{
|
||||
while (count-- > 0)
|
||||
iowrite32(cb710_sg_dwiter_read_next_block(miter), port);
|
||||
}
|
||||
|
||||
#endif /* LINUX_CB710_SG_H */
|
||||
@@ -142,4 +142,17 @@ struct clk *clk_get_parent(struct clk *clk);
|
||||
*/
|
||||
struct clk *clk_get_sys(const char *dev_id, const char *con_id);
|
||||
|
||||
/**
|
||||
* clk_add_alias - add a new clock alias
|
||||
* @alias: name for clock alias
|
||||
* @alias_dev_name: device name
|
||||
* @id: platform specific clock name
|
||||
* @dev: device
|
||||
*
|
||||
* Allows using generic clock names for drivers by adding a new alias.
|
||||
* Assumes clkdev, see clkdev.h for more info.
|
||||
*/
|
||||
int clk_add_alias(const char *alias, const char *alias_dev_name, char *id,
|
||||
struct device *dev);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -143,3 +143,12 @@ extern void clockevents_notify(unsigned long reason, void *arg);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_GENERIC_CLOCKEVENTS
|
||||
extern ktime_t clockevents_get_next_event(int cpu);
|
||||
#else
|
||||
static inline ktime_t clockevents_get_next_event(int cpu)
|
||||
{
|
||||
return (ktime_t) { .tv64 = KTIME_MAX };
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
|
||||
extern int number_of_cpusets; /* How many cpusets are defined in system? */
|
||||
|
||||
extern int cpuset_init_early(void);
|
||||
extern int cpuset_init(void);
|
||||
extern void cpuset_init_smp(void);
|
||||
extern void cpuset_cpus_allowed(struct task_struct *p, struct cpumask *mask);
|
||||
@@ -27,7 +26,6 @@ extern void cpuset_cpus_allowed_locked(struct task_struct *p,
|
||||
extern nodemask_t cpuset_mems_allowed(struct task_struct *p);
|
||||
#define cpuset_current_mems_allowed (current->mems_allowed)
|
||||
void cpuset_init_current_mems_allowed(void);
|
||||
void cpuset_update_task_memory_state(void);
|
||||
int cpuset_nodemask_valid_mems_allowed(nodemask_t *nodemask);
|
||||
|
||||
extern int __cpuset_node_allowed_softwall(int node, gfp_t gfp_mask);
|
||||
@@ -92,9 +90,13 @@ extern void rebuild_sched_domains(void);
|
||||
|
||||
extern void cpuset_print_task_mems_allowed(struct task_struct *p);
|
||||
|
||||
static inline void set_mems_allowed(nodemask_t nodemask)
|
||||
{
|
||||
current->mems_allowed = nodemask;
|
||||
}
|
||||
|
||||
#else /* !CONFIG_CPUSETS */
|
||||
|
||||
static inline int cpuset_init_early(void) { return 0; }
|
||||
static inline int cpuset_init(void) { return 0; }
|
||||
static inline void cpuset_init_smp(void) {}
|
||||
|
||||
@@ -116,7 +118,6 @@ static inline nodemask_t cpuset_mems_allowed(struct task_struct *p)
|
||||
|
||||
#define cpuset_current_mems_allowed (node_states[N_HIGH_MEMORY])
|
||||
static inline void cpuset_init_current_mems_allowed(void) {}
|
||||
static inline void cpuset_update_task_memory_state(void) {}
|
||||
|
||||
static inline int cpuset_nodemask_valid_mems_allowed(nodemask_t *nodemask)
|
||||
{
|
||||
@@ -188,6 +189,10 @@ static inline void cpuset_print_task_mems_allowed(struct task_struct *p)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void set_mems_allowed(nodemask_t nodemask)
|
||||
{
|
||||
}
|
||||
|
||||
#endif /* !CONFIG_CPUSETS */
|
||||
|
||||
#endif /* _LINUX_CPUSET_H */
|
||||
|
||||
@@ -114,6 +114,8 @@ extern int bus_unregister_notifier(struct bus_type *bus,
|
||||
#define BUS_NOTIFY_BOUND_DRIVER 0x00000003 /* driver bound to device */
|
||||
#define BUS_NOTIFY_UNBIND_DRIVER 0x00000004 /* driver about to be
|
||||
unbound */
|
||||
#define BUS_NOTIFY_UNBOUND_DRIVER 0x00000005 /* driver is unbound
|
||||
from the device */
|
||||
|
||||
extern struct kset *bus_get_kset(struct bus_type *bus);
|
||||
extern struct klist *bus_get_device_klist(struct bus_type *bus);
|
||||
@@ -192,6 +194,7 @@ struct class {
|
||||
struct kobject *dev_kobj;
|
||||
|
||||
int (*dev_uevent)(struct device *dev, struct kobj_uevent_env *env);
|
||||
char *(*nodename)(struct device *dev);
|
||||
|
||||
void (*class_release)(struct class *class);
|
||||
void (*dev_release)(struct device *dev);
|
||||
@@ -287,6 +290,7 @@ struct device_type {
|
||||
const char *name;
|
||||
struct attribute_group **groups;
|
||||
int (*uevent)(struct device *dev, struct kobj_uevent_env *env);
|
||||
char *(*nodename)(struct device *dev);
|
||||
void (*release)(struct device *dev);
|
||||
|
||||
struct dev_pm_ops *pm;
|
||||
@@ -486,6 +490,7 @@ extern struct device *device_find_child(struct device *dev, void *data,
|
||||
extern int device_rename(struct device *dev, char *new_name);
|
||||
extern int device_move(struct device *dev, struct device *new_parent,
|
||||
enum dpm_order dpm_order);
|
||||
extern const char *device_get_nodename(struct device *dev, const char **tmp);
|
||||
|
||||
/*
|
||||
* Root device objects for grouping under /sys/devices
|
||||
|
||||
@@ -78,12 +78,12 @@ static inline void eisa_driver_unregister (struct eisa_driver *edrv) { }
|
||||
/* Mimics pci.h... */
|
||||
static inline void *eisa_get_drvdata (struct eisa_device *edev)
|
||||
{
|
||||
return edev->dev.driver_data;
|
||||
return dev_get_drvdata(&edev->dev);
|
||||
}
|
||||
|
||||
static inline void eisa_set_drvdata (struct eisa_device *edev, void *data)
|
||||
{
|
||||
edev->dev.driver_data = data;
|
||||
dev_set_drvdata(&edev->dev, data);
|
||||
}
|
||||
|
||||
/* The EISA root device. There's rumours about machines with multiple
|
||||
|
||||
@@ -182,6 +182,33 @@ static inline unsigned compare_ether_addr_64bits(const u8 addr1[6+2],
|
||||
return compare_ether_addr(addr1, addr2);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* is_etherdev_addr - Tell if given Ethernet address belongs to the device.
|
||||
* @dev: Pointer to a device structure
|
||||
* @addr: Pointer to a six-byte array containing the Ethernet address
|
||||
*
|
||||
* Compare passed address with all addresses of the device. Return true if the
|
||||
* address if one of the device addresses.
|
||||
*
|
||||
* Note that this function calls compare_ether_addr_64bits() so take care of
|
||||
* the right padding.
|
||||
*/
|
||||
static inline bool is_etherdev_addr(const struct net_device *dev,
|
||||
const u8 addr[6 + 2])
|
||||
{
|
||||
struct netdev_hw_addr *ha;
|
||||
int res = 1;
|
||||
|
||||
rcu_read_lock();
|
||||
for_each_dev_addr(dev, ha) {
|
||||
res = compare_ether_addr_64bits(addr, ha->addr);
|
||||
if (!res)
|
||||
break;
|
||||
}
|
||||
rcu_read_unlock();
|
||||
return !res;
|
||||
}
|
||||
#endif /* __KERNEL__ */
|
||||
|
||||
/**
|
||||
|
||||
@@ -26,11 +26,14 @@ struct ethtool_cmd {
|
||||
__u8 phy_address;
|
||||
__u8 transceiver; /* Which transceiver to use */
|
||||
__u8 autoneg; /* Enable or disable autonegotiation */
|
||||
__u8 mdio_support;
|
||||
__u32 maxtxpkt; /* Tx pkts before generating tx int */
|
||||
__u32 maxrxpkt; /* Rx pkts before generating rx int */
|
||||
__u16 speed_hi;
|
||||
__u16 reserved2;
|
||||
__u32 reserved[3];
|
||||
__u8 eth_tp_mdix;
|
||||
__u8 reserved2;
|
||||
__u32 lp_advertising; /* Features the link partner advertises */
|
||||
__u32 reserved[2];
|
||||
};
|
||||
|
||||
static inline void ethtool_cmd_speed_set(struct ethtool_cmd *ep,
|
||||
@@ -563,6 +566,11 @@ struct ethtool_ops {
|
||||
#define SUPPORTED_Pause (1 << 13)
|
||||
#define SUPPORTED_Asym_Pause (1 << 14)
|
||||
#define SUPPORTED_2500baseX_Full (1 << 15)
|
||||
#define SUPPORTED_Backplane (1 << 16)
|
||||
#define SUPPORTED_1000baseKX_Full (1 << 17)
|
||||
#define SUPPORTED_10000baseKX4_Full (1 << 18)
|
||||
#define SUPPORTED_10000baseKR_Full (1 << 19)
|
||||
#define SUPPORTED_10000baseR_FEC (1 << 20)
|
||||
|
||||
/* Indicates what features are advertised by the interface. */
|
||||
#define ADVERTISED_10baseT_Half (1 << 0)
|
||||
@@ -581,6 +589,11 @@ struct ethtool_ops {
|
||||
#define ADVERTISED_Pause (1 << 13)
|
||||
#define ADVERTISED_Asym_Pause (1 << 14)
|
||||
#define ADVERTISED_2500baseX_Full (1 << 15)
|
||||
#define ADVERTISED_Backplane (1 << 16)
|
||||
#define ADVERTISED_1000baseKX_Full (1 << 17)
|
||||
#define ADVERTISED_10000baseKX4_Full (1 << 18)
|
||||
#define ADVERTISED_10000baseKR_Full (1 << 19)
|
||||
#define ADVERTISED_10000baseR_FEC (1 << 20)
|
||||
|
||||
/* The following are all involved in forcing a particular link
|
||||
* mode for the device for setting things. When getting the
|
||||
@@ -605,6 +618,7 @@ struct ethtool_ops {
|
||||
#define PORT_MII 0x02
|
||||
#define PORT_FIBRE 0x03
|
||||
#define PORT_BNC 0x04
|
||||
#define PORT_OTHER 0xff
|
||||
|
||||
/* Which transceiver to use. */
|
||||
#define XCVR_INTERNAL 0x00
|
||||
@@ -619,6 +633,11 @@ struct ethtool_ops {
|
||||
#define AUTONEG_DISABLE 0x00
|
||||
#define AUTONEG_ENABLE 0x01
|
||||
|
||||
/* Mode MDI or MDI-X */
|
||||
#define ETH_TP_MDI_INVALID 0x00
|
||||
#define ETH_TP_MDI 0x01
|
||||
#define ETH_TP_MDI_X 0x02
|
||||
|
||||
/* Wake-On-Lan options. */
|
||||
#define WAKE_PHY (1 << 0)
|
||||
#define WAKE_UCAST (1 << 1)
|
||||
|
||||
@@ -677,6 +677,9 @@ struct fb_ops {
|
||||
/* get capability given var */
|
||||
void (*fb_get_caps)(struct fb_info *info, struct fb_blit_caps *caps,
|
||||
struct fb_var_screeninfo *var);
|
||||
|
||||
/* teardown any resources to do with this framebuffer */
|
||||
void (*fb_destroy)(struct fb_info *info);
|
||||
};
|
||||
|
||||
#ifdef CONFIG_FB_TILEBLITTING
|
||||
@@ -786,6 +789,8 @@ struct fb_tile_ops {
|
||||
#define FBINFO_MISC_USEREVENT 0x10000 /* event request
|
||||
from userspace */
|
||||
#define FBINFO_MISC_TILEBLITTING 0x20000 /* use tile blitting */
|
||||
#define FBINFO_MISC_FIRMWARE 0x40000 /* a replaceable firmware
|
||||
inited framebuffer */
|
||||
|
||||
/* A driver may set this flag to indicate that it does want a set_par to be
|
||||
* called every time when fbcon_switch is executed. The advantage is that with
|
||||
@@ -854,7 +859,12 @@ struct fb_info {
|
||||
u32 state; /* Hardware state i.e suspend */
|
||||
void *fbcon_par; /* fbcon use-only private area */
|
||||
/* From here on everything is device dependent */
|
||||
void *par;
|
||||
void *par;
|
||||
/* we need the PCI or similiar aperture base/size not
|
||||
smem_start/size as smem_start may just be an object
|
||||
allocated inside the aperture so may not actually overlap */
|
||||
resource_size_t aperture_base;
|
||||
resource_size_t aperture_size;
|
||||
};
|
||||
|
||||
#ifdef MODULE
|
||||
@@ -893,7 +903,7 @@ struct fb_info {
|
||||
#define fb_writeq sbus_writeq
|
||||
#define fb_memset sbus_memset_io
|
||||
|
||||
#elif defined(__i386__) || defined(__alpha__) || defined(__x86_64__) || defined(__hppa__) || defined(__sh__) || defined(__powerpc__) || defined(__avr32__)
|
||||
#elif defined(__i386__) || defined(__alpha__) || defined(__x86_64__) || defined(__hppa__) || defined(__sh__) || defined(__powerpc__) || defined(__avr32__) || defined(__bfin__)
|
||||
|
||||
#define fb_readb __raw_readb
|
||||
#define fb_readw __raw_readw
|
||||
|
||||
358
include/linux/firewire.h
Normal file
358
include/linux/firewire.h
Normal file
@@ -0,0 +1,358 @@
|
||||
#ifndef _LINUX_FIREWIRE_H
|
||||
#define _LINUX_FIREWIRE_H
|
||||
|
||||
#include <linux/completion.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/kref.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/sysfs.h>
|
||||
#include <linux/timer.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/workqueue.h>
|
||||
|
||||
#include <asm/atomic.h>
|
||||
#include <asm/byteorder.h>
|
||||
|
||||
#define fw_notify(s, args...) printk(KERN_NOTICE KBUILD_MODNAME ": " s, ## args)
|
||||
#define fw_error(s, args...) printk(KERN_ERR KBUILD_MODNAME ": " s, ## args)
|
||||
|
||||
static inline void fw_memcpy_from_be32(void *_dst, void *_src, size_t size)
|
||||
{
|
||||
u32 *dst = _dst;
|
||||
__be32 *src = _src;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < size / 4; i++)
|
||||
dst[i] = be32_to_cpu(src[i]);
|
||||
}
|
||||
|
||||
static inline void fw_memcpy_to_be32(void *_dst, void *_src, size_t size)
|
||||
{
|
||||
fw_memcpy_from_be32(_dst, _src, size);
|
||||
}
|
||||
#define CSR_REGISTER_BASE 0xfffff0000000ULL
|
||||
|
||||
/* register offsets are relative to CSR_REGISTER_BASE */
|
||||
#define CSR_STATE_CLEAR 0x0
|
||||
#define CSR_STATE_SET 0x4
|
||||
#define CSR_NODE_IDS 0x8
|
||||
#define CSR_RESET_START 0xc
|
||||
#define CSR_SPLIT_TIMEOUT_HI 0x18
|
||||
#define CSR_SPLIT_TIMEOUT_LO 0x1c
|
||||
#define CSR_CYCLE_TIME 0x200
|
||||
#define CSR_BUS_TIME 0x204
|
||||
#define CSR_BUSY_TIMEOUT 0x210
|
||||
#define CSR_BUS_MANAGER_ID 0x21c
|
||||
#define CSR_BANDWIDTH_AVAILABLE 0x220
|
||||
#define CSR_CHANNELS_AVAILABLE 0x224
|
||||
#define CSR_CHANNELS_AVAILABLE_HI 0x224
|
||||
#define CSR_CHANNELS_AVAILABLE_LO 0x228
|
||||
#define CSR_BROADCAST_CHANNEL 0x234
|
||||
#define CSR_CONFIG_ROM 0x400
|
||||
#define CSR_CONFIG_ROM_END 0x800
|
||||
#define CSR_FCP_COMMAND 0xB00
|
||||
#define CSR_FCP_RESPONSE 0xD00
|
||||
#define CSR_FCP_END 0xF00
|
||||
#define CSR_TOPOLOGY_MAP 0x1000
|
||||
#define CSR_TOPOLOGY_MAP_END 0x1400
|
||||
#define CSR_SPEED_MAP 0x2000
|
||||
#define CSR_SPEED_MAP_END 0x3000
|
||||
|
||||
#define CSR_OFFSET 0x40
|
||||
#define CSR_LEAF 0x80
|
||||
#define CSR_DIRECTORY 0xc0
|
||||
|
||||
#define CSR_DESCRIPTOR 0x01
|
||||
#define CSR_VENDOR 0x03
|
||||
#define CSR_HARDWARE_VERSION 0x04
|
||||
#define CSR_NODE_CAPABILITIES 0x0c
|
||||
#define CSR_UNIT 0x11
|
||||
#define CSR_SPECIFIER_ID 0x12
|
||||
#define CSR_VERSION 0x13
|
||||
#define CSR_DEPENDENT_INFO 0x14
|
||||
#define CSR_MODEL 0x17
|
||||
#define CSR_INSTANCE 0x18
|
||||
#define CSR_DIRECTORY_ID 0x20
|
||||
|
||||
struct fw_csr_iterator {
|
||||
u32 *p;
|
||||
u32 *end;
|
||||
};
|
||||
|
||||
void fw_csr_iterator_init(struct fw_csr_iterator *ci, u32 *p);
|
||||
int fw_csr_iterator_next(struct fw_csr_iterator *ci, int *key, int *value);
|
||||
|
||||
extern struct bus_type fw_bus_type;
|
||||
|
||||
struct fw_card_driver;
|
||||
struct fw_node;
|
||||
|
||||
struct fw_card {
|
||||
const struct fw_card_driver *driver;
|
||||
struct device *device;
|
||||
struct kref kref;
|
||||
struct completion done;
|
||||
|
||||
int node_id;
|
||||
int generation;
|
||||
int current_tlabel;
|
||||
u64 tlabel_mask;
|
||||
struct list_head transaction_list;
|
||||
struct timer_list flush_timer;
|
||||
unsigned long reset_jiffies;
|
||||
|
||||
unsigned long long guid;
|
||||
unsigned max_receive;
|
||||
int link_speed;
|
||||
int config_rom_generation;
|
||||
|
||||
spinlock_t lock; /* Take this lock when handling the lists in
|
||||
* this struct. */
|
||||
struct fw_node *local_node;
|
||||
struct fw_node *root_node;
|
||||
struct fw_node *irm_node;
|
||||
u8 color; /* must be u8 to match the definition in struct fw_node */
|
||||
int gap_count;
|
||||
bool beta_repeaters_present;
|
||||
|
||||
int index;
|
||||
|
||||
struct list_head link;
|
||||
|
||||
/* Work struct for BM duties. */
|
||||
struct delayed_work work;
|
||||
int bm_retries;
|
||||
int bm_generation;
|
||||
|
||||
bool broadcast_channel_allocated;
|
||||
u32 broadcast_channel;
|
||||
u32 topology_map[(CSR_TOPOLOGY_MAP_END - CSR_TOPOLOGY_MAP) / 4];
|
||||
};
|
||||
|
||||
static inline struct fw_card *fw_card_get(struct fw_card *card)
|
||||
{
|
||||
kref_get(&card->kref);
|
||||
|
||||
return card;
|
||||
}
|
||||
|
||||
void fw_card_release(struct kref *kref);
|
||||
|
||||
static inline void fw_card_put(struct fw_card *card)
|
||||
{
|
||||
kref_put(&card->kref, fw_card_release);
|
||||
}
|
||||
|
||||
struct fw_attribute_group {
|
||||
struct attribute_group *groups[2];
|
||||
struct attribute_group group;
|
||||
struct attribute *attrs[12];
|
||||
};
|
||||
|
||||
enum fw_device_state {
|
||||
FW_DEVICE_INITIALIZING,
|
||||
FW_DEVICE_RUNNING,
|
||||
FW_DEVICE_GONE,
|
||||
FW_DEVICE_SHUTDOWN,
|
||||
};
|
||||
|
||||
/*
|
||||
* Note, fw_device.generation always has to be read before fw_device.node_id.
|
||||
* Use SMP memory barriers to ensure this. Otherwise requests will be sent
|
||||
* to an outdated node_id if the generation was updated in the meantime due
|
||||
* to a bus reset.
|
||||
*
|
||||
* Likewise, fw-core will take care to update .node_id before .generation so
|
||||
* that whenever fw_device.generation is current WRT the actual bus generation,
|
||||
* fw_device.node_id is guaranteed to be current too.
|
||||
*
|
||||
* The same applies to fw_device.card->node_id vs. fw_device.generation.
|
||||
*
|
||||
* fw_device.config_rom and fw_device.config_rom_length may be accessed during
|
||||
* the lifetime of any fw_unit belonging to the fw_device, before device_del()
|
||||
* was called on the last fw_unit. Alternatively, they may be accessed while
|
||||
* holding fw_device_rwsem.
|
||||
*/
|
||||
struct fw_device {
|
||||
atomic_t state;
|
||||
struct fw_node *node;
|
||||
int node_id;
|
||||
int generation;
|
||||
unsigned max_speed;
|
||||
struct fw_card *card;
|
||||
struct device device;
|
||||
|
||||
struct mutex client_list_mutex;
|
||||
struct list_head client_list;
|
||||
|
||||
u32 *config_rom;
|
||||
size_t config_rom_length;
|
||||
int config_rom_retries;
|
||||
unsigned is_local:1;
|
||||
unsigned max_rec:4;
|
||||
unsigned cmc:1;
|
||||
unsigned irmc:1;
|
||||
unsigned bc_implemented:2;
|
||||
|
||||
struct delayed_work work;
|
||||
struct fw_attribute_group attribute_group;
|
||||
};
|
||||
|
||||
static inline struct fw_device *fw_device(struct device *dev)
|
||||
{
|
||||
return container_of(dev, struct fw_device, device);
|
||||
}
|
||||
|
||||
static inline int fw_device_is_shutdown(struct fw_device *device)
|
||||
{
|
||||
return atomic_read(&device->state) == FW_DEVICE_SHUTDOWN;
|
||||
}
|
||||
|
||||
static inline struct fw_device *fw_device_get(struct fw_device *device)
|
||||
{
|
||||
get_device(&device->device);
|
||||
|
||||
return device;
|
||||
}
|
||||
|
||||
static inline void fw_device_put(struct fw_device *device)
|
||||
{
|
||||
put_device(&device->device);
|
||||
}
|
||||
|
||||
int fw_device_enable_phys_dma(struct fw_device *device);
|
||||
|
||||
/*
|
||||
* fw_unit.directory must not be accessed after device_del(&fw_unit.device).
|
||||
*/
|
||||
struct fw_unit {
|
||||
struct device device;
|
||||
u32 *directory;
|
||||
struct fw_attribute_group attribute_group;
|
||||
};
|
||||
|
||||
static inline struct fw_unit *fw_unit(struct device *dev)
|
||||
{
|
||||
return container_of(dev, struct fw_unit, device);
|
||||
}
|
||||
|
||||
static inline struct fw_unit *fw_unit_get(struct fw_unit *unit)
|
||||
{
|
||||
get_device(&unit->device);
|
||||
|
||||
return unit;
|
||||
}
|
||||
|
||||
static inline void fw_unit_put(struct fw_unit *unit)
|
||||
{
|
||||
put_device(&unit->device);
|
||||
}
|
||||
|
||||
static inline struct fw_device *fw_parent_device(struct fw_unit *unit)
|
||||
{
|
||||
return fw_device(unit->device.parent);
|
||||
}
|
||||
|
||||
struct ieee1394_device_id;
|
||||
|
||||
struct fw_driver {
|
||||
struct device_driver driver;
|
||||
/* Called when the parent device sits through a bus reset. */
|
||||
void (*update)(struct fw_unit *unit);
|
||||
const struct ieee1394_device_id *id_table;
|
||||
};
|
||||
|
||||
struct fw_packet;
|
||||
struct fw_request;
|
||||
|
||||
typedef void (*fw_packet_callback_t)(struct fw_packet *packet,
|
||||
struct fw_card *card, int status);
|
||||
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.
|
||||
*/
|
||||
typedef void (*fw_address_callback_t)(struct fw_card *card,
|
||||
struct fw_request *request,
|
||||
int tcode, int destination, int source,
|
||||
int generation, int speed,
|
||||
unsigned long long offset,
|
||||
void *data, size_t length,
|
||||
void *callback_data);
|
||||
|
||||
struct fw_packet {
|
||||
int speed;
|
||||
int generation;
|
||||
u32 header[4];
|
||||
size_t header_length;
|
||||
void *payload;
|
||||
size_t payload_length;
|
||||
dma_addr_t payload_bus;
|
||||
u32 timestamp;
|
||||
|
||||
/*
|
||||
* This callback is called when the packet transmission has
|
||||
* completed; for successful transmission, the status code is
|
||||
* the ack received from the destination, otherwise it's a
|
||||
* negative errno: ENOMEM, ESTALE, ETIMEDOUT, ENODEV, EIO.
|
||||
* The callback can be called from tasklet context and thus
|
||||
* must never block.
|
||||
*/
|
||||
fw_packet_callback_t callback;
|
||||
int ack;
|
||||
struct list_head link;
|
||||
void *driver_data;
|
||||
};
|
||||
|
||||
struct fw_transaction {
|
||||
int node_id; /* The generation is implied; it is always the current. */
|
||||
int tlabel;
|
||||
int timestamp;
|
||||
struct list_head link;
|
||||
|
||||
struct fw_packet packet;
|
||||
|
||||
/*
|
||||
* The data passed to the callback is valid only during the
|
||||
* callback.
|
||||
*/
|
||||
fw_transaction_callback_t callback;
|
||||
void *callback_data;
|
||||
};
|
||||
|
||||
struct fw_address_handler {
|
||||
u64 offset;
|
||||
size_t length;
|
||||
fw_address_callback_t address_callback;
|
||||
void *callback_data;
|
||||
struct list_head link;
|
||||
};
|
||||
|
||||
struct fw_address_region {
|
||||
u64 start;
|
||||
u64 end;
|
||||
};
|
||||
|
||||
extern const struct fw_address_region fw_high_memory_region;
|
||||
|
||||
int fw_core_add_address_handler(struct fw_address_handler *handler,
|
||||
const struct fw_address_region *region);
|
||||
void fw_core_remove_address_handler(struct fw_address_handler *handler);
|
||||
void fw_send_response(struct fw_card *card,
|
||||
struct fw_request *request, int rcode);
|
||||
void fw_send_request(struct fw_card *card, struct fw_transaction *t,
|
||||
int tcode, int destination_id, int generation, int speed,
|
||||
unsigned long long offset, void *payload, size_t length,
|
||||
fw_transaction_callback_t callback, void *callback_data);
|
||||
int fw_cancel_transaction(struct fw_card *card,
|
||||
struct fw_transaction *transaction);
|
||||
int fw_run_transaction(struct fw_card *card, int tcode, int destination_id,
|
||||
int generation, int speed, unsigned long long offset,
|
||||
void *payload, size_t length);
|
||||
|
||||
#endif /* _LINUX_FIREWIRE_H */
|
||||
@@ -24,21 +24,17 @@
|
||||
*/
|
||||
#ifdef CONFIG_FIRMWARE_MEMMAP
|
||||
|
||||
int firmware_map_add(resource_size_t start, resource_size_t end,
|
||||
const char *type);
|
||||
int firmware_map_add_early(resource_size_t start, resource_size_t end,
|
||||
const char *type);
|
||||
int firmware_map_add(u64 start, u64 end, const char *type);
|
||||
int firmware_map_add_early(u64 start, u64 end, const char *type);
|
||||
|
||||
#else /* CONFIG_FIRMWARE_MEMMAP */
|
||||
|
||||
static inline int firmware_map_add(resource_size_t start, resource_size_t end,
|
||||
const char *type)
|
||||
static inline int firmware_map_add(u64 start, u64 end, const char *type)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int firmware_map_add_early(resource_size_t start,
|
||||
resource_size_t end, const char *type)
|
||||
static inline int firmware_map_add_early(u64 start, u64 end, const char *type)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
#include <linux/types.h>
|
||||
#include <linux/compiler.h>
|
||||
|
||||
#define FIRMWARE_NAME_MAX 30
|
||||
#define FW_ACTION_NOHOTPLUG 0
|
||||
#define FW_ACTION_HOTPLUG 1
|
||||
|
||||
|
||||
@@ -879,7 +879,7 @@ struct file_ra_state {
|
||||
there are only # of pages ahead */
|
||||
|
||||
unsigned int ra_pages; /* Maximum readahead window */
|
||||
int mmap_miss; /* Cache miss stat for mmap accesses */
|
||||
unsigned int mmap_miss; /* Cache miss stat for mmap accesses */
|
||||
loff_t prev_pos; /* Cache last read() position */
|
||||
};
|
||||
|
||||
@@ -1919,8 +1919,9 @@ extern void __init vfs_caches_init(unsigned long);
|
||||
|
||||
extern struct kmem_cache *names_cachep;
|
||||
|
||||
#define __getname() kmem_cache_alloc(names_cachep, GFP_KERNEL)
|
||||
#define __putname(name) kmem_cache_free(names_cachep, (void *)(name))
|
||||
#define __getname_gfp(gfp) kmem_cache_alloc(names_cachep, (gfp))
|
||||
#define __getname() __getname_gfp(GFP_KERNEL)
|
||||
#define __putname(name) kmem_cache_free(names_cachep, (void *)(name))
|
||||
#ifndef CONFIG_AUDITSYSCALL
|
||||
#define putname(name) __putname(name)
|
||||
#else
|
||||
@@ -2036,9 +2037,6 @@ extern int __invalidate_device(struct block_device *);
|
||||
extern int invalidate_partition(struct gendisk *, int);
|
||||
#endif
|
||||
extern int invalidate_inodes(struct super_block *);
|
||||
unsigned long __invalidate_mapping_pages(struct address_space *mapping,
|
||||
pgoff_t start, pgoff_t end,
|
||||
bool be_atomic);
|
||||
unsigned long invalidate_mapping_pages(struct address_space *mapping,
|
||||
pgoff_t start, pgoff_t end);
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#define FS_ENET_PD_H
|
||||
|
||||
#include <linux/string.h>
|
||||
#include <linux/of_mdio.h>
|
||||
#include <asm/types.h>
|
||||
|
||||
#define FS_ENET_NAME "fs_enet"
|
||||
@@ -130,10 +131,7 @@ struct fs_platform_info {
|
||||
|
||||
u32 device_flags;
|
||||
|
||||
int phy_addr; /* the phy address (-1 no phy) */
|
||||
char bus_id[16];
|
||||
int phy_irq; /* the phy irq (if it exists) */
|
||||
|
||||
struct device_node *phy_node;
|
||||
const struct fs_mii_bus_info *bus_info;
|
||||
|
||||
int rx_ring, tx_ring; /* number of buffers on rx */
|
||||
|
||||
@@ -142,7 +142,7 @@ struct gendisk {
|
||||
* disks that can't be partitioned. */
|
||||
|
||||
char disk_name[DISK_NAME_LEN]; /* name of major driver */
|
||||
|
||||
char *(*nodename)(struct gendisk *gd);
|
||||
/* Array of pointers to partitions indexed by partno.
|
||||
* Protected with matching bdev lock but stat and other
|
||||
* non-critical accesses use RCU. Always access through
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <linux/stddef.h>
|
||||
#include <linux/linkage.h>
|
||||
#include <linux/topology.h>
|
||||
#include <linux/mmdebug.h>
|
||||
|
||||
struct vm_area_struct;
|
||||
|
||||
@@ -20,7 +21,8 @@ struct vm_area_struct;
|
||||
#define __GFP_DMA ((__force gfp_t)0x01u)
|
||||
#define __GFP_HIGHMEM ((__force gfp_t)0x02u)
|
||||
#define __GFP_DMA32 ((__force gfp_t)0x04u)
|
||||
|
||||
#define __GFP_MOVABLE ((__force gfp_t)0x08u) /* Page is movable */
|
||||
#define GFP_ZONEMASK (__GFP_DMA|__GFP_HIGHMEM|__GFP_DMA32|__GFP_MOVABLE)
|
||||
/*
|
||||
* Action modifiers - doesn't change the zoning
|
||||
*
|
||||
@@ -50,9 +52,20 @@ struct vm_area_struct;
|
||||
#define __GFP_HARDWALL ((__force gfp_t)0x20000u) /* Enforce hardwall cpuset memory allocs */
|
||||
#define __GFP_THISNODE ((__force gfp_t)0x40000u)/* No fallback, no policies */
|
||||
#define __GFP_RECLAIMABLE ((__force gfp_t)0x80000u) /* Page is reclaimable */
|
||||
#define __GFP_MOVABLE ((__force gfp_t)0x100000u) /* Page is movable */
|
||||
|
||||
#define __GFP_BITS_SHIFT 21 /* Room for 21 __GFP_FOO bits */
|
||||
#ifdef CONFIG_KMEMCHECK
|
||||
#define __GFP_NOTRACK ((__force gfp_t)0x200000u) /* Don't track with kmemcheck */
|
||||
#else
|
||||
#define __GFP_NOTRACK ((__force gfp_t)0)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* This may seem redundant, but it's a way of annotating false positives vs.
|
||||
* allocations that simply cannot be supported (e.g. page tables).
|
||||
*/
|
||||
#define __GFP_NOTRACK_FALSE_POSITIVE (__GFP_NOTRACK)
|
||||
|
||||
#define __GFP_BITS_SHIFT 22 /* Room for 22 __GFP_FOO bits */
|
||||
#define __GFP_BITS_MASK ((__force gfp_t)((1 << __GFP_BITS_SHIFT) - 1))
|
||||
|
||||
/* This equals 0, but use constants in case they ever change */
|
||||
@@ -115,24 +128,105 @@ static inline int allocflags_to_migratetype(gfp_t gfp_flags)
|
||||
((gfp_flags & __GFP_RECLAIMABLE) != 0);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_HIGHMEM
|
||||
#define OPT_ZONE_HIGHMEM ZONE_HIGHMEM
|
||||
#else
|
||||
#define OPT_ZONE_HIGHMEM ZONE_NORMAL
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ZONE_DMA
|
||||
#define OPT_ZONE_DMA ZONE_DMA
|
||||
#else
|
||||
#define OPT_ZONE_DMA ZONE_NORMAL
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ZONE_DMA32
|
||||
#define OPT_ZONE_DMA32 ZONE_DMA32
|
||||
#else
|
||||
#define OPT_ZONE_DMA32 ZONE_NORMAL
|
||||
#endif
|
||||
|
||||
/*
|
||||
* GFP_ZONE_TABLE is a word size bitstring that is used for looking up the
|
||||
* zone to use given the lowest 4 bits of gfp_t. Entries are ZONE_SHIFT long
|
||||
* and there are 16 of them to cover all possible combinations of
|
||||
* __GFP_DMA, __GFP_DMA32, __GFP_MOVABLE and __GFP_HIGHMEM
|
||||
*
|
||||
* The zone fallback order is MOVABLE=>HIGHMEM=>NORMAL=>DMA32=>DMA.
|
||||
* But GFP_MOVABLE is not only a zone specifier but also an allocation
|
||||
* policy. Therefore __GFP_MOVABLE plus another zone selector is valid.
|
||||
* Only 1bit of the lowest 3 bit (DMA,DMA32,HIGHMEM) can be set to "1".
|
||||
*
|
||||
* bit result
|
||||
* =================
|
||||
* 0x0 => NORMAL
|
||||
* 0x1 => DMA or NORMAL
|
||||
* 0x2 => HIGHMEM or NORMAL
|
||||
* 0x3 => BAD (DMA+HIGHMEM)
|
||||
* 0x4 => DMA32 or DMA or NORMAL
|
||||
* 0x5 => BAD (DMA+DMA32)
|
||||
* 0x6 => BAD (HIGHMEM+DMA32)
|
||||
* 0x7 => BAD (HIGHMEM+DMA32+DMA)
|
||||
* 0x8 => NORMAL (MOVABLE+0)
|
||||
* 0x9 => DMA or NORMAL (MOVABLE+DMA)
|
||||
* 0xa => MOVABLE (Movable is valid only if HIGHMEM is set too)
|
||||
* 0xb => BAD (MOVABLE+HIGHMEM+DMA)
|
||||
* 0xc => DMA32 (MOVABLE+HIGHMEM+DMA32)
|
||||
* 0xd => BAD (MOVABLE+DMA32+DMA)
|
||||
* 0xe => BAD (MOVABLE+DMA32+HIGHMEM)
|
||||
* 0xf => BAD (MOVABLE+DMA32+HIGHMEM+DMA)
|
||||
*
|
||||
* ZONES_SHIFT must be <= 2 on 32 bit platforms.
|
||||
*/
|
||||
|
||||
#if 16 * ZONES_SHIFT > BITS_PER_LONG
|
||||
#error ZONES_SHIFT too large to create GFP_ZONE_TABLE integer
|
||||
#endif
|
||||
|
||||
#define GFP_ZONE_TABLE ( \
|
||||
(ZONE_NORMAL << 0 * ZONES_SHIFT) \
|
||||
| (OPT_ZONE_DMA << __GFP_DMA * ZONES_SHIFT) \
|
||||
| (OPT_ZONE_HIGHMEM << __GFP_HIGHMEM * ZONES_SHIFT) \
|
||||
| (OPT_ZONE_DMA32 << __GFP_DMA32 * ZONES_SHIFT) \
|
||||
| (ZONE_NORMAL << __GFP_MOVABLE * ZONES_SHIFT) \
|
||||
| (OPT_ZONE_DMA << (__GFP_MOVABLE | __GFP_DMA) * ZONES_SHIFT) \
|
||||
| (ZONE_MOVABLE << (__GFP_MOVABLE | __GFP_HIGHMEM) * ZONES_SHIFT)\
|
||||
| (OPT_ZONE_DMA32 << (__GFP_MOVABLE | __GFP_DMA32) * ZONES_SHIFT)\
|
||||
)
|
||||
|
||||
/*
|
||||
* GFP_ZONE_BAD is a bitmap for all combination of __GFP_DMA, __GFP_DMA32
|
||||
* __GFP_HIGHMEM and __GFP_MOVABLE that are not permitted. One flag per
|
||||
* entry starting with bit 0. Bit is set if the combination is not
|
||||
* allowed.
|
||||
*/
|
||||
#define GFP_ZONE_BAD ( \
|
||||
1 << (__GFP_DMA | __GFP_HIGHMEM) \
|
||||
| 1 << (__GFP_DMA | __GFP_DMA32) \
|
||||
| 1 << (__GFP_DMA32 | __GFP_HIGHMEM) \
|
||||
| 1 << (__GFP_DMA | __GFP_DMA32 | __GFP_HIGHMEM) \
|
||||
| 1 << (__GFP_MOVABLE | __GFP_HIGHMEM | __GFP_DMA) \
|
||||
| 1 << (__GFP_MOVABLE | __GFP_DMA32 | __GFP_DMA) \
|
||||
| 1 << (__GFP_MOVABLE | __GFP_DMA32 | __GFP_HIGHMEM) \
|
||||
| 1 << (__GFP_MOVABLE | __GFP_DMA32 | __GFP_DMA | __GFP_HIGHMEM)\
|
||||
)
|
||||
|
||||
static inline enum zone_type gfp_zone(gfp_t flags)
|
||||
{
|
||||
#ifdef CONFIG_ZONE_DMA
|
||||
if (flags & __GFP_DMA)
|
||||
return ZONE_DMA;
|
||||
enum zone_type z;
|
||||
int bit = flags & GFP_ZONEMASK;
|
||||
|
||||
z = (GFP_ZONE_TABLE >> (bit * ZONES_SHIFT)) &
|
||||
((1 << ZONES_SHIFT) - 1);
|
||||
|
||||
if (__builtin_constant_p(bit))
|
||||
BUILD_BUG_ON((GFP_ZONE_BAD >> bit) & 1);
|
||||
else {
|
||||
#ifdef CONFIG_DEBUG_VM
|
||||
BUG_ON((GFP_ZONE_BAD >> bit) & 1);
|
||||
#endif
|
||||
#ifdef CONFIG_ZONE_DMA32
|
||||
if (flags & __GFP_DMA32)
|
||||
return ZONE_DMA32;
|
||||
#endif
|
||||
if ((flags & (__GFP_HIGHMEM | __GFP_MOVABLE)) ==
|
||||
(__GFP_HIGHMEM | __GFP_MOVABLE))
|
||||
return ZONE_MOVABLE;
|
||||
#ifdef CONFIG_HIGHMEM
|
||||
if (flags & __GFP_HIGHMEM)
|
||||
return ZONE_HIGHMEM;
|
||||
#endif
|
||||
return ZONE_NORMAL;
|
||||
}
|
||||
return z;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -172,30 +266,19 @@ static inline void arch_alloc_page(struct page *page, int order) { }
|
||||
#endif
|
||||
|
||||
struct page *
|
||||
__alloc_pages_internal(gfp_t gfp_mask, unsigned int order,
|
||||
__alloc_pages_nodemask(gfp_t gfp_mask, unsigned int order,
|
||||
struct zonelist *zonelist, nodemask_t *nodemask);
|
||||
|
||||
static inline struct page *
|
||||
__alloc_pages(gfp_t gfp_mask, unsigned int order,
|
||||
struct zonelist *zonelist)
|
||||
{
|
||||
return __alloc_pages_internal(gfp_mask, order, zonelist, NULL);
|
||||
return __alloc_pages_nodemask(gfp_mask, order, zonelist, NULL);
|
||||
}
|
||||
|
||||
static inline struct page *
|
||||
__alloc_pages_nodemask(gfp_t gfp_mask, unsigned int order,
|
||||
struct zonelist *zonelist, nodemask_t *nodemask)
|
||||
{
|
||||
return __alloc_pages_internal(gfp_mask, order, zonelist, nodemask);
|
||||
}
|
||||
|
||||
|
||||
static inline struct page *alloc_pages_node(int nid, gfp_t gfp_mask,
|
||||
unsigned int order)
|
||||
{
|
||||
if (unlikely(order >= MAX_ORDER))
|
||||
return NULL;
|
||||
|
||||
/* Unknown node is current node */
|
||||
if (nid < 0)
|
||||
nid = numa_node_id();
|
||||
@@ -203,15 +286,20 @@ static inline struct page *alloc_pages_node(int nid, gfp_t gfp_mask,
|
||||
return __alloc_pages(gfp_mask, order, node_zonelist(nid, gfp_mask));
|
||||
}
|
||||
|
||||
static inline struct page *alloc_pages_exact_node(int nid, gfp_t gfp_mask,
|
||||
unsigned int order)
|
||||
{
|
||||
VM_BUG_ON(nid < 0 || nid >= MAX_NUMNODES);
|
||||
|
||||
return __alloc_pages(gfp_mask, order, node_zonelist(nid, gfp_mask));
|
||||
}
|
||||
|
||||
#ifdef CONFIG_NUMA
|
||||
extern struct page *alloc_pages_current(gfp_t gfp_mask, unsigned order);
|
||||
|
||||
static inline struct page *
|
||||
alloc_pages(gfp_t gfp_mask, unsigned int order)
|
||||
{
|
||||
if (unlikely(order >= MAX_ORDER))
|
||||
return NULL;
|
||||
|
||||
return alloc_pages_current(gfp_mask, order);
|
||||
}
|
||||
extern struct page *alloc_page_vma(gfp_t gfp_mask,
|
||||
@@ -248,4 +336,16 @@ void drain_zone_pages(struct zone *zone, struct per_cpu_pages *pcp);
|
||||
void drain_all_pages(void);
|
||||
void drain_local_pages(void *dummy);
|
||||
|
||||
extern bool oom_killer_disabled;
|
||||
|
||||
static inline void oom_killer_disable(void)
|
||||
{
|
||||
oom_killer_disabled = true;
|
||||
}
|
||||
|
||||
static inline void oom_killer_enable(void)
|
||||
{
|
||||
oom_killer_disabled = false;
|
||||
}
|
||||
|
||||
#endif /* __LINUX_GFP_H */
|
||||
|
||||
@@ -238,6 +238,42 @@ struct hid_item {
|
||||
#define HID_GD_RIGHT 0x00010092
|
||||
#define HID_GD_LEFT 0x00010093
|
||||
|
||||
#define HID_DG_DIGITIZER 0x000d0001
|
||||
#define HID_DG_PEN 0x000d0002
|
||||
#define HID_DG_LIGHTPEN 0x000d0003
|
||||
#define HID_DG_TOUCHSCREEN 0x000d0004
|
||||
#define HID_DG_TOUCHPAD 0x000d0005
|
||||
#define HID_DG_STYLUS 0x000d0020
|
||||
#define HID_DG_PUCK 0x000d0021
|
||||
#define HID_DG_FINGER 0x000d0022
|
||||
#define HID_DG_TIPPRESSURE 0x000d0030
|
||||
#define HID_DG_BARRELPRESSURE 0x000d0031
|
||||
#define HID_DG_INRANGE 0x000d0032
|
||||
#define HID_DG_TOUCH 0x000d0033
|
||||
#define HID_DG_UNTOUCH 0x000d0034
|
||||
#define HID_DG_TAP 0x000d0035
|
||||
#define HID_DG_TABLETFUNCTIONKEY 0x000d0039
|
||||
#define HID_DG_PROGRAMCHANGEKEY 0x000d003a
|
||||
#define HID_DG_INVERT 0x000d003c
|
||||
#define HID_DG_TIPSWITCH 0x000d0042
|
||||
#define HID_DG_TIPSWITCH2 0x000d0043
|
||||
#define HID_DG_BARRELSWITCH 0x000d0044
|
||||
#define HID_DG_ERASER 0x000d0045
|
||||
#define HID_DG_TABLETPICK 0x000d0046
|
||||
/*
|
||||
* as of May 20, 2009 the usages below are not yet in the official USB spec
|
||||
* but are being pushed by Microsft as described in their paper "Digitizer
|
||||
* Drivers for Windows Touch and Pen-Based Computers"
|
||||
*/
|
||||
#define HID_DG_CONFIDENCE 0x000d0047
|
||||
#define HID_DG_WIDTH 0x000d0048
|
||||
#define HID_DG_HEIGHT 0x000d0049
|
||||
#define HID_DG_CONTACTID 0x000d0051
|
||||
#define HID_DG_INPUTMODE 0x000d0052
|
||||
#define HID_DG_DEVICEINDEX 0x000d0053
|
||||
#define HID_DG_CONTACTCOUNT 0x000d0054
|
||||
#define HID_DG_CONTACTMAX 0x000d0055
|
||||
|
||||
/*
|
||||
* HID report types --- Ouch! HID spec says 1 2 3!
|
||||
*/
|
||||
|
||||
@@ -55,7 +55,9 @@ static inline void *kmap(struct page *page)
|
||||
return page_address(page);
|
||||
}
|
||||
|
||||
#define kunmap(page) do { (void) (page); } while (0)
|
||||
static inline void kunmap(struct page *page)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void *kmap_atomic(struct page *page, enum km_type idx)
|
||||
{
|
||||
|
||||
@@ -30,8 +30,11 @@ struct hrtimer_cpu_base;
|
||||
* Mode arguments of xxx_hrtimer functions:
|
||||
*/
|
||||
enum hrtimer_mode {
|
||||
HRTIMER_MODE_ABS, /* Time value is absolute */
|
||||
HRTIMER_MODE_REL, /* Time value is relative to now */
|
||||
HRTIMER_MODE_ABS = 0x0, /* Time value is absolute */
|
||||
HRTIMER_MODE_REL = 0x1, /* Time value is relative to now */
|
||||
HRTIMER_MODE_PINNED = 0x02, /* Timer is bound to CPU */
|
||||
HRTIMER_MODE_ABS_PINNED = 0x02,
|
||||
HRTIMER_MODE_REL_PINNED = 0x03,
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
|
||||
struct ctl_table;
|
||||
|
||||
int PageHuge(struct page *page);
|
||||
|
||||
static inline int is_vm_hugetlb_page(struct vm_area_struct *vma)
|
||||
{
|
||||
return vma->vm_flags & VM_HUGETLB;
|
||||
@@ -61,6 +63,11 @@ void hugetlb_change_protection(struct vm_area_struct *vma,
|
||||
|
||||
#else /* !CONFIG_HUGETLB_PAGE */
|
||||
|
||||
static inline int PageHuge(struct page *page)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int is_vm_hugetlb_page(struct vm_area_struct *vma)
|
||||
{
|
||||
return 0;
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
struct ocores_i2c_platform_data {
|
||||
u32 regstep; /* distance between registers */
|
||||
u32 clock_khz; /* input clock in kHz */
|
||||
u8 num_devices; /* number of devices in the devices list */
|
||||
struct i2c_board_info const *devices; /* devices connected to the bus */
|
||||
};
|
||||
|
||||
#endif /* _LINUX_I2C_OCORES_H */
|
||||
|
||||
@@ -493,6 +493,7 @@ struct ieee80211s_hdr {
|
||||
/* Mesh flags */
|
||||
#define MESH_FLAGS_AE_A4 0x1
|
||||
#define MESH_FLAGS_AE_A5_A6 0x2
|
||||
#define MESH_FLAGS_AE 0x3
|
||||
#define MESH_FLAGS_PS_DEEP 0x4
|
||||
|
||||
/**
|
||||
@@ -540,10 +541,10 @@ struct ieee80211_tim_ie {
|
||||
u8 dtim_period;
|
||||
u8 bitmap_ctrl;
|
||||
/* variable size: 1 - 251 bytes */
|
||||
u8 virtual_map[0];
|
||||
u8 virtual_map[1];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define WLAN_SA_QUERY_TR_ID_LEN 16
|
||||
#define WLAN_SA_QUERY_TR_ID_LEN 2
|
||||
|
||||
struct ieee80211_mgmt {
|
||||
__le16 frame_control;
|
||||
@@ -1068,8 +1069,12 @@ enum ieee80211_category {
|
||||
WLAN_CATEGORY_DLS = 2,
|
||||
WLAN_CATEGORY_BACK = 3,
|
||||
WLAN_CATEGORY_PUBLIC = 4,
|
||||
WLAN_CATEGORY_HT = 7,
|
||||
WLAN_CATEGORY_SA_QUERY = 8,
|
||||
WLAN_CATEGORY_PROTECTED_DUAL_OF_ACTION = 9,
|
||||
WLAN_CATEGORY_WMM = 17,
|
||||
WLAN_CATEGORY_VENDOR_SPECIFIC_PROTECTED = 126,
|
||||
WLAN_CATEGORY_VENDOR_SPECIFIC = 127,
|
||||
};
|
||||
|
||||
/* SPECTRUM_MGMT action code */
|
||||
@@ -1081,6 +1086,15 @@ enum ieee80211_spectrum_mgmt_actioncode {
|
||||
WLAN_ACTION_SPCT_CHL_SWITCH = 4,
|
||||
};
|
||||
|
||||
/* Security key length */
|
||||
enum ieee80211_key_len {
|
||||
WLAN_KEY_LEN_WEP40 = 5,
|
||||
WLAN_KEY_LEN_WEP104 = 13,
|
||||
WLAN_KEY_LEN_CCMP = 16,
|
||||
WLAN_KEY_LEN_TKIP = 32,
|
||||
WLAN_KEY_LEN_AES_CMAC = 16,
|
||||
};
|
||||
|
||||
/*
|
||||
* IEEE 802.11-2007 7.3.2.9 Country information element
|
||||
*
|
||||
@@ -1261,7 +1275,9 @@ static inline bool ieee80211_is_robust_mgmt_frame(struct ieee80211_hdr *hdr)
|
||||
if (ieee80211_has_protected(hdr->frame_control))
|
||||
return true;
|
||||
category = ((u8 *) hdr) + 24;
|
||||
return *category != WLAN_CATEGORY_PUBLIC;
|
||||
return *category != WLAN_CATEGORY_PUBLIC &&
|
||||
*category != WLAN_CATEGORY_HT &&
|
||||
*category != WLAN_CATEGORY_VENDOR_SPECIFIC;
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -1383,4 +1399,43 @@ static inline int ieee80211_freq_to_ofdm_chan(int s_freq, int freq)
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* ieee80211_tu_to_usec - convert time units (TU) to microseconds
|
||||
* @tu: the TUs
|
||||
*/
|
||||
static inline unsigned long ieee80211_tu_to_usec(unsigned long tu)
|
||||
{
|
||||
return 1024 * tu;
|
||||
}
|
||||
|
||||
/**
|
||||
* ieee80211_check_tim - check if AID bit is set in TIM
|
||||
* @tim: the TIM IE
|
||||
* @tim_len: length of the TIM IE
|
||||
* @aid: the AID to look for
|
||||
*/
|
||||
static inline bool ieee80211_check_tim(struct ieee80211_tim_ie *tim,
|
||||
u8 tim_len, u16 aid)
|
||||
{
|
||||
u8 mask;
|
||||
u8 index, indexn1, indexn2;
|
||||
|
||||
if (unlikely(!tim || tim_len < sizeof(*tim)))
|
||||
return false;
|
||||
|
||||
aid &= 0x3fff;
|
||||
index = aid / 8;
|
||||
mask = 1 << (aid & 7);
|
||||
|
||||
indexn1 = tim->bitmap_ctrl & 0xfe;
|
||||
indexn2 = tim_len + indexn1 - 4;
|
||||
|
||||
if (index < indexn1 || index > indexn2)
|
||||
return false;
|
||||
|
||||
index -= indexn1;
|
||||
|
||||
return !!(tim->virtual_map[index] & mask);
|
||||
}
|
||||
|
||||
#endif /* LINUX_IEEE80211_H */
|
||||
|
||||
@@ -67,6 +67,9 @@
|
||||
#define IFF_ISATAP 0x80 /* ISATAP interface (RFC4214) */
|
||||
#define IFF_MASTER_ARPMON 0x100 /* bonding master, ARP mon in use */
|
||||
#define IFF_WAN_HDLC 0x200 /* WAN HDLC device */
|
||||
#define IFF_XMIT_DST_RELEASE 0x400 /* dev_hard_start_xmit() is allowed to
|
||||
* release skb->dst
|
||||
*/
|
||||
|
||||
#define IF_GET_IFACE 0x0001 /* for querying only */
|
||||
#define IF_GET_PROTO 0x0002
|
||||
|
||||
@@ -86,6 +86,8 @@
|
||||
#define ARPHRD_IEEE80211 801 /* IEEE 802.11 */
|
||||
#define ARPHRD_IEEE80211_PRISM 802 /* IEEE 802.11 + Prism2 header */
|
||||
#define ARPHRD_IEEE80211_RADIOTAP 803 /* IEEE 802.11 + radiotap header */
|
||||
#define ARPHRD_IEEE802154 804
|
||||
#define ARPHRD_IEEE802154_PHY 805
|
||||
|
||||
#define ARPHRD_PHONET 820 /* PhoNet media type */
|
||||
#define ARPHRD_PHONET_PIPE 821 /* PhoNet pipe header */
|
||||
|
||||
@@ -107,6 +107,7 @@
|
||||
#define ETH_P_DSA 0x001B /* Distributed Switch Arch. */
|
||||
#define ETH_P_TRAILER 0x001C /* Trailer switch tagging */
|
||||
#define ETH_P_PHONET 0x00F5 /* Nokia Phonet frames */
|
||||
#define ETH_P_IEEE802154 0x00F6 /* IEEE802.15.4 frame */
|
||||
|
||||
/*
|
||||
* This is an Ethernet frame header.
|
||||
|
||||
@@ -46,6 +46,8 @@ struct sockaddr_ll
|
||||
#define PACKET_VERSION 10
|
||||
#define PACKET_HDRLEN 11
|
||||
#define PACKET_RESERVE 12
|
||||
#define PACKET_TX_RING 13
|
||||
#define PACKET_LOSS 14
|
||||
|
||||
struct tpacket_stats
|
||||
{
|
||||
@@ -63,14 +65,22 @@ struct tpacket_auxdata
|
||||
__u16 tp_vlan_tci;
|
||||
};
|
||||
|
||||
/* Rx ring - header status */
|
||||
#define TP_STATUS_KERNEL 0x0
|
||||
#define TP_STATUS_USER 0x1
|
||||
#define TP_STATUS_COPY 0x2
|
||||
#define TP_STATUS_LOSING 0x4
|
||||
#define TP_STATUS_CSUMNOTREADY 0x8
|
||||
|
||||
/* Tx ring - header status */
|
||||
#define TP_STATUS_AVAILABLE 0x0
|
||||
#define TP_STATUS_SEND_REQUEST 0x1
|
||||
#define TP_STATUS_SENDING 0x2
|
||||
#define TP_STATUS_WRONG_FORMAT 0x4
|
||||
|
||||
struct tpacket_hdr
|
||||
{
|
||||
unsigned long tp_status;
|
||||
#define TP_STATUS_KERNEL 0
|
||||
#define TP_STATUS_USER 1
|
||||
#define TP_STATUS_COPY 2
|
||||
#define TP_STATUS_LOSING 4
|
||||
#define TP_STATUS_CSUMNOTREADY 8
|
||||
unsigned int tp_len;
|
||||
unsigned int tp_snaplen;
|
||||
unsigned short tp_mac;
|
||||
@@ -135,5 +145,6 @@ struct packet_mreq
|
||||
#define PACKET_MR_MULTICAST 0
|
||||
#define PACKET_MR_PROMISC 1
|
||||
#define PACKET_MR_ALLMULTI 2
|
||||
#define PACKET_MR_UNICAST 3
|
||||
|
||||
#endif
|
||||
|
||||
@@ -55,6 +55,7 @@
|
||||
#define IFF_NO_PI 0x1000
|
||||
#define IFF_ONE_QUEUE 0x2000
|
||||
#define IFF_VNET_HDR 0x4000
|
||||
#define IFF_TUN_EXCL 0x8000
|
||||
|
||||
/* Features for GSO (TUNSETOFFLOAD). */
|
||||
#define TUN_F_CSUM 0x01 /* You can hand me unchecksummed packets. */
|
||||
|
||||
@@ -44,7 +44,7 @@ struct ip_tunnel_prl {
|
||||
__u16 flags;
|
||||
__u16 __reserved;
|
||||
__u32 datalen;
|
||||
__u32 __reserved2;
|
||||
__u32 rs_delay;
|
||||
/* data follows */
|
||||
};
|
||||
|
||||
|
||||
@@ -118,8 +118,7 @@ extern int vlan_hwaccel_do_receive(struct sk_buff *skb);
|
||||
extern int vlan_gro_receive(struct napi_struct *napi, struct vlan_group *grp,
|
||||
unsigned int vlan_tci, struct sk_buff *skb);
|
||||
extern int vlan_gro_frags(struct napi_struct *napi, struct vlan_group *grp,
|
||||
unsigned int vlan_tci,
|
||||
struct napi_gro_fraginfo *info);
|
||||
unsigned int vlan_tci);
|
||||
|
||||
#else
|
||||
static inline struct net_device *vlan_dev_real_dev(const struct net_device *dev)
|
||||
@@ -154,8 +153,7 @@ static inline int vlan_gro_receive(struct napi_struct *napi,
|
||||
}
|
||||
|
||||
static inline int vlan_gro_frags(struct napi_struct *napi,
|
||||
struct vlan_group *grp, unsigned int vlan_tci,
|
||||
struct napi_gro_fraginfo *info)
|
||||
struct vlan_group *grp, unsigned int vlan_tci)
|
||||
{
|
||||
return NET_RX_DROP;
|
||||
}
|
||||
|
||||
@@ -107,6 +107,7 @@ struct in_addr {
|
||||
#define MCAST_JOIN_SOURCE_GROUP 46
|
||||
#define MCAST_LEAVE_SOURCE_GROUP 47
|
||||
#define MCAST_MSFILTER 48
|
||||
#define IP_MULTICAST_ALL 49
|
||||
|
||||
#define MCAST_EXCLUDE 0
|
||||
#define MCAST_INCLUDE 1
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
#define _LINUX_INIT_H
|
||||
|
||||
#include <linux/compiler.h>
|
||||
#include <linux/section-names.h>
|
||||
#include <linux/stringify.h>
|
||||
|
||||
/* These macros are used to mark some functions or
|
||||
* initialized data (doesn't apply to uninitialized data)
|
||||
@@ -31,7 +29,7 @@
|
||||
* sign followed by value, e.g.:
|
||||
*
|
||||
* static int init_variable __initdata = 0;
|
||||
* static char linux_logo[] __initdata = { 0x32, 0x36, ... };
|
||||
* static const char linux_logo[] __initconst = { 0x32, 0x36, ... };
|
||||
*
|
||||
* Don't forget to initialize data not at file scope, i.e. within a function,
|
||||
* as gcc otherwise puts the data into the bss section and not into the init
|
||||
@@ -101,7 +99,7 @@
|
||||
#define __memexitconst __section(.memexit.rodata)
|
||||
|
||||
/* For assembly routines */
|
||||
#define __HEAD .section __stringify(HEAD_TEXT_SECTION),"ax"
|
||||
#define __HEAD .section ".head.text","ax"
|
||||
#define __INIT .section ".init.text","ax"
|
||||
#define __FINIT .previous
|
||||
|
||||
@@ -225,7 +223,8 @@ struct obs_kernel_param {
|
||||
* obs_kernel_param "array" too far apart in .init.setup.
|
||||
*/
|
||||
#define __setup_param(str, unique_id, fn, early) \
|
||||
static char __setup_str_##unique_id[] __initdata __aligned(1) = str; \
|
||||
static const char __setup_str_##unique_id[] __initconst \
|
||||
__aligned(1) = str; \
|
||||
static struct obs_kernel_param __setup_##unique_id \
|
||||
__used __section(.init.setup) \
|
||||
__attribute__((aligned((sizeof(long))))) \
|
||||
|
||||
@@ -15,18 +15,6 @@
|
||||
extern struct files_struct init_files;
|
||||
extern struct fs_struct init_fs;
|
||||
|
||||
#define INIT_MM(name) \
|
||||
{ \
|
||||
.mm_rb = RB_ROOT, \
|
||||
.pgd = swapper_pg_dir, \
|
||||
.mm_users = ATOMIC_INIT(2), \
|
||||
.mm_count = ATOMIC_INIT(1), \
|
||||
.mmap_sem = __RWSEM_INITIALIZER(name.mmap_sem), \
|
||||
.page_table_lock = __SPIN_LOCK_UNLOCKED(name.page_table_lock), \
|
||||
.mmlist = LIST_HEAD_INIT(name.mmlist), \
|
||||
.cpu_vm_mask = CPU_MASK_ALL, \
|
||||
}
|
||||
|
||||
#define INIT_SIGNALS(sig) { \
|
||||
.count = ATOMIC_INIT(1), \
|
||||
.wait_chldexit = __WAIT_QUEUE_HEAD_INITIALIZER(sig.wait_chldexit),\
|
||||
|
||||
@@ -472,6 +472,20 @@ static inline void tasklet_hi_schedule(struct tasklet_struct *t)
|
||||
__tasklet_hi_schedule(t);
|
||||
}
|
||||
|
||||
extern void __tasklet_hi_schedule_first(struct tasklet_struct *t);
|
||||
|
||||
/*
|
||||
* This version avoids touching any other tasklets. Needed for kmemcheck
|
||||
* in order not to take any page faults while enqueueing this tasklet;
|
||||
* consider VERY carefully whether you really need this or
|
||||
* tasklet_hi_schedule()...
|
||||
*/
|
||||
static inline void tasklet_hi_schedule_first(struct tasklet_struct *t)
|
||||
{
|
||||
if (!test_and_set_bit(TASKLET_STATE_SCHED, &t->state))
|
||||
__tasklet_hi_schedule_first(t);
|
||||
}
|
||||
|
||||
|
||||
static inline void tasklet_disable_nosync(struct tasklet_struct *t)
|
||||
{
|
||||
|
||||
@@ -169,6 +169,12 @@ struct ipv6_devconf {
|
||||
__s32 accept_dad;
|
||||
void *sysctl;
|
||||
};
|
||||
|
||||
struct ipv6_params {
|
||||
__s32 disable_ipv6;
|
||||
__s32 autoconf;
|
||||
};
|
||||
extern struct ipv6_params ipv6_defaults;
|
||||
#endif
|
||||
|
||||
/* index values for the variables in ipv6_devconf */
|
||||
|
||||
@@ -79,7 +79,7 @@ int attach_capi_ctr(struct capi_ctr *);
|
||||
int detach_capi_ctr(struct capi_ctr *);
|
||||
|
||||
void capi_ctr_ready(struct capi_ctr * card);
|
||||
void capi_ctr_reseted(struct capi_ctr * card);
|
||||
void capi_ctr_down(struct capi_ctr * card);
|
||||
void capi_ctr_suspend_output(struct capi_ctr * card);
|
||||
void capi_ctr_resume_output(struct capi_ctr * card);
|
||||
void capi_ctr_handle_message(struct capi_ctr * card, u16 appl, struct sk_buff *skb);
|
||||
|
||||
@@ -97,12 +97,14 @@ extern const char linux_proc_banner[];
|
||||
#define KERN_INFO "<6>" /* informational */
|
||||
#define KERN_DEBUG "<7>" /* debug-level messages */
|
||||
|
||||
/* Use the default kernel loglevel */
|
||||
#define KERN_DEFAULT "<d>"
|
||||
/*
|
||||
* Annotation for a "continued" line of log printout (only done after a
|
||||
* line that had no enclosing \n). Only to be used by core/arch code
|
||||
* during early bootup (a continued line is not SMP-safe otherwise).
|
||||
*/
|
||||
#define KERN_CONT ""
|
||||
#define KERN_CONT "<c>"
|
||||
|
||||
extern int console_printk[];
|
||||
|
||||
@@ -406,7 +408,7 @@ static inline char *pack_hex_byte(char *buf, u8 byte)
|
||||
*
|
||||
* Use tracing_on/tracing_off when you want to quickly turn on or off
|
||||
* tracing. It simply enables or disables the recording of the trace events.
|
||||
* This also corresponds to the user space debugfs/tracing/tracing_on
|
||||
* This also corresponds to the user space /sys/kernel/debug/tracing/tracing_on
|
||||
* file, which gives a means for the kernel and userspace to interact.
|
||||
* Place a tracing_off() in the kernel where you want tracing to end.
|
||||
* From user space, examine the trace, and then echo 1 > tracing_on
|
||||
|
||||
@@ -56,6 +56,7 @@ extern int unregister_keyboard_notifier(struct notifier_block *nb);
|
||||
#define KT_ASCII 9
|
||||
#define KT_LOCK 10
|
||||
#define KT_SLOCK 12
|
||||
#define KT_DEAD2 13
|
||||
#define KT_BRL 14
|
||||
|
||||
#define K(t,v) (((t)<<8)|(v))
|
||||
|
||||
153
include/linux/kmemcheck.h
Normal file
153
include/linux/kmemcheck.h
Normal file
@@ -0,0 +1,153 @@
|
||||
#ifndef LINUX_KMEMCHECK_H
|
||||
#define LINUX_KMEMCHECK_H
|
||||
|
||||
#include <linux/mm_types.h>
|
||||
#include <linux/types.h>
|
||||
|
||||
#ifdef CONFIG_KMEMCHECK
|
||||
extern int kmemcheck_enabled;
|
||||
|
||||
/* The slab-related functions. */
|
||||
void kmemcheck_alloc_shadow(struct page *page, int order, gfp_t flags, int node);
|
||||
void kmemcheck_free_shadow(struct page *page, int order);
|
||||
void kmemcheck_slab_alloc(struct kmem_cache *s, gfp_t gfpflags, void *object,
|
||||
size_t size);
|
||||
void kmemcheck_slab_free(struct kmem_cache *s, void *object, size_t size);
|
||||
|
||||
void kmemcheck_pagealloc_alloc(struct page *p, unsigned int order,
|
||||
gfp_t gfpflags);
|
||||
|
||||
void kmemcheck_show_pages(struct page *p, unsigned int n);
|
||||
void kmemcheck_hide_pages(struct page *p, unsigned int n);
|
||||
|
||||
bool kmemcheck_page_is_tracked(struct page *p);
|
||||
|
||||
void kmemcheck_mark_unallocated(void *address, unsigned int n);
|
||||
void kmemcheck_mark_uninitialized(void *address, unsigned int n);
|
||||
void kmemcheck_mark_initialized(void *address, unsigned int n);
|
||||
void kmemcheck_mark_freed(void *address, unsigned int n);
|
||||
|
||||
void kmemcheck_mark_unallocated_pages(struct page *p, unsigned int n);
|
||||
void kmemcheck_mark_uninitialized_pages(struct page *p, unsigned int n);
|
||||
void kmemcheck_mark_initialized_pages(struct page *p, unsigned int n);
|
||||
|
||||
int kmemcheck_show_addr(unsigned long address);
|
||||
int kmemcheck_hide_addr(unsigned long address);
|
||||
|
||||
#else
|
||||
#define kmemcheck_enabled 0
|
||||
|
||||
static inline void
|
||||
kmemcheck_alloc_shadow(struct page *page, int order, gfp_t flags, int node)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void
|
||||
kmemcheck_free_shadow(struct page *page, int order)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void
|
||||
kmemcheck_slab_alloc(struct kmem_cache *s, gfp_t gfpflags, void *object,
|
||||
size_t size)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void kmemcheck_slab_free(struct kmem_cache *s, void *object,
|
||||
size_t size)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void kmemcheck_pagealloc_alloc(struct page *p,
|
||||
unsigned int order, gfp_t gfpflags)
|
||||
{
|
||||
}
|
||||
|
||||
static inline bool kmemcheck_page_is_tracked(struct page *p)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline void kmemcheck_mark_unallocated(void *address, unsigned int n)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void kmemcheck_mark_uninitialized(void *address, unsigned int n)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void kmemcheck_mark_initialized(void *address, unsigned int n)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void kmemcheck_mark_freed(void *address, unsigned int n)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void kmemcheck_mark_unallocated_pages(struct page *p,
|
||||
unsigned int n)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void kmemcheck_mark_uninitialized_pages(struct page *p,
|
||||
unsigned int n)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void kmemcheck_mark_initialized_pages(struct page *p,
|
||||
unsigned int n)
|
||||
{
|
||||
}
|
||||
|
||||
#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 if (ptr) { \
|
||||
int _n = (long) &((ptr)->name##_end) \
|
||||
- (long) &((ptr)->name##_begin); \
|
||||
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) \
|
||||
|
||||
#endif /* LINUX_KMEMCHECK_H */
|
||||
@@ -32,6 +32,22 @@ struct linux_logo {
|
||||
const unsigned char *data;
|
||||
};
|
||||
|
||||
extern const struct linux_logo logo_linux_mono;
|
||||
extern const struct linux_logo logo_linux_vga16;
|
||||
extern const struct linux_logo logo_linux_clut224;
|
||||
extern const struct linux_logo logo_blackfin_vga16;
|
||||
extern const struct linux_logo logo_blackfin_clut224;
|
||||
extern const struct linux_logo logo_dec_clut224;
|
||||
extern const struct linux_logo logo_mac_clut224;
|
||||
extern const struct linux_logo logo_parisc_clut224;
|
||||
extern const struct linux_logo logo_sgi_clut224;
|
||||
extern const struct linux_logo logo_sun_clut224;
|
||||
extern const struct linux_logo logo_superh_mono;
|
||||
extern const struct linux_logo logo_superh_vga16;
|
||||
extern const struct linux_logo logo_superh_clut224;
|
||||
extern const struct linux_logo logo_m32r_clut224;
|
||||
extern const struct linux_logo logo_spe_clut224;
|
||||
|
||||
extern const struct linux_logo *fb_find_logo(int depth);
|
||||
#ifdef CONFIG_FB_LOGO_EXTRA
|
||||
extern void fb_append_extra_logo(const struct linux_logo *logo,
|
||||
|
||||
39
include/linux/lis3lv02d.h
Normal file
39
include/linux/lis3lv02d.h
Normal file
@@ -0,0 +1,39 @@
|
||||
#ifndef __LIS3LV02D_H_
|
||||
#define __LIS3LV02D_H_
|
||||
|
||||
struct lis3lv02d_platform_data {
|
||||
/* please note: the 'click' feature is only supported for
|
||||
* LIS[32]02DL variants of the chip and will be ignored for
|
||||
* others */
|
||||
#define LIS3_CLICK_SINGLE_X (1 << 0)
|
||||
#define LIS3_CLICK_DOUBLE_X (1 << 1)
|
||||
#define LIS3_CLICK_SINGLE_Y (1 << 2)
|
||||
#define LIS3_CLICK_DOUBLE_Y (1 << 3)
|
||||
#define LIS3_CLICK_SINGLE_Z (1 << 4)
|
||||
#define LIS3_CLICK_DOUBLE_Z (1 << 5)
|
||||
unsigned char click_flags;
|
||||
unsigned char click_thresh_x;
|
||||
unsigned char click_thresh_y;
|
||||
unsigned char click_thresh_z;
|
||||
unsigned char click_time_limit;
|
||||
unsigned char click_latency;
|
||||
unsigned char click_window;
|
||||
|
||||
#define LIS3_IRQ1_DISABLE (0 << 0)
|
||||
#define LIS3_IRQ1_FF_WU_1 (1 << 0)
|
||||
#define LIS3_IRQ1_FF_WU_2 (2 << 0)
|
||||
#define LIS3_IRQ1_FF_WU_12 (3 << 0)
|
||||
#define LIS3_IRQ1_DATA_READY (4 << 0)
|
||||
#define LIS3_IRQ1_CLICK (7 << 0)
|
||||
#define LIS3_IRQ2_DISABLE (0 << 3)
|
||||
#define LIS3_IRQ2_FF_WU_1 (1 << 3)
|
||||
#define LIS3_IRQ2_FF_WU_2 (2 << 3)
|
||||
#define LIS3_IRQ2_FF_WU_12 (3 << 3)
|
||||
#define LIS3_IRQ2_DATA_READY (4 << 3)
|
||||
#define LIS3_IRQ2_CLICK (7 << 3)
|
||||
#define LIS3_IRQ_OPEN_DRAIN (1 << 6)
|
||||
#define LIS3_IRQ_ACTIVE_HIGH (1 << 7)
|
||||
unsigned char irq_cfg;
|
||||
};
|
||||
|
||||
#endif /* __LIS3LV02D_H_ */
|
||||
@@ -56,6 +56,18 @@ static inline int hlist_nulls_empty(const struct hlist_nulls_head *h)
|
||||
return is_a_nulls(h->first);
|
||||
}
|
||||
|
||||
static inline void hlist_nulls_add_head(struct hlist_nulls_node *n,
|
||||
struct hlist_nulls_head *h)
|
||||
{
|
||||
struct hlist_nulls_node *first = h->first;
|
||||
|
||||
n->next = first;
|
||||
n->pprev = &h->first;
|
||||
h->first = n;
|
||||
if (!is_a_nulls(first))
|
||||
first->pprev = &n->next;
|
||||
}
|
||||
|
||||
static inline void __hlist_nulls_del(struct hlist_nulls_node *n)
|
||||
{
|
||||
struct hlist_nulls_node *next = n->next;
|
||||
@@ -65,6 +77,12 @@ static inline void __hlist_nulls_del(struct hlist_nulls_node *n)
|
||||
next->pprev = pprev;
|
||||
}
|
||||
|
||||
static inline void hlist_nulls_del(struct hlist_nulls_node *n)
|
||||
{
|
||||
__hlist_nulls_del(n);
|
||||
n->pprev = LIST_POISON2;
|
||||
}
|
||||
|
||||
/**
|
||||
* hlist_nulls_for_each_entry - iterate over list of given type
|
||||
* @tpos: the type * to use as a loop cursor.
|
||||
|
||||
@@ -12,7 +12,8 @@ struct mISDN_dsp_element {
|
||||
void *(*new)(const char *arg);
|
||||
void (*free)(void *p);
|
||||
void (*process_tx)(void *p, unsigned char *data, int len);
|
||||
void (*process_rx)(void *p, unsigned char *data, int len);
|
||||
void (*process_rx)(void *p, unsigned char *data, int len,
|
||||
unsigned int txlen);
|
||||
int num_args;
|
||||
struct mISDN_dsp_element_arg
|
||||
*args;
|
||||
@@ -24,6 +25,7 @@ extern void mISDN_dsp_element_unregister(struct mISDN_dsp_element *elem);
|
||||
struct dsp_features {
|
||||
int hfc_id; /* unique id to identify the chip (or -1) */
|
||||
int hfc_dtmf; /* set if HFCmulti card supports dtmf */
|
||||
int hfc_conf; /* set if HFCmulti card supports conferences */
|
||||
int hfc_loops; /* set if card supports tone loops */
|
||||
int hfc_echocanhw; /* set if card supports echocancelation*/
|
||||
int pcm_id; /* unique id to identify the pcm bus (or -1) */
|
||||
|
||||
@@ -89,11 +89,6 @@ struct dchannel {
|
||||
void (*phfunc) (struct dchannel *);
|
||||
u_int state;
|
||||
void *l1;
|
||||
/* HW access */
|
||||
u_char (*read_reg) (void *, u_char);
|
||||
void (*write_reg) (void *, u_char, u_char);
|
||||
void (*read_fifo) (void *, u_char *, int);
|
||||
void (*write_fifo) (void *, u_char *, int);
|
||||
void *hw;
|
||||
int slot; /* multiport card channel slot */
|
||||
struct timer_list timer;
|
||||
@@ -151,11 +146,6 @@ struct bchannel {
|
||||
u_long Flags;
|
||||
struct work_struct workq;
|
||||
u_int state;
|
||||
/* HW access */
|
||||
u_char (*read_reg) (void *, u_char);
|
||||
void (*write_reg) (void *, u_char, u_char);
|
||||
void (*read_fifo) (void *, u_char *, int);
|
||||
void (*write_fifo) (void *, u_char *, int);
|
||||
void *hw;
|
||||
int slot; /* multiport card channel slot */
|
||||
struct timer_list timer;
|
||||
@@ -185,7 +175,7 @@ extern int dchannel_senddata(struct dchannel *, struct sk_buff *);
|
||||
extern int bchannel_senddata(struct bchannel *, struct sk_buff *);
|
||||
extern void recv_Dchannel(struct dchannel *);
|
||||
extern void recv_Echannel(struct dchannel *, struct dchannel *);
|
||||
extern void recv_Bchannel(struct bchannel *);
|
||||
extern void recv_Bchannel(struct bchannel *, unsigned int id);
|
||||
extern void recv_Dchannel_skb(struct dchannel *, struct sk_buff *);
|
||||
extern void recv_Bchannel_skb(struct bchannel *, struct sk_buff *);
|
||||
extern void confirm_Bsend(struct bchannel *bch);
|
||||
|
||||
@@ -229,6 +229,7 @@
|
||||
#define OPTION_L2_PTP 2
|
||||
#define OPTION_L2_FIXEDTEI 3
|
||||
#define OPTION_L2_CLEANUP 4
|
||||
#define OPTION_L1_HOLD 5
|
||||
|
||||
/* should be in sync with linux/kobject.h:KOBJ_NAME_LEN */
|
||||
#define MISDN_MAX_IDLEN 20
|
||||
@@ -291,19 +292,19 @@ struct mISDN_devrename {
|
||||
|
||||
/* MPH_INFORMATION_REQ payload */
|
||||
struct ph_info_ch {
|
||||
__u32 protocol;
|
||||
__u64 Flags;
|
||||
__u32 protocol;
|
||||
__u64 Flags;
|
||||
};
|
||||
|
||||
struct ph_info_dch {
|
||||
struct ph_info_ch ch;
|
||||
__u16 state;
|
||||
__u16 num_bch;
|
||||
struct ph_info_ch ch;
|
||||
__u16 state;
|
||||
__u16 num_bch;
|
||||
};
|
||||
|
||||
struct ph_info {
|
||||
struct ph_info_dch dch;
|
||||
struct ph_info_ch bch[];
|
||||
struct ph_info_dch dch;
|
||||
struct ph_info_ch bch[];
|
||||
};
|
||||
|
||||
/* timer device ioctl */
|
||||
@@ -317,6 +318,7 @@ struct ph_info {
|
||||
#define IMCTRLREQ _IOR('I', 69, int)
|
||||
#define IMCLEAR_L2 _IOR('I', 70, int)
|
||||
#define IMSETDEVNAME _IOR('I', 71, struct mISDN_devrename)
|
||||
#define IMHOLD_L1 _IOR('I', 72, int)
|
||||
|
||||
static inline int
|
||||
test_channelmap(u_int nr, u_char *map)
|
||||
@@ -362,7 +364,8 @@ clear_channelmap(u_int nr, u_char *map)
|
||||
#define MISDN_CTRL_HFC_RECEIVE_ON 0x4006
|
||||
#define MISDN_CTRL_HFC_ECHOCAN_ON 0x4007
|
||||
#define MISDN_CTRL_HFC_ECHOCAN_OFF 0x4008
|
||||
|
||||
#define MISDN_CTRL_HFC_WD_INIT 0x4009
|
||||
#define MISDN_CTRL_HFC_WD_RESET 0x400A
|
||||
|
||||
/* socket options */
|
||||
#define MISDN_TIME_STAMP 0x0001
|
||||
|
||||
@@ -145,6 +145,7 @@
|
||||
#define UNIX98_PTY_MAJOR_COUNT 8
|
||||
#define UNIX98_PTY_SLAVE_MAJOR (UNIX98_PTY_MASTER_MAJOR+UNIX98_PTY_MAJOR_COUNT)
|
||||
|
||||
#define DRBD_MAJOR 147
|
||||
#define RTF_MAJOR 150
|
||||
#define RAW_MAJOR 162
|
||||
|
||||
|
||||
356
include/linux/mdio.h
Normal file
356
include/linux/mdio.h
Normal file
@@ -0,0 +1,356 @@
|
||||
/*
|
||||
* linux/mdio.h: definitions for MDIO (clause 45) transceivers
|
||||
* Copyright 2006-2009 Solarflare Communications Inc.
|
||||
*
|
||||
* 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, incorporated herein by reference.
|
||||
*/
|
||||
|
||||
#ifndef __LINUX_MDIO_H__
|
||||
#define __LINUX_MDIO_H__
|
||||
|
||||
#include <linux/mii.h>
|
||||
|
||||
/* MDIO Manageable Devices (MMDs). */
|
||||
#define MDIO_MMD_PMAPMD 1 /* Physical Medium Attachment/
|
||||
* Physical Medium Dependent */
|
||||
#define MDIO_MMD_WIS 2 /* WAN Interface Sublayer */
|
||||
#define MDIO_MMD_PCS 3 /* Physical Coding Sublayer */
|
||||
#define MDIO_MMD_PHYXS 4 /* PHY Extender Sublayer */
|
||||
#define MDIO_MMD_DTEXS 5 /* DTE Extender Sublayer */
|
||||
#define MDIO_MMD_TC 6 /* Transmission Convergence */
|
||||
#define MDIO_MMD_AN 7 /* Auto-Negotiation */
|
||||
#define MDIO_MMD_C22EXT 29 /* Clause 22 extension */
|
||||
#define MDIO_MMD_VEND1 30 /* Vendor specific 1 */
|
||||
#define MDIO_MMD_VEND2 31 /* Vendor specific 2 */
|
||||
|
||||
/* Generic MDIO registers. */
|
||||
#define MDIO_CTRL1 MII_BMCR
|
||||
#define MDIO_STAT1 MII_BMSR
|
||||
#define MDIO_DEVID1 MII_PHYSID1
|
||||
#define MDIO_DEVID2 MII_PHYSID2
|
||||
#define MDIO_SPEED 4 /* Speed ability */
|
||||
#define MDIO_DEVS1 5 /* Devices in package */
|
||||
#define MDIO_DEVS2 6
|
||||
#define MDIO_CTRL2 7 /* 10G control 2 */
|
||||
#define MDIO_STAT2 8 /* 10G status 2 */
|
||||
#define MDIO_PMA_TXDIS 9 /* 10G PMA/PMD transmit disable */
|
||||
#define MDIO_PMA_RXDET 10 /* 10G PMA/PMD receive signal detect */
|
||||
#define MDIO_PMA_EXTABLE 11 /* 10G PMA/PMD extended ability */
|
||||
#define MDIO_PKGID1 14 /* Package identifier */
|
||||
#define MDIO_PKGID2 15
|
||||
#define MDIO_AN_ADVERTISE 16 /* AN advertising (base page) */
|
||||
#define MDIO_AN_LPA 19 /* AN LP abilities (base page) */
|
||||
#define MDIO_PHYXS_LNSTAT 24 /* PHY XGXS lane state */
|
||||
|
||||
/* Media-dependent registers. */
|
||||
#define MDIO_PMA_10GBT_SWAPPOL 130 /* 10GBASE-T pair swap & polarity */
|
||||
#define MDIO_PMA_10GBT_TXPWR 131 /* 10GBASE-T TX power control */
|
||||
#define MDIO_PMA_10GBT_SNR 133 /* 10GBASE-T SNR margin, lane A.
|
||||
* Lanes B-D are numbered 134-136. */
|
||||
#define MDIO_PMA_10GBR_FECABLE 170 /* 10GBASE-R FEC ability */
|
||||
#define MDIO_PCS_10GBX_STAT1 24 /* 10GBASE-X PCS status 1 */
|
||||
#define MDIO_PCS_10GBRT_STAT1 32 /* 10GBASE-R/-T PCS status 1 */
|
||||
#define MDIO_PCS_10GBRT_STAT2 33 /* 10GBASE-R/-T PCS status 2 */
|
||||
#define MDIO_AN_10GBT_CTRL 32 /* 10GBASE-T auto-negotiation control */
|
||||
#define MDIO_AN_10GBT_STAT 33 /* 10GBASE-T auto-negotiation status */
|
||||
|
||||
/* LASI (Link Alarm Status Interrupt) registers, defined by XENPAK MSA. */
|
||||
#define MDIO_PMA_LASI_RXCTRL 0x9000 /* RX_ALARM control */
|
||||
#define MDIO_PMA_LASI_TXCTRL 0x9001 /* TX_ALARM control */
|
||||
#define MDIO_PMA_LASI_CTRL 0x9002 /* LASI control */
|
||||
#define MDIO_PMA_LASI_RXSTAT 0x9003 /* RX_ALARM status */
|
||||
#define MDIO_PMA_LASI_TXSTAT 0x9004 /* TX_ALARM status */
|
||||
#define MDIO_PMA_LASI_STAT 0x9005 /* LASI status */
|
||||
|
||||
/* Control register 1. */
|
||||
/* Enable extended speed selection */
|
||||
#define MDIO_CTRL1_SPEEDSELEXT (BMCR_SPEED1000 | BMCR_SPEED100)
|
||||
/* All speed selection bits */
|
||||
#define MDIO_CTRL1_SPEEDSEL (MDIO_CTRL1_SPEEDSELEXT | 0x003c)
|
||||
#define MDIO_CTRL1_FULLDPLX BMCR_FULLDPLX
|
||||
#define MDIO_CTRL1_LPOWER BMCR_PDOWN
|
||||
#define MDIO_CTRL1_RESET BMCR_RESET
|
||||
#define MDIO_PMA_CTRL1_LOOPBACK 0x0001
|
||||
#define MDIO_PMA_CTRL1_SPEED1000 BMCR_SPEED1000
|
||||
#define MDIO_PMA_CTRL1_SPEED100 BMCR_SPEED100
|
||||
#define MDIO_PCS_CTRL1_LOOPBACK BMCR_LOOPBACK
|
||||
#define MDIO_PHYXS_CTRL1_LOOPBACK BMCR_LOOPBACK
|
||||
#define MDIO_AN_CTRL1_RESTART BMCR_ANRESTART
|
||||
#define MDIO_AN_CTRL1_ENABLE BMCR_ANENABLE
|
||||
#define MDIO_AN_CTRL1_XNP 0x2000 /* Enable extended next page */
|
||||
|
||||
/* 10 Gb/s */
|
||||
#define MDIO_CTRL1_SPEED10G (MDIO_CTRL1_SPEEDSELEXT | 0x00)
|
||||
/* 10PASS-TS/2BASE-TL */
|
||||
#define MDIO_CTRL1_SPEED10P2B (MDIO_CTRL1_SPEEDSELEXT | 0x04)
|
||||
|
||||
/* Status register 1. */
|
||||
#define MDIO_STAT1_LPOWERABLE 0x0002 /* Low-power ability */
|
||||
#define MDIO_STAT1_LSTATUS BMSR_LSTATUS
|
||||
#define MDIO_STAT1_FAULT 0x0080 /* Fault */
|
||||
#define MDIO_AN_STAT1_LPABLE 0x0001 /* Link partner AN ability */
|
||||
#define MDIO_AN_STAT1_ABLE BMSR_ANEGCAPABLE
|
||||
#define MDIO_AN_STAT1_RFAULT BMSR_RFAULT
|
||||
#define MDIO_AN_STAT1_COMPLETE BMSR_ANEGCOMPLETE
|
||||
#define MDIO_AN_STAT1_PAGE 0x0040 /* Page received */
|
||||
#define MDIO_AN_STAT1_XNP 0x0080 /* Extended next page status */
|
||||
|
||||
/* Speed register. */
|
||||
#define MDIO_SPEED_10G 0x0001 /* 10G capable */
|
||||
#define MDIO_PMA_SPEED_2B 0x0002 /* 2BASE-TL capable */
|
||||
#define MDIO_PMA_SPEED_10P 0x0004 /* 10PASS-TS capable */
|
||||
#define MDIO_PMA_SPEED_1000 0x0010 /* 1000M capable */
|
||||
#define MDIO_PMA_SPEED_100 0x0020 /* 100M capable */
|
||||
#define MDIO_PMA_SPEED_10 0x0040 /* 10M capable */
|
||||
#define MDIO_PCS_SPEED_10P2B 0x0002 /* 10PASS-TS/2BASE-TL capable */
|
||||
|
||||
/* Device present registers. */
|
||||
#define MDIO_DEVS_PRESENT(devad) (1 << (devad))
|
||||
#define MDIO_DEVS_PMAPMD MDIO_DEVS_PRESENT(MDIO_MMD_PMAPMD)
|
||||
#define MDIO_DEVS_WIS MDIO_DEVS_PRESENT(MDIO_MMD_WIS)
|
||||
#define MDIO_DEVS_PCS MDIO_DEVS_PRESENT(MDIO_MMD_PCS)
|
||||
#define MDIO_DEVS_PHYXS MDIO_DEVS_PRESENT(MDIO_MMD_PHYXS)
|
||||
#define MDIO_DEVS_DTEXS MDIO_DEVS_PRESENT(MDIO_MMD_DTEXS)
|
||||
#define MDIO_DEVS_TC MDIO_DEVS_PRESENT(MDIO_MMD_TC)
|
||||
#define MDIO_DEVS_AN MDIO_DEVS_PRESENT(MDIO_MMD_AN)
|
||||
#define MDIO_DEVS_C22EXT MDIO_DEVS_PRESENT(MDIO_MMD_C22EXT)
|
||||
|
||||
/* Control register 2. */
|
||||
#define MDIO_PMA_CTRL2_TYPE 0x000f /* PMA/PMD type selection */
|
||||
#define MDIO_PMA_CTRL2_10GBCX4 0x0000 /* 10GBASE-CX4 type */
|
||||
#define MDIO_PMA_CTRL2_10GBEW 0x0001 /* 10GBASE-EW type */
|
||||
#define MDIO_PMA_CTRL2_10GBLW 0x0002 /* 10GBASE-LW type */
|
||||
#define MDIO_PMA_CTRL2_10GBSW 0x0003 /* 10GBASE-SW type */
|
||||
#define MDIO_PMA_CTRL2_10GBLX4 0x0004 /* 10GBASE-LX4 type */
|
||||
#define MDIO_PMA_CTRL2_10GBER 0x0005 /* 10GBASE-ER type */
|
||||
#define MDIO_PMA_CTRL2_10GBLR 0x0006 /* 10GBASE-LR type */
|
||||
#define MDIO_PMA_CTRL2_10GBSR 0x0007 /* 10GBASE-SR type */
|
||||
#define MDIO_PMA_CTRL2_10GBLRM 0x0008 /* 10GBASE-LRM type */
|
||||
#define MDIO_PMA_CTRL2_10GBT 0x0009 /* 10GBASE-T type */
|
||||
#define MDIO_PMA_CTRL2_10GBKX4 0x000a /* 10GBASE-KX4 type */
|
||||
#define MDIO_PMA_CTRL2_10GBKR 0x000b /* 10GBASE-KR type */
|
||||
#define MDIO_PMA_CTRL2_1000BT 0x000c /* 1000BASE-T type */
|
||||
#define MDIO_PMA_CTRL2_1000BKX 0x000d /* 1000BASE-KX type */
|
||||
#define MDIO_PMA_CTRL2_100BTX 0x000e /* 100BASE-TX type */
|
||||
#define MDIO_PMA_CTRL2_10BT 0x000f /* 10BASE-T type */
|
||||
#define MDIO_PCS_CTRL2_TYPE 0x0003 /* PCS type selection */
|
||||
#define MDIO_PCS_CTRL2_10GBR 0x0000 /* 10GBASE-R type */
|
||||
#define MDIO_PCS_CTRL2_10GBX 0x0001 /* 10GBASE-X type */
|
||||
#define MDIO_PCS_CTRL2_10GBW 0x0002 /* 10GBASE-W type */
|
||||
#define MDIO_PCS_CTRL2_10GBT 0x0003 /* 10GBASE-T type */
|
||||
|
||||
/* Status register 2. */
|
||||
#define MDIO_STAT2_RXFAULT 0x0400 /* Receive fault */
|
||||
#define MDIO_STAT2_TXFAULT 0x0800 /* Transmit fault */
|
||||
#define MDIO_STAT2_DEVPRST 0xc000 /* Device present */
|
||||
#define MDIO_STAT2_DEVPRST_VAL 0x8000 /* Device present value */
|
||||
#define MDIO_PMA_STAT2_LBABLE 0x0001 /* PMA loopback ability */
|
||||
#define MDIO_PMA_STAT2_10GBEW 0x0002 /* 10GBASE-EW ability */
|
||||
#define MDIO_PMA_STAT2_10GBLW 0x0004 /* 10GBASE-LW ability */
|
||||
#define MDIO_PMA_STAT2_10GBSW 0x0008 /* 10GBASE-SW ability */
|
||||
#define MDIO_PMA_STAT2_10GBLX4 0x0010 /* 10GBASE-LX4 ability */
|
||||
#define MDIO_PMA_STAT2_10GBER 0x0020 /* 10GBASE-ER ability */
|
||||
#define MDIO_PMA_STAT2_10GBLR 0x0040 /* 10GBASE-LR ability */
|
||||
#define MDIO_PMA_STAT2_10GBSR 0x0080 /* 10GBASE-SR ability */
|
||||
#define MDIO_PMD_STAT2_TXDISAB 0x0100 /* PMD TX disable ability */
|
||||
#define MDIO_PMA_STAT2_EXTABLE 0x0200 /* Extended abilities */
|
||||
#define MDIO_PMA_STAT2_RXFLTABLE 0x1000 /* Receive fault ability */
|
||||
#define MDIO_PMA_STAT2_TXFLTABLE 0x2000 /* Transmit fault ability */
|
||||
#define MDIO_PCS_STAT2_10GBR 0x0001 /* 10GBASE-R capable */
|
||||
#define MDIO_PCS_STAT2_10GBX 0x0002 /* 10GBASE-X capable */
|
||||
#define MDIO_PCS_STAT2_10GBW 0x0004 /* 10GBASE-W capable */
|
||||
#define MDIO_PCS_STAT2_RXFLTABLE 0x1000 /* Receive fault ability */
|
||||
#define MDIO_PCS_STAT2_TXFLTABLE 0x2000 /* Transmit fault ability */
|
||||
|
||||
/* Transmit disable register. */
|
||||
#define MDIO_PMD_TXDIS_GLOBAL 0x0001 /* Global PMD TX disable */
|
||||
#define MDIO_PMD_TXDIS_0 0x0002 /* PMD TX disable 0 */
|
||||
#define MDIO_PMD_TXDIS_1 0x0004 /* PMD TX disable 1 */
|
||||
#define MDIO_PMD_TXDIS_2 0x0008 /* PMD TX disable 2 */
|
||||
#define MDIO_PMD_TXDIS_3 0x0010 /* PMD TX disable 3 */
|
||||
|
||||
/* Receive signal detect register. */
|
||||
#define MDIO_PMD_RXDET_GLOBAL 0x0001 /* Global PMD RX signal detect */
|
||||
#define MDIO_PMD_RXDET_0 0x0002 /* PMD RX signal detect 0 */
|
||||
#define MDIO_PMD_RXDET_1 0x0004 /* PMD RX signal detect 1 */
|
||||
#define MDIO_PMD_RXDET_2 0x0008 /* PMD RX signal detect 2 */
|
||||
#define MDIO_PMD_RXDET_3 0x0010 /* PMD RX signal detect 3 */
|
||||
|
||||
/* Extended abilities register. */
|
||||
#define MDIO_PMA_EXTABLE_10GCX4 0x0001 /* 10GBASE-CX4 ability */
|
||||
#define MDIO_PMA_EXTABLE_10GBLRM 0x0002 /* 10GBASE-LRM ability */
|
||||
#define MDIO_PMA_EXTABLE_10GBT 0x0004 /* 10GBASE-T ability */
|
||||
#define MDIO_PMA_EXTABLE_10GBKX4 0x0008 /* 10GBASE-KX4 ability */
|
||||
#define MDIO_PMA_EXTABLE_10GBKR 0x0010 /* 10GBASE-KR ability */
|
||||
#define MDIO_PMA_EXTABLE_1000BT 0x0020 /* 1000BASE-T ability */
|
||||
#define MDIO_PMA_EXTABLE_1000BKX 0x0040 /* 1000BASE-KX ability */
|
||||
#define MDIO_PMA_EXTABLE_100BTX 0x0080 /* 100BASE-TX ability */
|
||||
#define MDIO_PMA_EXTABLE_10BT 0x0100 /* 10BASE-T ability */
|
||||
|
||||
/* PHY XGXS lane state register. */
|
||||
#define MDIO_PHYXS_LNSTAT_SYNC0 0x0001
|
||||
#define MDIO_PHYXS_LNSTAT_SYNC1 0x0002
|
||||
#define MDIO_PHYXS_LNSTAT_SYNC2 0x0004
|
||||
#define MDIO_PHYXS_LNSTAT_SYNC3 0x0008
|
||||
#define MDIO_PHYXS_LNSTAT_ALIGN 0x1000
|
||||
|
||||
/* PMA 10GBASE-T pair swap & polarity */
|
||||
#define MDIO_PMA_10GBT_SWAPPOL_ABNX 0x0001 /* Pair A/B uncrossed */
|
||||
#define MDIO_PMA_10GBT_SWAPPOL_CDNX 0x0002 /* Pair C/D uncrossed */
|
||||
#define MDIO_PMA_10GBT_SWAPPOL_AREV 0x0100 /* Pair A polarity reversed */
|
||||
#define MDIO_PMA_10GBT_SWAPPOL_BREV 0x0200 /* Pair B polarity reversed */
|
||||
#define MDIO_PMA_10GBT_SWAPPOL_CREV 0x0400 /* Pair C polarity reversed */
|
||||
#define MDIO_PMA_10GBT_SWAPPOL_DREV 0x0800 /* Pair D polarity reversed */
|
||||
|
||||
/* PMA 10GBASE-T TX power register. */
|
||||
#define MDIO_PMA_10GBT_TXPWR_SHORT 0x0001 /* Short-reach mode */
|
||||
|
||||
/* PMA 10GBASE-T SNR registers. */
|
||||
/* Value is SNR margin in dB, clamped to range [-127, 127], plus 0x8000. */
|
||||
#define MDIO_PMA_10GBT_SNR_BIAS 0x8000
|
||||
#define MDIO_PMA_10GBT_SNR_MAX 127
|
||||
|
||||
/* PMA 10GBASE-R FEC ability register. */
|
||||
#define MDIO_PMA_10GBR_FECABLE_ABLE 0x0001 /* FEC ability */
|
||||
#define MDIO_PMA_10GBR_FECABLE_ERRABLE 0x0002 /* FEC error indic. ability */
|
||||
|
||||
/* PCS 10GBASE-R/-T status register 1. */
|
||||
#define MDIO_PCS_10GBRT_STAT1_BLKLK 0x0001 /* Block lock attained */
|
||||
|
||||
/* PCS 10GBASE-R/-T status register 2. */
|
||||
#define MDIO_PCS_10GBRT_STAT2_ERR 0x00ff
|
||||
#define MDIO_PCS_10GBRT_STAT2_BER 0x3f00
|
||||
|
||||
/* AN 10GBASE-T control register. */
|
||||
#define MDIO_AN_10GBT_CTRL_ADV10G 0x1000 /* Advertise 10GBASE-T */
|
||||
|
||||
/* AN 10GBASE-T status register. */
|
||||
#define MDIO_AN_10GBT_STAT_LPTRR 0x0200 /* LP training reset req. */
|
||||
#define MDIO_AN_10GBT_STAT_LPLTABLE 0x0400 /* LP loop timing ability */
|
||||
#define MDIO_AN_10GBT_STAT_LP10G 0x0800 /* LP is 10GBT capable */
|
||||
#define MDIO_AN_10GBT_STAT_REMOK 0x1000 /* Remote OK */
|
||||
#define MDIO_AN_10GBT_STAT_LOCOK 0x2000 /* Local OK */
|
||||
#define MDIO_AN_10GBT_STAT_MS 0x4000 /* Master/slave config */
|
||||
#define MDIO_AN_10GBT_STAT_MSFLT 0x8000 /* Master/slave config fault */
|
||||
|
||||
/* LASI RX_ALARM control/status registers. */
|
||||
#define MDIO_PMA_LASI_RX_PHYXSLFLT 0x0001 /* PHY XS RX local fault */
|
||||
#define MDIO_PMA_LASI_RX_PCSLFLT 0x0008 /* PCS RX local fault */
|
||||
#define MDIO_PMA_LASI_RX_PMALFLT 0x0010 /* PMA/PMD RX local fault */
|
||||
#define MDIO_PMA_LASI_RX_OPTICPOWERFLT 0x0020 /* RX optical power fault */
|
||||
#define MDIO_PMA_LASI_RX_WISLFLT 0x0200 /* WIS local fault */
|
||||
|
||||
/* LASI TX_ALARM control/status registers. */
|
||||
#define MDIO_PMA_LASI_TX_PHYXSLFLT 0x0001 /* PHY XS TX local fault */
|
||||
#define MDIO_PMA_LASI_TX_PCSLFLT 0x0008 /* PCS TX local fault */
|
||||
#define MDIO_PMA_LASI_TX_PMALFLT 0x0010 /* PMA/PMD TX local fault */
|
||||
#define MDIO_PMA_LASI_TX_LASERPOWERFLT 0x0080 /* Laser output power fault */
|
||||
#define MDIO_PMA_LASI_TX_LASERTEMPFLT 0x0100 /* Laser temperature fault */
|
||||
#define MDIO_PMA_LASI_TX_LASERBICURRFLT 0x0200 /* Laser bias current fault */
|
||||
|
||||
/* LASI control/status registers. */
|
||||
#define MDIO_PMA_LASI_LSALARM 0x0001 /* LS_ALARM enable/status */
|
||||
#define MDIO_PMA_LASI_TXALARM 0x0002 /* TX_ALARM enable/status */
|
||||
#define MDIO_PMA_LASI_RXALARM 0x0004 /* RX_ALARM enable/status */
|
||||
|
||||
/* Mapping between MDIO PRTAD/DEVAD and mii_ioctl_data::phy_id */
|
||||
|
||||
#define MDIO_PHY_ID_C45 0x8000
|
||||
#define MDIO_PHY_ID_PRTAD 0x03e0
|
||||
#define MDIO_PHY_ID_DEVAD 0x001f
|
||||
#define MDIO_PHY_ID_C45_MASK \
|
||||
(MDIO_PHY_ID_C45 | MDIO_PHY_ID_PRTAD | MDIO_PHY_ID_DEVAD)
|
||||
|
||||
static inline __u16 mdio_phy_id_c45(int prtad, int devad)
|
||||
{
|
||||
return MDIO_PHY_ID_C45 | (prtad << 5) | devad;
|
||||
}
|
||||
|
||||
static inline bool mdio_phy_id_is_c45(int phy_id)
|
||||
{
|
||||
return (phy_id & MDIO_PHY_ID_C45) && !(phy_id & ~MDIO_PHY_ID_C45_MASK);
|
||||
}
|
||||
|
||||
static inline __u16 mdio_phy_id_prtad(int phy_id)
|
||||
{
|
||||
return (phy_id & MDIO_PHY_ID_PRTAD) >> 5;
|
||||
}
|
||||
|
||||
static inline __u16 mdio_phy_id_devad(int phy_id)
|
||||
{
|
||||
return phy_id & MDIO_PHY_ID_DEVAD;
|
||||
}
|
||||
|
||||
#define MDIO_SUPPORTS_C22 1
|
||||
#define MDIO_SUPPORTS_C45 2
|
||||
|
||||
#ifdef __KERNEL__
|
||||
|
||||
/**
|
||||
* struct mdio_if_info - Ethernet controller MDIO interface
|
||||
* @prtad: PRTAD of the PHY (%MDIO_PRTAD_NONE if not present/unknown)
|
||||
* @mmds: Mask of MMDs expected to be present in the PHY. This must be
|
||||
* non-zero unless @prtad = %MDIO_PRTAD_NONE.
|
||||
* @mode_support: MDIO modes supported. If %MDIO_SUPPORTS_C22 is set then
|
||||
* MII register access will be passed through with @devad =
|
||||
* %MDIO_DEVAD_NONE. If %MDIO_EMULATE_C22 is set then access to
|
||||
* commonly used clause 22 registers will be translated into
|
||||
* clause 45 registers.
|
||||
* @dev: Net device structure
|
||||
* @mdio_read: Register read function; returns value or negative error code
|
||||
* @mdio_write: Register write function; returns 0 or negative error code
|
||||
*/
|
||||
struct mdio_if_info {
|
||||
int prtad;
|
||||
u32 __bitwise mmds;
|
||||
unsigned mode_support;
|
||||
|
||||
struct net_device *dev;
|
||||
int (*mdio_read)(struct net_device *dev, int prtad, int devad,
|
||||
u16 addr);
|
||||
int (*mdio_write)(struct net_device *dev, int prtad, int devad,
|
||||
u16 addr, u16 val);
|
||||
};
|
||||
|
||||
#define MDIO_PRTAD_NONE (-1)
|
||||
#define MDIO_DEVAD_NONE (-1)
|
||||
#define MDIO_EMULATE_C22 4
|
||||
|
||||
struct ethtool_cmd;
|
||||
struct ethtool_pauseparam;
|
||||
extern int mdio45_probe(struct mdio_if_info *mdio, int prtad);
|
||||
extern int mdio_set_flag(const struct mdio_if_info *mdio,
|
||||
int prtad, int devad, u16 addr, int mask,
|
||||
bool sense);
|
||||
extern int mdio45_links_ok(const struct mdio_if_info *mdio, u32 mmds);
|
||||
extern int mdio45_nway_restart(const struct mdio_if_info *mdio);
|
||||
extern void mdio45_ethtool_gset_npage(const struct mdio_if_info *mdio,
|
||||
struct ethtool_cmd *ecmd,
|
||||
u32 npage_adv, u32 npage_lpa);
|
||||
extern void
|
||||
mdio45_ethtool_spauseparam_an(const struct mdio_if_info *mdio,
|
||||
const struct ethtool_pauseparam *ecmd);
|
||||
|
||||
/**
|
||||
* mdio45_ethtool_gset - get settings for ETHTOOL_GSET
|
||||
* @mdio: MDIO interface
|
||||
* @ecmd: Ethtool request structure
|
||||
*
|
||||
* Since the CSRs for auto-negotiation using next pages are not fully
|
||||
* standardised, this function does not attempt to decode them. Use
|
||||
* mdio45_ethtool_gset_npage() to specify advertisement bits from next
|
||||
* pages.
|
||||
*/
|
||||
static inline void mdio45_ethtool_gset(const struct mdio_if_info *mdio,
|
||||
struct ethtool_cmd *ecmd)
|
||||
{
|
||||
mdio45_ethtool_gset_npage(mdio, ecmd, 0, 0);
|
||||
}
|
||||
|
||||
extern int mdio_mii_ioctl(const struct mdio_if_info *mdio,
|
||||
struct mii_ioctl_data *mii_data, int cmd);
|
||||
|
||||
#endif /* __KERNEL__ */
|
||||
#endif /* __LINUX_MDIO_H__ */
|
||||
@@ -94,6 +94,7 @@ extern void mem_cgroup_note_reclaim_priority(struct mem_cgroup *mem,
|
||||
extern void mem_cgroup_record_reclaim_priority(struct mem_cgroup *mem,
|
||||
int priority);
|
||||
int mem_cgroup_inactive_anon_is_low(struct mem_cgroup *memcg);
|
||||
int mem_cgroup_inactive_file_is_low(struct mem_cgroup *memcg);
|
||||
unsigned long mem_cgroup_zone_nr_pages(struct mem_cgroup *memcg,
|
||||
struct zone *zone,
|
||||
enum lru_list lru);
|
||||
@@ -239,6 +240,12 @@ mem_cgroup_inactive_anon_is_low(struct mem_cgroup *memcg)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static inline int
|
||||
mem_cgroup_inactive_file_is_low(struct mem_cgroup *memcg)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static inline unsigned long
|
||||
mem_cgroup_zone_nr_pages(struct mem_cgroup *memcg, struct zone *zone,
|
||||
enum lru_list lru)
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
writew((val) >> 16, (addr) + 2); \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
* data for the MMC controller
|
||||
*/
|
||||
struct tmio_mmc_data {
|
||||
unsigned int hclk;
|
||||
};
|
||||
|
||||
/*
|
||||
* data for the NAND controller
|
||||
*/
|
||||
|
||||
45
include/linux/mg_disk.h
Normal file
45
include/linux/mg_disk.h
Normal file
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* include/linux/mg_disk.c
|
||||
*
|
||||
* Private data for mflash platform driver
|
||||
*
|
||||
* (c) 2008 mGine Co.,LTD
|
||||
* (c) 2008 unsik Kim <donari75@gmail.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 __MG_DISK_H__
|
||||
#define __MG_DISK_H__
|
||||
|
||||
/* name for platform device */
|
||||
#define MG_DEV_NAME "mg_disk"
|
||||
|
||||
/* names of GPIO resource */
|
||||
#define MG_RST_PIN "mg_rst"
|
||||
/* except MG_BOOT_DEV, reset-out pin should be assigned */
|
||||
#define MG_RSTOUT_PIN "mg_rstout"
|
||||
|
||||
/* device attribution */
|
||||
/* use mflash as boot device */
|
||||
#define MG_BOOT_DEV (1 << 0)
|
||||
/* use mflash as storage device */
|
||||
#define MG_STORAGE_DEV (1 << 1)
|
||||
/* same as MG_STORAGE_DEV, but bootloader already done reset sequence */
|
||||
#define MG_STORAGE_DEV_SKIP_RST (1 << 2)
|
||||
|
||||
/* private driver data */
|
||||
struct mg_drv_data {
|
||||
/* disk resource */
|
||||
u32 use_polling;
|
||||
|
||||
/* device attribution */
|
||||
u32 dev_attr;
|
||||
|
||||
/* internally used */
|
||||
void *host;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -239,6 +239,22 @@ static inline unsigned int mii_duplex (unsigned int duplex_lock,
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* mii_advertise_flowctrl - get flow control advertisement flags
|
||||
* @cap: Flow control capabilities (FLOW_CTRL_RX, FLOW_CTRL_TX or both)
|
||||
*/
|
||||
static inline u16 mii_advertise_flowctrl(int cap)
|
||||
{
|
||||
u16 adv = 0;
|
||||
|
||||
if (cap & FLOW_CTRL_RX)
|
||||
adv = ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM;
|
||||
if (cap & FLOW_CTRL_TX)
|
||||
adv ^= ADVERTISE_PAUSE_ASYM;
|
||||
|
||||
return adv;
|
||||
}
|
||||
|
||||
/**
|
||||
* mii_resolve_flowctrl_fdx
|
||||
* @lcladv: value of MII ADVERTISE register
|
||||
@@ -250,18 +266,12 @@ static inline u8 mii_resolve_flowctrl_fdx(u16 lcladv, u16 rmtadv)
|
||||
{
|
||||
u8 cap = 0;
|
||||
|
||||
if (lcladv & ADVERTISE_PAUSE_CAP) {
|
||||
if (lcladv & ADVERTISE_PAUSE_ASYM) {
|
||||
if (rmtadv & LPA_PAUSE_CAP)
|
||||
cap = FLOW_CTRL_TX | FLOW_CTRL_RX;
|
||||
else if (rmtadv & LPA_PAUSE_ASYM)
|
||||
cap = FLOW_CTRL_RX;
|
||||
} else {
|
||||
if (rmtadv & LPA_PAUSE_CAP)
|
||||
cap = FLOW_CTRL_TX | FLOW_CTRL_RX;
|
||||
}
|
||||
} else if (lcladv & ADVERTISE_PAUSE_ASYM) {
|
||||
if ((rmtadv & LPA_PAUSE_CAP) && (rmtadv & LPA_PAUSE_ASYM))
|
||||
if (lcladv & rmtadv & ADVERTISE_PAUSE_CAP) {
|
||||
cap = FLOW_CTRL_TX | FLOW_CTRL_RX;
|
||||
} else if (lcladv & rmtadv & ADVERTISE_PAUSE_ASYM) {
|
||||
if (lcladv & ADVERTISE_PAUSE_CAP)
|
||||
cap = FLOW_CTRL_RX;
|
||||
else if (rmtadv & ADVERTISE_PAUSE_CAP)
|
||||
cap = FLOW_CTRL_TX;
|
||||
}
|
||||
|
||||
|
||||
@@ -41,6 +41,7 @@ struct miscdevice {
|
||||
struct list_head list;
|
||||
struct device *parent;
|
||||
struct device *this_device;
|
||||
const char *devnode;
|
||||
};
|
||||
|
||||
extern int misc_register(struct miscdevice * misc);
|
||||
|
||||
@@ -210,6 +210,7 @@ struct mlx4_caps {
|
||||
int num_comp_vectors;
|
||||
int num_mpts;
|
||||
int num_mtt_segs;
|
||||
int mtts_per_seg;
|
||||
int fmr_reserved_mtts;
|
||||
int reserved_mtts;
|
||||
int reserved_mrws;
|
||||
|
||||
@@ -165,6 +165,7 @@ enum {
|
||||
MLX4_WQE_CTRL_IP_CSUM = 1 << 4,
|
||||
MLX4_WQE_CTRL_TCP_UDP_CSUM = 1 << 5,
|
||||
MLX4_WQE_CTRL_INS_VLAN = 1 << 6,
|
||||
MLX4_WQE_CTRL_STRONG_ORDER = 1 << 7,
|
||||
};
|
||||
|
||||
struct mlx4_wqe_ctrl_seg {
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
|
||||
#include <linux/gfp.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/mmdebug.h>
|
||||
#include <linux/mmzone.h>
|
||||
#include <linux/rbtree.h>
|
||||
#include <linux/prio_tree.h>
|
||||
@@ -725,7 +724,7 @@ static inline int shmem_lock(struct file *file, int lock,
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
struct file *shmem_file_setup(char *name, loff_t size, unsigned long flags);
|
||||
struct file *shmem_file_setup(const char *name, loff_t size, unsigned long flags);
|
||||
|
||||
int shmem_zero_setup(struct vm_area_struct *);
|
||||
|
||||
@@ -793,6 +792,8 @@ int copy_page_range(struct mm_struct *dst, struct mm_struct *src,
|
||||
struct vm_area_struct *vma);
|
||||
void unmap_mapping_range(struct address_space *mapping,
|
||||
loff_t const holebegin, loff_t const holelen, int even_cows);
|
||||
int follow_pfn(struct vm_area_struct *vma, unsigned long address,
|
||||
unsigned long *pfn);
|
||||
int follow_phys(struct vm_area_struct *vma, unsigned long address,
|
||||
unsigned int flags, unsigned long *prot, resource_size_t *phys);
|
||||
int generic_access_phys(struct vm_area_struct *vma, unsigned long addr,
|
||||
@@ -824,8 +825,11 @@ static inline int handle_mm_fault(struct mm_struct *mm,
|
||||
extern int make_pages_present(unsigned long addr, unsigned long end);
|
||||
extern int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write);
|
||||
|
||||
int get_user_pages(struct task_struct *tsk, struct mm_struct *mm, unsigned long start,
|
||||
int len, int write, int force, struct page **pages, struct vm_area_struct **vmas);
|
||||
int get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
|
||||
unsigned long start, int len, int write, int force,
|
||||
struct page **pages, struct vm_area_struct **vmas);
|
||||
int get_user_pages_fast(unsigned long start, int nr_pages, int write,
|
||||
struct page **pages);
|
||||
|
||||
extern int try_to_release_page(struct page * page, gfp_t gfp_mask);
|
||||
extern void do_invalidatepage(struct page *page, unsigned long offset);
|
||||
@@ -849,19 +853,6 @@ extern int mprotect_fixup(struct vm_area_struct *vma,
|
||||
struct vm_area_struct **pprev, unsigned long start,
|
||||
unsigned long end, unsigned long newflags);
|
||||
|
||||
/*
|
||||
* get_user_pages_fast provides equivalent functionality to get_user_pages,
|
||||
* operating on current and current->mm (force=0 and doesn't return any vmas).
|
||||
*
|
||||
* get_user_pages_fast may take mmap_sem and page tables, so no assumptions
|
||||
* can be made about locking. get_user_pages_fast is to be implemented in a
|
||||
* way that is advantageous (vs get_user_pages()) when the user memory area is
|
||||
* already faulted in and present in ptes. However if the pages have to be
|
||||
* faulted in, it may turn out to be slightly slower).
|
||||
*/
|
||||
int get_user_pages_fast(unsigned long start, int nr_pages, int write,
|
||||
struct page **pages);
|
||||
|
||||
/*
|
||||
* doesn't attempt to fault and will return short.
|
||||
*/
|
||||
@@ -1067,7 +1058,8 @@ extern int __meminit __early_pfn_to_nid(unsigned long pfn);
|
||||
extern void set_dma_reserve(unsigned long new_dma_reserve);
|
||||
extern void memmap_init_zone(unsigned long, int, unsigned long,
|
||||
unsigned long, enum memmap_context);
|
||||
extern void setup_per_zone_pages_min(void);
|
||||
extern void setup_per_zone_wmarks(void);
|
||||
extern void calculate_zone_inactive_ratio(struct zone *zone);
|
||||
extern void mem_init(void);
|
||||
extern void __init mmap_init(void);
|
||||
extern void show_mem(void);
|
||||
@@ -1184,8 +1176,6 @@ void task_dirty_inc(struct task_struct *tsk);
|
||||
#define VM_MAX_READAHEAD 128 /* kbytes */
|
||||
#define VM_MIN_READAHEAD 16 /* kbytes (includes current page) */
|
||||
|
||||
int do_page_cache_readahead(struct address_space *mapping, struct file *filp,
|
||||
pgoff_t offset, unsigned long nr_to_read);
|
||||
int force_page_cache_readahead(struct address_space *mapping, struct file *filp,
|
||||
pgoff_t offset, unsigned long nr_to_read);
|
||||
|
||||
@@ -1203,6 +1193,9 @@ void page_cache_async_readahead(struct address_space *mapping,
|
||||
unsigned long size);
|
||||
|
||||
unsigned long max_sane_readahead(unsigned long nr);
|
||||
unsigned long ra_submit(struct file_ra_state *ra,
|
||||
struct address_space *mapping,
|
||||
struct file *filp);
|
||||
|
||||
/* Do stack extension */
|
||||
extern int expand_stack(struct vm_area_struct *vma, unsigned long address);
|
||||
|
||||
@@ -98,6 +98,14 @@ struct page {
|
||||
#ifdef CONFIG_WANT_PAGE_DEBUG_FLAGS
|
||||
unsigned long debug_flags; /* Use atomic bitops on this */
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_KMEMCHECK
|
||||
/*
|
||||
* kmemcheck wants to track the status of each byte in a page; this
|
||||
* is a pointer to such a status block. NULL if not tracked.
|
||||
*/
|
||||
void *shadow;
|
||||
#endif
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -232,6 +240,8 @@ struct mm_struct {
|
||||
|
||||
unsigned long saved_auxv[AT_VECTOR_SIZE]; /* for /proc/PID/auxv */
|
||||
|
||||
s8 oom_adj; /* OOM kill score adjustment (bit shift) */
|
||||
|
||||
cpumask_t cpu_vm_mask;
|
||||
|
||||
/* Architecture-specific MM context */
|
||||
|
||||
@@ -25,5 +25,15 @@
|
||||
|
||||
#define SDIO_VENDOR_ID_MARVELL 0x02df
|
||||
#define SDIO_DEVICE_ID_MARVELL_LIBERTAS 0x9103
|
||||
#define SDIO_DEVICE_ID_MARVELL_8688WLAN 0x9104
|
||||
#define SDIO_DEVICE_ID_MARVELL_8688BT 0x9105
|
||||
|
||||
#define SDIO_VENDOR_ID_SIANO 0x039a
|
||||
#define SDIO_DEVICE_ID_SIANO_NOVA_B0 0x0201
|
||||
#define SDIO_DEVICE_ID_SIANO_NICE 0x0202
|
||||
#define SDIO_DEVICE_ID_SIANO_VEGA_A0 0x0300
|
||||
#define SDIO_DEVICE_ID_SIANO_VENICE 0x0301
|
||||
#define SDIO_DEVICE_ID_SIANO_NOVA_A0 0x1100
|
||||
#define SDIO_DEVICE_ID_SIANO_STELLAR 0x5347
|
||||
|
||||
#endif
|
||||
|
||||
@@ -50,9 +50,6 @@ extern int page_group_by_mobility_disabled;
|
||||
|
||||
static inline int get_pageblock_migratetype(struct page *page)
|
||||
{
|
||||
if (unlikely(page_group_by_mobility_disabled))
|
||||
return MIGRATE_UNMOVABLE;
|
||||
|
||||
return get_pageblock_flags_group(page, PB_migrate, PB_migrate_end);
|
||||
}
|
||||
|
||||
@@ -86,13 +83,8 @@ enum zone_stat_item {
|
||||
NR_ACTIVE_ANON, /* " " " " " */
|
||||
NR_INACTIVE_FILE, /* " " " " " */
|
||||
NR_ACTIVE_FILE, /* " " " " " */
|
||||
#ifdef CONFIG_UNEVICTABLE_LRU
|
||||
NR_UNEVICTABLE, /* " " " " " */
|
||||
NR_MLOCK, /* mlock()ed pages found and moved off LRU */
|
||||
#else
|
||||
NR_UNEVICTABLE = NR_ACTIVE_FILE, /* avoid compiler errors in dead code */
|
||||
NR_MLOCK = NR_ACTIVE_FILE,
|
||||
#endif
|
||||
NR_ANON_PAGES, /* Mapped anonymous pages */
|
||||
NR_FILE_MAPPED, /* pagecache pages mapped into pagetables.
|
||||
only modified from process context */
|
||||
@@ -135,11 +127,7 @@ enum lru_list {
|
||||
LRU_ACTIVE_ANON = LRU_BASE + LRU_ACTIVE,
|
||||
LRU_INACTIVE_FILE = LRU_BASE + LRU_FILE,
|
||||
LRU_ACTIVE_FILE = LRU_BASE + LRU_FILE + LRU_ACTIVE,
|
||||
#ifdef CONFIG_UNEVICTABLE_LRU
|
||||
LRU_UNEVICTABLE,
|
||||
#else
|
||||
LRU_UNEVICTABLE = LRU_ACTIVE_FILE, /* avoid compiler errors in dead code */
|
||||
#endif
|
||||
NR_LRU_LISTS
|
||||
};
|
||||
|
||||
@@ -159,13 +147,20 @@ static inline int is_active_lru(enum lru_list l)
|
||||
|
||||
static inline int is_unevictable_lru(enum lru_list l)
|
||||
{
|
||||
#ifdef CONFIG_UNEVICTABLE_LRU
|
||||
return (l == LRU_UNEVICTABLE);
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
enum zone_watermarks {
|
||||
WMARK_MIN,
|
||||
WMARK_LOW,
|
||||
WMARK_HIGH,
|
||||
NR_WMARK
|
||||
};
|
||||
|
||||
#define min_wmark_pages(z) (z->watermark[WMARK_MIN])
|
||||
#define low_wmark_pages(z) (z->watermark[WMARK_LOW])
|
||||
#define high_wmark_pages(z) (z->watermark[WMARK_HIGH])
|
||||
|
||||
struct per_cpu_pages {
|
||||
int count; /* number of pages in the list */
|
||||
int high; /* high watermark, emptying needed */
|
||||
@@ -278,7 +273,10 @@ struct zone_reclaim_stat {
|
||||
|
||||
struct zone {
|
||||
/* Fields commonly accessed by the page allocator */
|
||||
unsigned long pages_min, pages_low, pages_high;
|
||||
|
||||
/* zone watermarks, access with *_wmark_pages(zone) macros */
|
||||
unsigned long watermark[NR_WMARK];
|
||||
|
||||
/*
|
||||
* We don't know if the memory that we're going to allocate will be freeable
|
||||
* or/and it will be released eventually, so to avoid totally wasting several
|
||||
@@ -323,9 +321,9 @@ struct zone {
|
||||
|
||||
/* Fields commonly accessed by the page reclaim scanner */
|
||||
spinlock_t lru_lock;
|
||||
struct {
|
||||
struct zone_lru {
|
||||
struct list_head list;
|
||||
unsigned long nr_scan;
|
||||
unsigned long nr_saved_scan; /* accumulated for batching */
|
||||
} lru[NR_LRU_LISTS];
|
||||
|
||||
struct zone_reclaim_stat reclaim_stat;
|
||||
|
||||
@@ -697,4 +697,21 @@ static inline void module_remove_modinfo_attrs(struct module *mod)
|
||||
|
||||
#define __MODULE_STRING(x) __stringify(x)
|
||||
|
||||
|
||||
#ifdef CONFIG_GENERIC_BUG
|
||||
int module_bug_finalize(const Elf_Ehdr *, const Elf_Shdr *,
|
||||
struct module *);
|
||||
void module_bug_cleanup(struct module *);
|
||||
|
||||
#else /* !CONFIG_GENERIC_BUG */
|
||||
|
||||
static inline int module_bug_finalize(const Elf_Ehdr *hdr,
|
||||
const Elf_Shdr *sechdrs,
|
||||
struct module *mod)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
static inline void module_bug_cleanup(struct module *mod) {}
|
||||
#endif /* CONFIG_GENERIC_BUG */
|
||||
|
||||
#endif /* _LINUX_MODULE_H */
|
||||
|
||||
@@ -3,12 +3,20 @@
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/netlink.h>
|
||||
#include <linux/types.h>
|
||||
|
||||
struct net_dm_drop_point {
|
||||
__u8 pc[8];
|
||||
__u32 count;
|
||||
};
|
||||
|
||||
#define is_drop_point_hw(x) do {\
|
||||
int ____i, ____j;\
|
||||
for (____i = 0; ____i < 8; i ____i++)\
|
||||
____j |= x[____i];\
|
||||
____j;\
|
||||
} while (0)
|
||||
|
||||
#define NET_DM_CFG_VERSION 0
|
||||
#define NET_DM_CFG_ALERT_COUNT 1
|
||||
#define NET_DM_CFG_ALERT_DELAY 2
|
||||
|
||||
@@ -39,9 +39,11 @@
|
||||
|
||||
#include <linux/device.h>
|
||||
#include <linux/percpu.h>
|
||||
#include <linux/rculist.h>
|
||||
#include <linux/dmaengine.h>
|
||||
#include <linux/workqueue.h>
|
||||
|
||||
#include <linux/ethtool.h>
|
||||
#include <net/net_namespace.h>
|
||||
#include <net/dsa.h>
|
||||
#ifdef CONFIG_DCB
|
||||
@@ -49,7 +51,6 @@
|
||||
#endif
|
||||
|
||||
struct vlan_group;
|
||||
struct ethtool_ops;
|
||||
struct netpoll_info;
|
||||
/* 802.11 specific */
|
||||
struct wireless_dev;
|
||||
@@ -210,6 +211,19 @@ struct dev_addr_list
|
||||
#define dmi_users da_users
|
||||
#define dmi_gusers da_gusers
|
||||
|
||||
struct netdev_hw_addr {
|
||||
struct list_head list;
|
||||
unsigned char addr[MAX_ADDR_LEN];
|
||||
unsigned char type;
|
||||
#define NETDEV_HW_ADDR_T_LAN 1
|
||||
#define NETDEV_HW_ADDR_T_SAN 2
|
||||
#define NETDEV_HW_ADDR_T_SLAVE 3
|
||||
#define NETDEV_HW_ADDR_T_UNICAST 4
|
||||
int refcount;
|
||||
bool synced;
|
||||
struct rcu_head rcu_head;
|
||||
};
|
||||
|
||||
struct hh_cache
|
||||
{
|
||||
struct hh_cache *hh_next; /* Next entry */
|
||||
@@ -447,12 +461,25 @@ enum netdev_queue_state_t
|
||||
};
|
||||
|
||||
struct netdev_queue {
|
||||
/*
|
||||
* read mostly part
|
||||
*/
|
||||
struct net_device *dev;
|
||||
struct Qdisc *qdisc;
|
||||
unsigned long state;
|
||||
spinlock_t _xmit_lock;
|
||||
int xmit_lock_owner;
|
||||
struct Qdisc *qdisc_sleeping;
|
||||
/*
|
||||
* write mostly part
|
||||
*/
|
||||
spinlock_t _xmit_lock ____cacheline_aligned_in_smp;
|
||||
int xmit_lock_owner;
|
||||
/*
|
||||
* please use this field instead of dev->trans_start
|
||||
*/
|
||||
unsigned long trans_start;
|
||||
unsigned long tx_bytes;
|
||||
unsigned long tx_packets;
|
||||
unsigned long tx_dropped;
|
||||
} ____cacheline_aligned_in_smp;
|
||||
|
||||
|
||||
@@ -670,7 +697,9 @@ struct net_device
|
||||
#define NETIF_F_GRO 16384 /* Generic receive offload */
|
||||
#define NETIF_F_LRO 32768 /* large receive offload */
|
||||
|
||||
/* the GSO_MASK reserves bits 16 through 23 */
|
||||
#define NETIF_F_FCOE_CRC (1 << 24) /* FCoE CRC32 */
|
||||
#define NETIF_F_SCTP_CSUM (1 << 25) /* SCTP checksum offload */
|
||||
|
||||
/* Segmentation offload features */
|
||||
#define NETIF_F_GSO_SHIFT 16
|
||||
@@ -747,10 +776,11 @@ struct net_device
|
||||
unsigned char addr_len; /* hardware address length */
|
||||
unsigned short dev_id; /* for shared network cards */
|
||||
|
||||
spinlock_t addr_list_lock;
|
||||
struct dev_addr_list *uc_list; /* Secondary unicast mac addresses */
|
||||
struct list_head uc_list; /* Secondary unicast mac
|
||||
addresses */
|
||||
int uc_count; /* Number of installed ucasts */
|
||||
int uc_promisc;
|
||||
spinlock_t addr_list_lock;
|
||||
struct dev_addr_list *mc_list; /* Multicast mac addresses */
|
||||
int mc_count; /* Number of installed mcasts */
|
||||
unsigned int promiscuity;
|
||||
@@ -776,8 +806,11 @@ struct net_device
|
||||
*/
|
||||
unsigned long last_rx; /* Time of last Rx */
|
||||
/* Interface address info used in eth_type_trans() */
|
||||
unsigned char dev_addr[MAX_ADDR_LEN]; /* hw address, (before bcast
|
||||
because most packets are unicast) */
|
||||
unsigned char *dev_addr; /* hw address, (before bcast
|
||||
because most packets are
|
||||
unicast) */
|
||||
|
||||
struct list_head dev_addr_list; /* list of device hw addresses */
|
||||
|
||||
unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */
|
||||
|
||||
@@ -797,6 +830,11 @@ struct net_device
|
||||
* One part is mostly used on xmit path (device)
|
||||
*/
|
||||
/* These may be needed for future network-power-down code. */
|
||||
|
||||
/*
|
||||
* trans_start here is expensive for high speed devices on SMP,
|
||||
* please use netdev_queue->trans_start instead.
|
||||
*/
|
||||
unsigned long trans_start; /* Time (in jiffies) of last Tx */
|
||||
|
||||
int watchdog_timeo; /* used by dev_watchdog() */
|
||||
@@ -867,49 +905,10 @@ struct net_device
|
||||
/* max exchange id for FCoE LRO by ddp */
|
||||
unsigned int fcoe_ddp_xid;
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_COMPAT_NET_DEV_OPS
|
||||
struct {
|
||||
int (*init)(struct net_device *dev);
|
||||
void (*uninit)(struct net_device *dev);
|
||||
int (*open)(struct net_device *dev);
|
||||
int (*stop)(struct net_device *dev);
|
||||
int (*hard_start_xmit) (struct sk_buff *skb,
|
||||
struct net_device *dev);
|
||||
u16 (*select_queue)(struct net_device *dev,
|
||||
struct sk_buff *skb);
|
||||
void (*change_rx_flags)(struct net_device *dev,
|
||||
int flags);
|
||||
void (*set_rx_mode)(struct net_device *dev);
|
||||
void (*set_multicast_list)(struct net_device *dev);
|
||||
int (*set_mac_address)(struct net_device *dev,
|
||||
void *addr);
|
||||
int (*validate_addr)(struct net_device *dev);
|
||||
int (*do_ioctl)(struct net_device *dev,
|
||||
struct ifreq *ifr, int cmd);
|
||||
int (*set_config)(struct net_device *dev,
|
||||
struct ifmap *map);
|
||||
int (*change_mtu)(struct net_device *dev, int new_mtu);
|
||||
int (*neigh_setup)(struct net_device *dev,
|
||||
struct neigh_parms *);
|
||||
void (*tx_timeout) (struct net_device *dev);
|
||||
struct net_device_stats* (*get_stats)(struct net_device *dev);
|
||||
void (*vlan_rx_register)(struct net_device *dev,
|
||||
struct vlan_group *grp);
|
||||
void (*vlan_rx_add_vid)(struct net_device *dev,
|
||||
unsigned short vid);
|
||||
void (*vlan_rx_kill_vid)(struct net_device *dev,
|
||||
unsigned short vid);
|
||||
#ifdef CONFIG_NET_POLL_CONTROLLER
|
||||
void (*poll_controller)(struct net_device *dev);
|
||||
#endif
|
||||
};
|
||||
#endif
|
||||
};
|
||||
#define to_net_dev(d) container_of(d, struct net_device, dev)
|
||||
|
||||
#define NETDEV_ALIGN 32
|
||||
#define NETDEV_ALIGN_CONST (NETDEV_ALIGN - 1)
|
||||
|
||||
static inline
|
||||
struct netdev_queue *netdev_get_tx_queue(const struct net_device *dev,
|
||||
@@ -980,9 +979,7 @@ static inline bool netdev_uses_trailer_tags(struct net_device *dev)
|
||||
*/
|
||||
static inline void *netdev_priv(const struct net_device *dev)
|
||||
{
|
||||
return (char *)dev + ((sizeof(struct net_device)
|
||||
+ NETDEV_ALIGN_CONST)
|
||||
& ~NETDEV_ALIGN_CONST);
|
||||
return (char *)dev + ALIGN(sizeof(struct net_device), NETDEV_ALIGN);
|
||||
}
|
||||
|
||||
/* Set the sysfs physical device reference for the network logical device
|
||||
@@ -1012,6 +1009,12 @@ void netif_napi_add(struct net_device *dev, struct napi_struct *napi,
|
||||
void netif_napi_del(struct napi_struct *napi);
|
||||
|
||||
struct napi_gro_cb {
|
||||
/* Virtual address of skb_shinfo(skb)->frags[0].page + offset. */
|
||||
void *frag0;
|
||||
|
||||
/* Length of frag0. */
|
||||
unsigned int frag0_len;
|
||||
|
||||
/* This indicates where we are processing relative to skb->data. */
|
||||
int data_offset;
|
||||
|
||||
@@ -1047,14 +1050,6 @@ struct packet_type {
|
||||
struct list_head list;
|
||||
};
|
||||
|
||||
struct napi_gro_fraginfo {
|
||||
skb_frag_t frags[MAX_SKB_FRAGS];
|
||||
unsigned int nr_frags;
|
||||
unsigned int ip_summed;
|
||||
unsigned int len;
|
||||
__wsum csum;
|
||||
};
|
||||
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/notifier.h>
|
||||
|
||||
@@ -1119,9 +1114,9 @@ extern int dev_restart(struct net_device *dev);
|
||||
#ifdef CONFIG_NETPOLL_TRAP
|
||||
extern int netpoll_trap(void);
|
||||
#endif
|
||||
extern void *skb_gro_header(struct sk_buff *skb, unsigned int hlen);
|
||||
extern int skb_gro_receive(struct sk_buff **head,
|
||||
struct sk_buff *skb);
|
||||
extern void skb_gro_reset_offset(struct sk_buff *skb);
|
||||
|
||||
static inline unsigned int skb_gro_offset(const struct sk_buff *skb)
|
||||
{
|
||||
@@ -1138,16 +1133,34 @@ static inline void skb_gro_pull(struct sk_buff *skb, unsigned int len)
|
||||
NAPI_GRO_CB(skb)->data_offset += len;
|
||||
}
|
||||
|
||||
static inline void skb_gro_reset_offset(struct sk_buff *skb)
|
||||
static inline void *skb_gro_header_fast(struct sk_buff *skb,
|
||||
unsigned int offset)
|
||||
{
|
||||
NAPI_GRO_CB(skb)->data_offset = 0;
|
||||
return NAPI_GRO_CB(skb)->frag0 + offset;
|
||||
}
|
||||
|
||||
static inline int skb_gro_header_hard(struct sk_buff *skb, unsigned int hlen)
|
||||
{
|
||||
return NAPI_GRO_CB(skb)->frag0_len < hlen;
|
||||
}
|
||||
|
||||
static inline void *skb_gro_header_slow(struct sk_buff *skb, unsigned int hlen,
|
||||
unsigned int offset)
|
||||
{
|
||||
NAPI_GRO_CB(skb)->frag0 = NULL;
|
||||
NAPI_GRO_CB(skb)->frag0_len = 0;
|
||||
return pskb_may_pull(skb, hlen) ? skb->data + offset : NULL;
|
||||
}
|
||||
|
||||
static inline void *skb_gro_mac_header(struct sk_buff *skb)
|
||||
{
|
||||
return skb_mac_header(skb) < skb->data ? skb_mac_header(skb) :
|
||||
page_address(skb_shinfo(skb)->frags[0].page) +
|
||||
skb_shinfo(skb)->frags[0].page_offset;
|
||||
return NAPI_GRO_CB(skb)->frag0 ?: skb_mac_header(skb);
|
||||
}
|
||||
|
||||
static inline void *skb_gro_network_header(struct sk_buff *skb)
|
||||
{
|
||||
return (NAPI_GRO_CB(skb)->frag0 ?: skb->data) +
|
||||
skb_network_offset(skb);
|
||||
}
|
||||
|
||||
static inline int dev_hard_header(struct sk_buff *skb, struct net_device *dev,
|
||||
@@ -1442,12 +1455,18 @@ extern int napi_gro_receive(struct napi_struct *napi,
|
||||
struct sk_buff *skb);
|
||||
extern void napi_reuse_skb(struct napi_struct *napi,
|
||||
struct sk_buff *skb);
|
||||
extern struct sk_buff * napi_fraginfo_skb(struct napi_struct *napi,
|
||||
struct napi_gro_fraginfo *info);
|
||||
extern struct sk_buff * napi_get_frags(struct napi_struct *napi);
|
||||
extern int napi_frags_finish(struct napi_struct *napi,
|
||||
struct sk_buff *skb, int ret);
|
||||
extern int napi_gro_frags(struct napi_struct *napi,
|
||||
struct napi_gro_fraginfo *info);
|
||||
extern struct sk_buff * napi_frags_skb(struct napi_struct *napi);
|
||||
extern int napi_gro_frags(struct napi_struct *napi);
|
||||
|
||||
static inline void napi_free_frags(struct napi_struct *napi)
|
||||
{
|
||||
kfree_skb(napi->skb);
|
||||
napi->skb = NULL;
|
||||
}
|
||||
|
||||
extern void netif_nit_deliver(struct sk_buff *skb);
|
||||
extern int dev_valid_name(const char *name);
|
||||
extern int dev_ioctl(struct net *net, unsigned int cmd, void __user *);
|
||||
@@ -1514,6 +1533,8 @@ static inline int netif_carrier_ok(const struct net_device *dev)
|
||||
return !test_bit(__LINK_STATE_NOCARRIER, &dev->state);
|
||||
}
|
||||
|
||||
extern unsigned long dev_trans_start(struct net_device *dev);
|
||||
|
||||
extern void __netdev_watchdog_up(struct net_device *dev);
|
||||
|
||||
extern void netif_carrier_on(struct net_device *dev);
|
||||
@@ -1671,6 +1692,12 @@ static inline void __netif_tx_unlock_bh(struct netdev_queue *txq)
|
||||
spin_unlock_bh(&txq->_xmit_lock);
|
||||
}
|
||||
|
||||
static inline void txq_trans_update(struct netdev_queue *txq)
|
||||
{
|
||||
if (txq->xmit_lock_owner != -1)
|
||||
txq->trans_start = jiffies;
|
||||
}
|
||||
|
||||
/**
|
||||
* netif_tx_lock - grab network device transmit lock
|
||||
* @dev: network device
|
||||
@@ -1778,6 +1805,13 @@ static inline void netif_addr_unlock_bh(struct net_device *dev)
|
||||
spin_unlock_bh(&dev->addr_list_lock);
|
||||
}
|
||||
|
||||
/*
|
||||
* dev_addr_list walker. Should be used only for read access. Call with
|
||||
* rcu_read_lock held.
|
||||
*/
|
||||
#define for_each_dev_addr(dev, ha) \
|
||||
list_for_each_entry_rcu(ha, &dev->dev_addr_list, list)
|
||||
|
||||
/* These functions live elsewhere (drivers/net/net_init.c, but related) */
|
||||
|
||||
extern void ether_setup(struct net_device *dev);
|
||||
@@ -1790,11 +1824,24 @@ extern struct net_device *alloc_netdev_mq(int sizeof_priv, const char *name,
|
||||
alloc_netdev_mq(sizeof_priv, name, setup, 1)
|
||||
extern int register_netdev(struct net_device *dev);
|
||||
extern void unregister_netdev(struct net_device *dev);
|
||||
|
||||
/* Functions used for device addresses handling */
|
||||
extern int dev_addr_add(struct net_device *dev, unsigned char *addr,
|
||||
unsigned char addr_type);
|
||||
extern int dev_addr_del(struct net_device *dev, unsigned char *addr,
|
||||
unsigned char addr_type);
|
||||
extern int dev_addr_add_multiple(struct net_device *to_dev,
|
||||
struct net_device *from_dev,
|
||||
unsigned char addr_type);
|
||||
extern int dev_addr_del_multiple(struct net_device *to_dev,
|
||||
struct net_device *from_dev,
|
||||
unsigned char addr_type);
|
||||
|
||||
/* Functions used for secondary unicast and multicast support */
|
||||
extern void dev_set_rx_mode(struct net_device *dev);
|
||||
extern void __dev_set_rx_mode(struct net_device *dev);
|
||||
extern int dev_unicast_delete(struct net_device *dev, void *addr, int alen);
|
||||
extern int dev_unicast_add(struct net_device *dev, void *addr, int alen);
|
||||
extern int dev_unicast_delete(struct net_device *dev, void *addr);
|
||||
extern int dev_unicast_add(struct net_device *dev, void *addr);
|
||||
extern int dev_unicast_sync(struct net_device *to, struct net_device *from);
|
||||
extern void dev_unicast_unsync(struct net_device *to, struct net_device *from);
|
||||
extern int dev_mc_delete(struct net_device *dev, void *addr, int alen, int all);
|
||||
@@ -1856,15 +1903,14 @@ static inline int net_gso_ok(int features, int gso_type)
|
||||
|
||||
static inline int skb_gso_ok(struct sk_buff *skb, int features)
|
||||
{
|
||||
return net_gso_ok(features, skb_shinfo(skb)->gso_type);
|
||||
return net_gso_ok(features, skb_shinfo(skb)->gso_type) &&
|
||||
(!skb_has_frags(skb) || (features & NETIF_F_FRAGLIST));
|
||||
}
|
||||
|
||||
static inline int netif_needs_gso(struct net_device *dev, struct sk_buff *skb)
|
||||
{
|
||||
return skb_is_gso(skb) &&
|
||||
(!skb_gso_ok(skb, dev->features) ||
|
||||
(skb_shinfo(skb)->frag_list &&
|
||||
!(dev->features & NETIF_F_FRAGLIST)) ||
|
||||
unlikely(skb->ip_summed != CHECKSUM_PARTIAL));
|
||||
}
|
||||
|
||||
@@ -1874,6 +1920,16 @@ static inline void netif_set_gso_max_size(struct net_device *dev,
|
||||
dev->gso_max_size = size;
|
||||
}
|
||||
|
||||
static inline void skb_bond_set_mac_by_master(struct sk_buff *skb,
|
||||
struct net_device *master)
|
||||
{
|
||||
if (skb->pkt_type == PACKET_HOST) {
|
||||
u16 *dest = (u16 *) eth_hdr(skb)->h_dest;
|
||||
|
||||
memcpy(dest, master->dev_addr, ETH_ALEN);
|
||||
}
|
||||
}
|
||||
|
||||
/* On bonding slaves other than the currently active slave, suppress
|
||||
* duplicates except for 802.3ad ETH_P_SLOW, alb non-mcast/bcast, and
|
||||
* ARP on active-backup slaves with arp_validate enabled.
|
||||
@@ -1887,6 +1943,14 @@ static inline int skb_bond_should_drop(struct sk_buff *skb)
|
||||
if (master->priv_flags & IFF_MASTER_ARPMON)
|
||||
dev->last_rx = jiffies;
|
||||
|
||||
if ((master->priv_flags & IFF_MASTER_ALB) && master->br_port) {
|
||||
/* Do address unmangle. The local destination address
|
||||
* will be always the one master has. Provides the right
|
||||
* functionality in a bridge.
|
||||
*/
|
||||
skb_bond_set_mac_by_master(skb, master);
|
||||
}
|
||||
|
||||
if (dev->priv_flags & IFF_SLAVE_INACTIVE) {
|
||||
if ((dev->priv_flags & IFF_SLAVE_NEEDARP) &&
|
||||
skb->protocol == __cpu_to_be16(ETH_P_ARP))
|
||||
@@ -1908,6 +1972,28 @@ static inline int skb_bond_should_drop(struct sk_buff *skb)
|
||||
}
|
||||
|
||||
extern struct pernet_operations __net_initdata loopback_net_ops;
|
||||
|
||||
static inline int dev_ethtool_get_settings(struct net_device *dev,
|
||||
struct ethtool_cmd *cmd)
|
||||
{
|
||||
if (!dev->ethtool_ops || !dev->ethtool_ops->get_settings)
|
||||
return -EOPNOTSUPP;
|
||||
return dev->ethtool_ops->get_settings(dev, cmd);
|
||||
}
|
||||
|
||||
static inline u32 dev_ethtool_get_rx_csum(struct net_device *dev)
|
||||
{
|
||||
if (!dev->ethtool_ops || !dev->ethtool_ops->get_rx_csum)
|
||||
return 0;
|
||||
return dev->ethtool_ops->get_rx_csum(dev);
|
||||
}
|
||||
|
||||
static inline u32 dev_ethtool_get_flags(struct net_device *dev)
|
||||
{
|
||||
if (!dev->ethtool_ops || !dev->ethtool_ops->get_flags)
|
||||
return 0;
|
||||
return dev->ethtool_ops->get_flags(dev);
|
||||
}
|
||||
#endif /* __KERNEL__ */
|
||||
|
||||
#endif /* _LINUX_DEV_H */
|
||||
#endif /* _LINUX_NETDEVICE_H */
|
||||
|
||||
@@ -33,6 +33,7 @@ header-y += xt_limit.h
|
||||
header-y += xt_mac.h
|
||||
header-y += xt_mark.h
|
||||
header-y += xt_multiport.h
|
||||
header-y += xt_osf.h
|
||||
header-y += xt_owner.h
|
||||
header-y += xt_pkttype.h
|
||||
header-y += xt_quota.h
|
||||
|
||||
@@ -75,75 +75,6 @@ enum ip_conntrack_status {
|
||||
IPS_FIXED_TIMEOUT = (1 << IPS_FIXED_TIMEOUT_BIT),
|
||||
};
|
||||
|
||||
/* Connection tracking event bits */
|
||||
enum ip_conntrack_events
|
||||
{
|
||||
/* New conntrack */
|
||||
IPCT_NEW_BIT = 0,
|
||||
IPCT_NEW = (1 << IPCT_NEW_BIT),
|
||||
|
||||
/* Expected connection */
|
||||
IPCT_RELATED_BIT = 1,
|
||||
IPCT_RELATED = (1 << IPCT_RELATED_BIT),
|
||||
|
||||
/* Destroyed conntrack */
|
||||
IPCT_DESTROY_BIT = 2,
|
||||
IPCT_DESTROY = (1 << IPCT_DESTROY_BIT),
|
||||
|
||||
/* Timer has been refreshed */
|
||||
IPCT_REFRESH_BIT = 3,
|
||||
IPCT_REFRESH = (1 << IPCT_REFRESH_BIT),
|
||||
|
||||
/* Status has changed */
|
||||
IPCT_STATUS_BIT = 4,
|
||||
IPCT_STATUS = (1 << IPCT_STATUS_BIT),
|
||||
|
||||
/* Update of protocol info */
|
||||
IPCT_PROTOINFO_BIT = 5,
|
||||
IPCT_PROTOINFO = (1 << IPCT_PROTOINFO_BIT),
|
||||
|
||||
/* Volatile protocol info */
|
||||
IPCT_PROTOINFO_VOLATILE_BIT = 6,
|
||||
IPCT_PROTOINFO_VOLATILE = (1 << IPCT_PROTOINFO_VOLATILE_BIT),
|
||||
|
||||
/* New helper for conntrack */
|
||||
IPCT_HELPER_BIT = 7,
|
||||
IPCT_HELPER = (1 << IPCT_HELPER_BIT),
|
||||
|
||||
/* Update of helper info */
|
||||
IPCT_HELPINFO_BIT = 8,
|
||||
IPCT_HELPINFO = (1 << IPCT_HELPINFO_BIT),
|
||||
|
||||
/* Volatile helper info */
|
||||
IPCT_HELPINFO_VOLATILE_BIT = 9,
|
||||
IPCT_HELPINFO_VOLATILE = (1 << IPCT_HELPINFO_VOLATILE_BIT),
|
||||
|
||||
/* NAT info */
|
||||
IPCT_NATINFO_BIT = 10,
|
||||
IPCT_NATINFO = (1 << IPCT_NATINFO_BIT),
|
||||
|
||||
/* Counter highest bit has been set, unused */
|
||||
IPCT_COUNTER_FILLING_BIT = 11,
|
||||
IPCT_COUNTER_FILLING = (1 << IPCT_COUNTER_FILLING_BIT),
|
||||
|
||||
/* Mark is set */
|
||||
IPCT_MARK_BIT = 12,
|
||||
IPCT_MARK = (1 << IPCT_MARK_BIT),
|
||||
|
||||
/* NAT sequence adjustment */
|
||||
IPCT_NATSEQADJ_BIT = 13,
|
||||
IPCT_NATSEQADJ = (1 << IPCT_NATSEQADJ_BIT),
|
||||
|
||||
/* Secmark is set */
|
||||
IPCT_SECMARK_BIT = 14,
|
||||
IPCT_SECMARK = (1 << IPCT_SECMARK_BIT),
|
||||
};
|
||||
|
||||
enum ip_conntrack_expect_events {
|
||||
IPEXP_NEW_BIT = 0,
|
||||
IPEXP_NEW = (1 << IPEXP_NEW_BIT),
|
||||
};
|
||||
|
||||
#ifdef __KERNEL__
|
||||
struct ip_conntrack_stat
|
||||
{
|
||||
|
||||
@@ -15,7 +15,8 @@ enum tcp_conntrack {
|
||||
TCP_CONNTRACK_LAST_ACK,
|
||||
TCP_CONNTRACK_TIME_WAIT,
|
||||
TCP_CONNTRACK_CLOSE,
|
||||
TCP_CONNTRACK_LISTEN,
|
||||
TCP_CONNTRACK_LISTEN, /* obsolete */
|
||||
#define TCP_CONNTRACK_SYN_SENT2 TCP_CONNTRACK_LISTEN
|
||||
TCP_CONNTRACK_MAX,
|
||||
TCP_CONNTRACK_IGNORE
|
||||
};
|
||||
|
||||
@@ -46,7 +46,8 @@ struct nfgenmsg {
|
||||
#define NFNL_SUBSYS_CTNETLINK_EXP 2
|
||||
#define NFNL_SUBSYS_QUEUE 3
|
||||
#define NFNL_SUBSYS_ULOG 4
|
||||
#define NFNL_SUBSYS_COUNT 5
|
||||
#define NFNL_SUBSYS_OSF 5
|
||||
#define NFNL_SUBSYS_COUNT 6
|
||||
|
||||
#ifdef __KERNEL__
|
||||
|
||||
@@ -75,7 +76,7 @@ extern int nfnetlink_subsys_unregister(const struct nfnetlink_subsystem *n);
|
||||
|
||||
extern int nfnetlink_has_listeners(unsigned int group);
|
||||
extern int nfnetlink_send(struct sk_buff *skb, u32 pid, unsigned group,
|
||||
int echo);
|
||||
int echo, gfp_t flags);
|
||||
extern void nfnetlink_set_err(u32 pid, u32 group, int error);
|
||||
extern int nfnetlink_unicast(struct sk_buff *skb, u_int32_t pid, int flags);
|
||||
|
||||
|
||||
@@ -101,6 +101,7 @@ enum ctattr_protoinfo_dccp {
|
||||
CTA_PROTOINFO_DCCP_UNSPEC,
|
||||
CTA_PROTOINFO_DCCP_STATE,
|
||||
CTA_PROTOINFO_DCCP_ROLE,
|
||||
CTA_PROTOINFO_DCCP_HANDSHAKE_SEQ,
|
||||
__CTA_PROTOINFO_DCCP_MAX,
|
||||
};
|
||||
#define CTA_PROTOINFO_DCCP_MAX (__CTA_PROTOINFO_DCCP_MAX - 1)
|
||||
|
||||
@@ -184,9 +184,10 @@ struct xt_counters_info
|
||||
* @matchinfo: per-match data
|
||||
* @fragoff: packet is a fragment, this is the data offset
|
||||
* @thoff: position of transport header relative to skb->data
|
||||
* @hotdrop: drop packet if we had inspection problems
|
||||
* @hook: hook number given packet came from
|
||||
* @family: Actual NFPROTO_* through which the function is invoked
|
||||
* (helpful when match->family == NFPROTO_UNSPEC)
|
||||
* @hotdrop: drop packet if we had inspection problems
|
||||
*/
|
||||
struct xt_match_param {
|
||||
const struct net_device *in, *out;
|
||||
@@ -194,8 +195,9 @@ struct xt_match_param {
|
||||
const void *matchinfo;
|
||||
int fragoff;
|
||||
unsigned int thoff;
|
||||
bool *hotdrop;
|
||||
unsigned int hooknum;
|
||||
u_int8_t family;
|
||||
bool *hotdrop;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -15,4 +15,9 @@ struct xt_NFQ_info {
|
||||
__u16 queuenum;
|
||||
};
|
||||
|
||||
struct xt_NFQ_info_v1 {
|
||||
__u16 queuenum;
|
||||
__u16 queues_total;
|
||||
};
|
||||
|
||||
#endif /* _XT_NFQ_TARGET_H */
|
||||
|
||||
133
include/linux/netfilter/xt_osf.h
Normal file
133
include/linux/netfilter/xt_osf.h
Normal file
@@ -0,0 +1,133 @@
|
||||
/*
|
||||
* Copyright (c) 2003+ Evgeniy Polyakov <johnpol@2ka.mxt.ru>
|
||||
*
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef _XT_OSF_H
|
||||
#define _XT_OSF_H
|
||||
|
||||
#define MAXGENRELEN 32
|
||||
|
||||
#define XT_OSF_GENRE (1<<0)
|
||||
#define XT_OSF_TTL (1<<1)
|
||||
#define XT_OSF_LOG (1<<2)
|
||||
#define XT_OSF_INVERT (1<<3)
|
||||
|
||||
#define XT_OSF_LOGLEVEL_ALL 0 /* log all matched fingerprints */
|
||||
#define XT_OSF_LOGLEVEL_FIRST 1 /* log only the first matced fingerprint */
|
||||
#define XT_OSF_LOGLEVEL_ALL_KNOWN 2 /* do not log unknown packets */
|
||||
|
||||
#define XT_OSF_TTL_TRUE 0 /* True ip and fingerprint TTL comparison */
|
||||
#define XT_OSF_TTL_LESS 1 /* Check if ip TTL is less than fingerprint one */
|
||||
#define XT_OSF_TTL_NOCHECK 2 /* Do not compare ip and fingerprint TTL at all */
|
||||
|
||||
struct xt_osf_info {
|
||||
char genre[MAXGENRELEN];
|
||||
__u32 len;
|
||||
__u32 flags;
|
||||
__u32 loglevel;
|
||||
__u32 ttl;
|
||||
};
|
||||
|
||||
/*
|
||||
* Wildcard MSS (kind of).
|
||||
* It is used to implement a state machine for the different wildcard values
|
||||
* of the MSS and window sizes.
|
||||
*/
|
||||
struct xt_osf_wc {
|
||||
__u32 wc;
|
||||
__u32 val;
|
||||
};
|
||||
|
||||
/*
|
||||
* This struct represents IANA options
|
||||
* http://www.iana.org/assignments/tcp-parameters
|
||||
*/
|
||||
struct xt_osf_opt {
|
||||
__u16 kind, length;
|
||||
struct xt_osf_wc wc;
|
||||
};
|
||||
|
||||
struct xt_osf_user_finger {
|
||||
struct xt_osf_wc wss;
|
||||
|
||||
__u8 ttl, df;
|
||||
__u16 ss, mss;
|
||||
__u16 opt_num;
|
||||
|
||||
char genre[MAXGENRELEN];
|
||||
char version[MAXGENRELEN];
|
||||
char subtype[MAXGENRELEN];
|
||||
|
||||
/* MAX_IPOPTLEN is maximum if all options are NOPs or EOLs */
|
||||
struct xt_osf_opt opt[MAX_IPOPTLEN];
|
||||
};
|
||||
|
||||
struct xt_osf_nlmsg {
|
||||
struct xt_osf_user_finger f;
|
||||
struct iphdr ip;
|
||||
struct tcphdr tcp;
|
||||
};
|
||||
|
||||
/* Defines for IANA option kinds */
|
||||
|
||||
enum iana_options {
|
||||
OSFOPT_EOL = 0, /* End of options */
|
||||
OSFOPT_NOP, /* NOP */
|
||||
OSFOPT_MSS, /* Maximum segment size */
|
||||
OSFOPT_WSO, /* Window scale option */
|
||||
OSFOPT_SACKP, /* SACK permitted */
|
||||
OSFOPT_SACK, /* SACK */
|
||||
OSFOPT_ECHO,
|
||||
OSFOPT_ECHOREPLY,
|
||||
OSFOPT_TS, /* Timestamp option */
|
||||
OSFOPT_POCP, /* Partial Order Connection Permitted */
|
||||
OSFOPT_POSP, /* Partial Order Service Profile */
|
||||
|
||||
/* Others are not used in the current OSF */
|
||||
OSFOPT_EMPTY = 255,
|
||||
};
|
||||
|
||||
/*
|
||||
* Initial window size option state machine: multiple of mss, mtu or
|
||||
* plain numeric value. Can also be made as plain numeric value which
|
||||
* is not a multiple of specified value.
|
||||
*/
|
||||
enum xt_osf_window_size_options {
|
||||
OSF_WSS_PLAIN = 0,
|
||||
OSF_WSS_MSS,
|
||||
OSF_WSS_MTU,
|
||||
OSF_WSS_MODULO,
|
||||
OSF_WSS_MAX,
|
||||
};
|
||||
|
||||
/*
|
||||
* Add/remove fingerprint from the kernel.
|
||||
*/
|
||||
enum xt_osf_msg_types {
|
||||
OSF_MSG_ADD,
|
||||
OSF_MSG_REMOVE,
|
||||
OSF_MSG_MAX,
|
||||
};
|
||||
|
||||
enum xt_osf_attr_type {
|
||||
OSF_ATTR_UNSPEC,
|
||||
OSF_ATTR_FINGER,
|
||||
OSF_ATTR_MAX,
|
||||
};
|
||||
|
||||
#endif /* _XT_OSF_H */
|
||||
12
include/linux/netfilter/xt_socket.h
Normal file
12
include/linux/netfilter/xt_socket.h
Normal file
@@ -0,0 +1,12 @@
|
||||
#ifndef _XT_SOCKET_H
|
||||
#define _XT_SOCKET_H
|
||||
|
||||
enum {
|
||||
XT_SOCKET_TRANSPARENT = 1 << 0,
|
||||
};
|
||||
|
||||
struct xt_socket_mtinfo1 {
|
||||
__u8 flags;
|
||||
};
|
||||
|
||||
#endif /* _XT_SOCKET_H */
|
||||
@@ -7,7 +7,7 @@
|
||||
* Copyright 2008 Michael Wu <flamingice@sourmilk.net>
|
||||
* Copyright 2008 Luis Carlos Cobo <luisca@cozybit.com>
|
||||
* Copyright 2008 Michael Buesch <mb@bu3sch.de>
|
||||
* Copyright 2008 Luis R. Rodriguez <lrodriguez@atheros.com>
|
||||
* Copyright 2008, 2009 Luis R. Rodriguez <lrodriguez@atheros.com>
|
||||
* Copyright 2008 Jouni Malinen <jouni.malinen@atheros.com>
|
||||
* Copyright 2008 Colin McCabe <colin@cozybit.com>
|
||||
*
|
||||
@@ -25,6 +25,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
/**
|
||||
* DOC: Station handling
|
||||
*
|
||||
@@ -46,8 +48,10 @@
|
||||
* to get a list of all present wiphys.
|
||||
* @NL80211_CMD_SET_WIPHY: set wiphy parameters, needs %NL80211_ATTR_WIPHY or
|
||||
* %NL80211_ATTR_IFINDEX; can be used to set %NL80211_ATTR_WIPHY_NAME,
|
||||
* %NL80211_ATTR_WIPHY_TXQ_PARAMS, %NL80211_ATTR_WIPHY_FREQ, and/or
|
||||
* %NL80211_ATTR_WIPHY_CHANNEL_TYPE.
|
||||
* %NL80211_ATTR_WIPHY_TXQ_PARAMS, %NL80211_ATTR_WIPHY_FREQ,
|
||||
* %NL80211_ATTR_WIPHY_CHANNEL_TYPE, %NL80211_ATTR_WIPHY_RETRY_SHORT,
|
||||
* %NL80211_ATTR_WIPHY_RETRY_LONG, %NL80211_ATTR_WIPHY_FRAG_THRESHOLD,
|
||||
* and/or %NL80211_ATTR_WIPHY_RTS_THRESHOLD.
|
||||
* @NL80211_CMD_NEW_WIPHY: Newly created wiphy, response to get request
|
||||
* or rename notification. Has attributes %NL80211_ATTR_WIPHY and
|
||||
* %NL80211_ATTR_WIPHY_NAME.
|
||||
@@ -75,8 +79,8 @@
|
||||
* @NL80211_CMD_SET_KEY: Set key attributes %NL80211_ATTR_KEY_DEFAULT,
|
||||
* %NL80211_ATTR_KEY_DEFAULT_MGMT, or %NL80211_ATTR_KEY_THRESHOLD.
|
||||
* @NL80211_CMD_NEW_KEY: add a key with given %NL80211_ATTR_KEY_DATA,
|
||||
* %NL80211_ATTR_KEY_IDX, %NL80211_ATTR_MAC and %NL80211_ATTR_KEY_CIPHER
|
||||
* attributes.
|
||||
* %NL80211_ATTR_KEY_IDX, %NL80211_ATTR_MAC, %NL80211_ATTR_KEY_CIPHER,
|
||||
* and %NL80211_ATTR_KEY_SEQ attributes.
|
||||
* @NL80211_CMD_DEL_KEY: delete a key identified by %NL80211_ATTR_KEY_IDX
|
||||
* or %NL80211_ATTR_MAC.
|
||||
*
|
||||
@@ -166,6 +170,22 @@
|
||||
* set (%NL80211_ATTR_REG_TYPE), if the type of regulatory domain is
|
||||
* %NL80211_REG_TYPE_COUNTRY the alpha2 to which we have moved on
|
||||
* to (%NL80211_ATTR_REG_ALPHA2).
|
||||
* @NL80211_CMD_REG_BEACON_HINT: indicates to userspace that an AP beacon
|
||||
* has been found while world roaming thus enabling active scan or
|
||||
* any mode of operation that initiates TX (beacons) on a channel
|
||||
* where we would not have been able to do either before. As an example
|
||||
* if you are world roaming (regulatory domain set to world or if your
|
||||
* driver is using a custom world roaming regulatory domain) and while
|
||||
* doing a passive scan on the 5 GHz band you find an AP there (if not
|
||||
* on a DFS channel) you will now be able to actively scan for that AP
|
||||
* or use AP mode on your card on that same channel. Note that this will
|
||||
* never be used for channels 1-11 on the 2 GHz band as they are always
|
||||
* enabled world wide. This beacon hint is only sent if your device had
|
||||
* either disabled active scanning or beaconing on a channel. We send to
|
||||
* userspace the wiphy on which we removed a restriction from
|
||||
* (%NL80211_ATTR_WIPHY) and the channel on which this occurred
|
||||
* before (%NL80211_ATTR_FREQ_BEFORE) and after (%NL80211_ATTR_FREQ_AFTER)
|
||||
* the beacon hint was processed.
|
||||
*
|
||||
* @NL80211_CMD_AUTHENTICATE: authentication request and notification.
|
||||
* This command is used both as a command (request to authenticate) and
|
||||
@@ -185,8 +205,12 @@
|
||||
* frame, i.e., it was for the local STA and was received in correct
|
||||
* state. This is similar to MLME-AUTHENTICATE.confirm primitive in the
|
||||
* MLME SAP interface (kernel providing MLME, userspace SME). The
|
||||
* included NL80211_ATTR_FRAME attribute contains the management frame
|
||||
* (including both the header and frame body, but not FCS).
|
||||
* included %NL80211_ATTR_FRAME attribute contains the management frame
|
||||
* (including both the header and frame body, but not FCS). This event is
|
||||
* also used to indicate if the authentication attempt timed out. In that
|
||||
* case the %NL80211_ATTR_FRAME attribute is replaced with a
|
||||
* %NL80211_ATTR_TIMED_OUT flag (and %NL80211_ATTR_MAC to indicate which
|
||||
* pending authentication timed out).
|
||||
* @NL80211_CMD_ASSOCIATE: association request and notification; like
|
||||
* NL80211_CMD_AUTHENTICATE but for Association and Reassociation
|
||||
* (similar to MLME-ASSOCIATE.request, MLME-REASSOCIATE.request,
|
||||
@@ -199,6 +223,25 @@
|
||||
* NL80211_CMD_AUTHENTICATE but for Disassociation frames (similar to
|
||||
* MLME-DISASSOCIATE.request and MLME-DISASSOCIATE.indication primitives).
|
||||
*
|
||||
* @NL80211_CMD_MICHAEL_MIC_FAILURE: notification of a locally detected Michael
|
||||
* MIC (part of TKIP) failure; sent on the "mlme" multicast group; the
|
||||
* event includes %NL80211_ATTR_MAC to describe the source MAC address of
|
||||
* the frame with invalid MIC, %NL80211_ATTR_KEY_TYPE to show the key
|
||||
* type, %NL80211_ATTR_KEY_IDX to indicate the key identifier, and
|
||||
* %NL80211_ATTR_KEY_SEQ to indicate the TSC value of the frame; this
|
||||
* event matches with MLME-MICHAELMICFAILURE.indication() primitive
|
||||
*
|
||||
* @NL80211_CMD_JOIN_IBSS: Join a new IBSS -- given at least an SSID and a
|
||||
* FREQ attribute (for the initial frequency if no peer can be found)
|
||||
* and optionally a MAC (as BSSID) and FREQ_FIXED attribute if those
|
||||
* should be fixed rather than automatically determined. Can only be
|
||||
* executed on a network interface that is UP, and fixed BSSID/FREQ
|
||||
* may be rejected. Another optional parameter is the beacon interval,
|
||||
* given in the %NL80211_ATTR_BEACON_INTERVAL attribute, which if not
|
||||
* given defaults to 100 TU (102.4ms).
|
||||
* @NL80211_CMD_LEAVE_IBSS: Leave the IBSS -- no special arguments, the IBSS is
|
||||
* determined by the network interface.
|
||||
*
|
||||
* @NL80211_CMD_MAX: highest used command number
|
||||
* @__NL80211_CMD_AFTER_LAST: internal use
|
||||
*/
|
||||
@@ -260,6 +303,13 @@ enum nl80211_commands {
|
||||
NL80211_CMD_DEAUTHENTICATE,
|
||||
NL80211_CMD_DISASSOCIATE,
|
||||
|
||||
NL80211_CMD_MICHAEL_MIC_FAILURE,
|
||||
|
||||
NL80211_CMD_REG_BEACON_HINT,
|
||||
|
||||
NL80211_CMD_JOIN_IBSS,
|
||||
NL80211_CMD_LEAVE_IBSS,
|
||||
|
||||
/* add new commands above here */
|
||||
|
||||
/* used to define NL80211_CMD_MAX below */
|
||||
@@ -278,6 +328,7 @@ enum nl80211_commands {
|
||||
#define NL80211_CMD_ASSOCIATE NL80211_CMD_ASSOCIATE
|
||||
#define NL80211_CMD_DEAUTHENTICATE NL80211_CMD_DEAUTHENTICATE
|
||||
#define NL80211_CMD_DISASSOCIATE NL80211_CMD_DISASSOCIATE
|
||||
#define NL80211_CMD_REG_BEACON_HINT NL80211_CMD_REG_BEACON_HINT
|
||||
|
||||
/**
|
||||
* enum nl80211_attrs - nl80211 netlink attributes
|
||||
@@ -296,6 +347,18 @@ enum nl80211_commands {
|
||||
* NL80211_CHAN_HT20 = HT20 only
|
||||
* NL80211_CHAN_HT40MINUS = secondary channel is below the primary channel
|
||||
* NL80211_CHAN_HT40PLUS = secondary channel is above the primary channel
|
||||
* @NL80211_ATTR_WIPHY_RETRY_SHORT: TX retry limit for frames whose length is
|
||||
* less than or equal to the RTS threshold; allowed range: 1..255;
|
||||
* dot11ShortRetryLimit; u8
|
||||
* @NL80211_ATTR_WIPHY_RETRY_LONG: TX retry limit for frames whose length is
|
||||
* greater than the RTS threshold; allowed range: 1..255;
|
||||
* dot11ShortLongLimit; u8
|
||||
* @NL80211_ATTR_WIPHY_FRAG_THRESHOLD: fragmentation threshold, i.e., maximum
|
||||
* length in octets for frames; allowed range: 256..8000, disable
|
||||
* fragmentation with (u32)-1; dot11FragmentationThreshold; u32
|
||||
* @NL80211_ATTR_WIPHY_RTS_THRESHOLD: RTS threshold (TX frames with length
|
||||
* larger than or equal to this use RTS/CTS handshake); allowed range:
|
||||
* 0..65536, disable with (u32)-1; dot11RTSThreshold; u32
|
||||
*
|
||||
* @NL80211_ATTR_IFINDEX: network interface index of the device to operate on
|
||||
* @NL80211_ATTR_IFNAME: network interface name
|
||||
@@ -319,7 +382,7 @@ enum nl80211_commands {
|
||||
*
|
||||
* @NL80211_ATTR_STA_AID: Association ID for the station (u16)
|
||||
* @NL80211_ATTR_STA_FLAGS: flags, nested element with NLA_FLAG attributes of
|
||||
* &enum nl80211_sta_flags.
|
||||
* &enum nl80211_sta_flags (deprecated, use %NL80211_ATTR_STA_FLAGS2)
|
||||
* @NL80211_ATTR_STA_LISTEN_INTERVAL: listen interval as defined by
|
||||
* IEEE 802.11 7.3.1.6 (u16).
|
||||
* @NL80211_ATTR_STA_SUPPORTED_RATES: supported rates, array of supported
|
||||
@@ -380,6 +443,8 @@ enum nl80211_commands {
|
||||
*
|
||||
* @NL80211_ATTR_MAX_NUM_SCAN_SSIDS: number of SSIDs you can scan with
|
||||
* a single scan request, a wiphy attribute.
|
||||
* @NL80211_ATTR_MAX_SCAN_IE_LEN: maximum length of information elements
|
||||
* that can be added to a scan request
|
||||
*
|
||||
* @NL80211_ATTR_SCAN_FREQUENCIES: nested attribute with frequencies (in MHz)
|
||||
* @NL80211_ATTR_SCAN_SSIDS: nested attribute with SSIDs, leave out for passive
|
||||
@@ -408,6 +473,44 @@ enum nl80211_commands {
|
||||
* @NL80211_ATTR_REASON_CODE: ReasonCode for %NL80211_CMD_DEAUTHENTICATE and
|
||||
* %NL80211_CMD_DISASSOCIATE, u16
|
||||
*
|
||||
* @NL80211_ATTR_KEY_TYPE: Key Type, see &enum nl80211_key_type, represented as
|
||||
* a u32
|
||||
*
|
||||
* @NL80211_ATTR_FREQ_BEFORE: A channel which has suffered a regulatory change
|
||||
* due to considerations from a beacon hint. This attribute reflects
|
||||
* the state of the channel _before_ the beacon hint processing. This
|
||||
* attributes consists of a nested attribute containing
|
||||
* NL80211_FREQUENCY_ATTR_*
|
||||
* @NL80211_ATTR_FREQ_AFTER: A channel which has suffered a regulatory change
|
||||
* due to considerations from a beacon hint. This attribute reflects
|
||||
* the state of the channel _after_ the beacon hint processing. This
|
||||
* attributes consists of a nested attribute containing
|
||||
* NL80211_FREQUENCY_ATTR_*
|
||||
*
|
||||
* @NL80211_ATTR_CIPHER_SUITES: a set of u32 values indicating the supported
|
||||
* cipher suites
|
||||
*
|
||||
* @NL80211_ATTR_FREQ_FIXED: a flag indicating the IBSS should not try to look
|
||||
* for other networks on different channels
|
||||
*
|
||||
* @NL80211_ATTR_TIMED_OUT: a flag indicating than an operation timed out; this
|
||||
* is used, e.g., with %NL80211_CMD_AUTHENTICATE event
|
||||
*
|
||||
* @NL80211_ATTR_USE_MFP: Whether management frame protection (IEEE 802.11w) is
|
||||
* used for the association (&enum nl80211_mfp, represented as a u32);
|
||||
* this attribute can be used
|
||||
* with %NL80211_CMD_ASSOCIATE request
|
||||
*
|
||||
* @NL80211_ATTR_STA_FLAGS2: Attribute containing a
|
||||
* &struct nl80211_sta_flag_update.
|
||||
*
|
||||
* @NL80211_ATTR_CONTROL_PORT: A flag indicating whether user space controls
|
||||
* IEEE 802.1X port, i.e., sets/clears %NL80211_STA_FLAG_AUTHORIZED, in
|
||||
* station mode. If the flag is included in %NL80211_CMD_ASSOCIATE
|
||||
* request, the driver will assume that the port is unauthorized until
|
||||
* authorized by user space. Otherwise, port is marked authorized by
|
||||
* default in station mode.
|
||||
*
|
||||
* @NL80211_ATTR_MAX: highest attribute number currently defined
|
||||
* @__NL80211_ATTR_AFTER_LAST: internal use
|
||||
*/
|
||||
@@ -492,6 +595,30 @@ enum nl80211_attrs {
|
||||
NL80211_ATTR_AUTH_TYPE,
|
||||
NL80211_ATTR_REASON_CODE,
|
||||
|
||||
NL80211_ATTR_KEY_TYPE,
|
||||
|
||||
NL80211_ATTR_MAX_SCAN_IE_LEN,
|
||||
NL80211_ATTR_CIPHER_SUITES,
|
||||
|
||||
NL80211_ATTR_FREQ_BEFORE,
|
||||
NL80211_ATTR_FREQ_AFTER,
|
||||
|
||||
NL80211_ATTR_FREQ_FIXED,
|
||||
|
||||
|
||||
NL80211_ATTR_WIPHY_RETRY_SHORT,
|
||||
NL80211_ATTR_WIPHY_RETRY_LONG,
|
||||
NL80211_ATTR_WIPHY_FRAG_THRESHOLD,
|
||||
NL80211_ATTR_WIPHY_RTS_THRESHOLD,
|
||||
|
||||
NL80211_ATTR_TIMED_OUT,
|
||||
|
||||
NL80211_ATTR_USE_MFP,
|
||||
|
||||
NL80211_ATTR_STA_FLAGS2,
|
||||
|
||||
NL80211_ATTR_CONTROL_PORT,
|
||||
|
||||
/* add attributes here, update the policy in nl80211.c */
|
||||
|
||||
__NL80211_ATTR_AFTER_LAST,
|
||||
@@ -580,6 +707,18 @@ enum nl80211_sta_flags {
|
||||
NL80211_STA_FLAG_MAX = __NL80211_STA_FLAG_AFTER_LAST - 1
|
||||
};
|
||||
|
||||
/**
|
||||
* struct nl80211_sta_flag_update - station flags mask/set
|
||||
* @mask: mask of station flags to set
|
||||
* @set: which values to set them to
|
||||
*
|
||||
* Both mask and set contain bits as per &enum nl80211_sta_flags.
|
||||
*/
|
||||
struct nl80211_sta_flag_update {
|
||||
__u32 mask;
|
||||
__u32 set;
|
||||
} __attribute__((packed));
|
||||
|
||||
/**
|
||||
* enum nl80211_rate_info - bitrate information
|
||||
*
|
||||
@@ -1062,4 +1201,27 @@ enum nl80211_auth_type {
|
||||
NL80211_AUTHTYPE_FT,
|
||||
NL80211_AUTHTYPE_NETWORK_EAP,
|
||||
};
|
||||
|
||||
/**
|
||||
* enum nl80211_key_type - Key Type
|
||||
* @NL80211_KEYTYPE_GROUP: Group (broadcast/multicast) key
|
||||
* @NL80211_KEYTYPE_PAIRWISE: Pairwise (unicast/individual) key
|
||||
* @NL80211_KEYTYPE_PEERKEY: PeerKey (DLS)
|
||||
*/
|
||||
enum nl80211_key_type {
|
||||
NL80211_KEYTYPE_GROUP,
|
||||
NL80211_KEYTYPE_PAIRWISE,
|
||||
NL80211_KEYTYPE_PEERKEY,
|
||||
};
|
||||
|
||||
/**
|
||||
* enum nl80211_mfp - Management frame protection state
|
||||
* @NL80211_MFP_NO: Management frame protection not used
|
||||
* @NL80211_MFP_REQUIRED: Management frame protection required
|
||||
*/
|
||||
enum nl80211_mfp {
|
||||
NL80211_MFP_NO,
|
||||
NL80211_MFP_REQUIRED,
|
||||
};
|
||||
|
||||
#endif /* __LINUX_NL80211_H */
|
||||
|
||||
119
include/linux/nl802154.h
Normal file
119
include/linux/nl802154.h
Normal file
@@ -0,0 +1,119 @@
|
||||
/*
|
||||
* nl802154.h
|
||||
*
|
||||
* Copyright (C) 2007, 2008, 2009 Siemens AG
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* 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.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef NL802154_H
|
||||
#define NL802154_H
|
||||
|
||||
#define IEEE802154_NL_NAME "802.15.4 MAC"
|
||||
#define IEEE802154_MCAST_COORD_NAME "coordinator"
|
||||
#define IEEE802154_MCAST_BEACON_NAME "beacon"
|
||||
|
||||
enum {
|
||||
__IEEE802154_ATTR_INVALID,
|
||||
|
||||
IEEE802154_ATTR_DEV_NAME,
|
||||
IEEE802154_ATTR_DEV_INDEX,
|
||||
|
||||
IEEE802154_ATTR_STATUS,
|
||||
|
||||
IEEE802154_ATTR_SHORT_ADDR,
|
||||
IEEE802154_ATTR_HW_ADDR,
|
||||
IEEE802154_ATTR_PAN_ID,
|
||||
|
||||
IEEE802154_ATTR_CHANNEL,
|
||||
|
||||
IEEE802154_ATTR_COORD_SHORT_ADDR,
|
||||
IEEE802154_ATTR_COORD_HW_ADDR,
|
||||
IEEE802154_ATTR_COORD_PAN_ID,
|
||||
|
||||
IEEE802154_ATTR_SRC_SHORT_ADDR,
|
||||
IEEE802154_ATTR_SRC_HW_ADDR,
|
||||
IEEE802154_ATTR_SRC_PAN_ID,
|
||||
|
||||
IEEE802154_ATTR_DEST_SHORT_ADDR,
|
||||
IEEE802154_ATTR_DEST_HW_ADDR,
|
||||
IEEE802154_ATTR_DEST_PAN_ID,
|
||||
|
||||
IEEE802154_ATTR_CAPABILITY,
|
||||
IEEE802154_ATTR_REASON,
|
||||
IEEE802154_ATTR_SCAN_TYPE,
|
||||
IEEE802154_ATTR_CHANNELS,
|
||||
IEEE802154_ATTR_DURATION,
|
||||
IEEE802154_ATTR_ED_LIST,
|
||||
IEEE802154_ATTR_BCN_ORD,
|
||||
IEEE802154_ATTR_SF_ORD,
|
||||
IEEE802154_ATTR_PAN_COORD,
|
||||
IEEE802154_ATTR_BAT_EXT,
|
||||
IEEE802154_ATTR_COORD_REALIGN,
|
||||
IEEE802154_ATTR_SEC,
|
||||
|
||||
__IEEE802154_ATTR_MAX,
|
||||
};
|
||||
|
||||
#define IEEE802154_ATTR_MAX (__IEEE802154_ATTR_MAX - 1)
|
||||
|
||||
extern struct nla_policy ieee802154_policy[];
|
||||
|
||||
/* commands */
|
||||
/* REQ should be responded with CONF
|
||||
* and INDIC with RESP
|
||||
*/
|
||||
enum {
|
||||
__IEEE802154_COMMAND_INVALID,
|
||||
|
||||
IEEE802154_ASSOCIATE_REQ,
|
||||
IEEE802154_ASSOCIATE_CONF,
|
||||
IEEE802154_DISASSOCIATE_REQ,
|
||||
IEEE802154_DISASSOCIATE_CONF,
|
||||
IEEE802154_GET_REQ,
|
||||
IEEE802154_GET_CONF,
|
||||
IEEE802154_RESET_REQ,
|
||||
IEEE802154_RESET_CONF,
|
||||
IEEE802154_SCAN_REQ,
|
||||
IEEE802154_SCAN_CONF,
|
||||
IEEE802154_SET_REQ,
|
||||
IEEE802154_SET_CONF,
|
||||
IEEE802154_START_REQ,
|
||||
IEEE802154_START_CONF,
|
||||
IEEE802154_SYNC_REQ,
|
||||
IEEE802154_POLL_REQ,
|
||||
IEEE802154_POLL_CONF,
|
||||
|
||||
IEEE802154_ASSOCIATE_INDIC,
|
||||
IEEE802154_ASSOCIATE_RESP,
|
||||
IEEE802154_DISASSOCIATE_INDIC,
|
||||
IEEE802154_BEACON_NOTIFY_INDIC,
|
||||
IEEE802154_ORPHAN_INDIC,
|
||||
IEEE802154_ORPHAN_RESP,
|
||||
IEEE802154_COMM_STATUS_INDIC,
|
||||
IEEE802154_SYNC_LOSS_INDIC,
|
||||
|
||||
IEEE802154_GTS_REQ, /* Not supported yet */
|
||||
IEEE802154_GTS_INDIC, /* Not supported yet */
|
||||
IEEE802154_GTS_CONF, /* Not supported yet */
|
||||
IEEE802154_RX_ENABLE_REQ, /* Not supported yet */
|
||||
IEEE802154_RX_ENABLE_CONF, /* Not supported yet */
|
||||
|
||||
__IEEE802154_CMD_MAX,
|
||||
};
|
||||
|
||||
#define IEEE802154_CMD_MAX (__IEEE802154_CMD_MAX - 1)
|
||||
|
||||
#endif
|
||||
@@ -3,8 +3,23 @@
|
||||
|
||||
#include <linux/init.h>
|
||||
|
||||
/* unicode character */
|
||||
typedef __u16 wchar_t;
|
||||
/* Unicode has changed over the years. Unicode code points no longer
|
||||
* fit into 16 bits; as of Unicode 5 valid code points range from 0
|
||||
* to 0x10ffff (17 planes, where each plane holds 65536 code points).
|
||||
*
|
||||
* The original decision to represent Unicode characters as 16-bit
|
||||
* wchar_t values is now outdated. But plane 0 still includes the
|
||||
* most commonly used characters, so we will retain it. The newer
|
||||
* 32-bit unicode_t type can be used when it is necessary to
|
||||
* represent the full Unicode character set.
|
||||
*/
|
||||
|
||||
/* Plane-0 Unicode character */
|
||||
typedef u16 wchar_t;
|
||||
#define MAX_WCHAR_T 0xffff
|
||||
|
||||
/* Arbitrary Unicode character */
|
||||
typedef u32 unicode_t;
|
||||
|
||||
struct nls_table {
|
||||
const char *charset;
|
||||
@@ -21,6 +36,13 @@ struct nls_table {
|
||||
/* this value hold the maximum octet of charset */
|
||||
#define NLS_MAX_CHARSET_SIZE 6 /* for UTF-8 */
|
||||
|
||||
/* Byte order for UTF-16 strings */
|
||||
enum utf16_endian {
|
||||
UTF16_HOST_ENDIAN,
|
||||
UTF16_LITTLE_ENDIAN,
|
||||
UTF16_BIG_ENDIAN
|
||||
};
|
||||
|
||||
/* nls.c */
|
||||
extern int register_nls(struct nls_table *);
|
||||
extern int unregister_nls(struct nls_table *);
|
||||
@@ -28,10 +50,11 @@ extern struct nls_table *load_nls(char *);
|
||||
extern void unload_nls(struct nls_table *);
|
||||
extern struct nls_table *load_nls_default(void);
|
||||
|
||||
extern int utf8_mbtowc(wchar_t *, const __u8 *, int);
|
||||
extern int utf8_mbstowcs(wchar_t *, const __u8 *, int);
|
||||
extern int utf8_wctomb(__u8 *, wchar_t, int);
|
||||
extern int utf8_wcstombs(__u8 *, const wchar_t *, int);
|
||||
extern int utf8_to_utf32(const u8 *s, int len, unicode_t *pu);
|
||||
extern int utf32_to_utf8(unicode_t u, u8 *s, int maxlen);
|
||||
extern int utf8s_to_utf16s(const u8 *s, int len, wchar_t *pwcs);
|
||||
extern int utf16s_to_utf8s(const wchar_t *pwcs, int len,
|
||||
enum utf16_endian endian, u8 *s, int maxlen);
|
||||
|
||||
static inline unsigned char nls_tolower(struct nls_table *t, unsigned char c)
|
||||
{
|
||||
|
||||
@@ -408,6 +408,19 @@ static inline int num_node_state(enum node_states state)
|
||||
#define next_online_node(nid) next_node((nid), node_states[N_ONLINE])
|
||||
|
||||
extern int nr_node_ids;
|
||||
extern int nr_online_nodes;
|
||||
|
||||
static inline void node_set_online(int nid)
|
||||
{
|
||||
node_set_state(nid, N_ONLINE);
|
||||
nr_online_nodes = num_node_state(N_ONLINE);
|
||||
}
|
||||
|
||||
static inline void node_set_offline(int nid)
|
||||
{
|
||||
node_clear_state(nid, N_ONLINE);
|
||||
nr_online_nodes = num_node_state(N_ONLINE);
|
||||
}
|
||||
#else
|
||||
|
||||
static inline int node_state(int node, enum node_states state)
|
||||
@@ -434,7 +447,10 @@ static inline int num_node_state(enum node_states state)
|
||||
#define first_online_node 0
|
||||
#define next_online_node(nid) (MAX_NUMNODES)
|
||||
#define nr_node_ids 1
|
||||
#define nr_online_nodes 1
|
||||
|
||||
#define node_set_online(node) node_set_state((node), N_ONLINE)
|
||||
#define node_set_offline(node) node_clear_state((node), N_ONLINE)
|
||||
#endif
|
||||
|
||||
#define node_online_map node_states[N_ONLINE]
|
||||
@@ -454,9 +470,6 @@ static inline int num_node_state(enum node_states state)
|
||||
#define node_online(node) node_state((node), N_ONLINE)
|
||||
#define node_possible(node) node_state((node), N_POSSIBLE)
|
||||
|
||||
#define node_set_online(node) node_set_state((node), N_ONLINE)
|
||||
#define node_set_offline(node) node_clear_state((node), N_ONLINE)
|
||||
|
||||
#define for_each_node(node) for_each_node_state(node, N_POSSIBLE)
|
||||
#define for_each_online_node(node) for_each_node_state(node, N_ONLINE)
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user