ddk: v4.4.78
git-svn-id: svn://kolibrios.org@6934 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
12
drivers/include/asm/timex.h
Normal file
12
drivers/include/asm/timex.h
Normal file
@@ -0,0 +1,12 @@
|
||||
#ifndef _ASM_X86_TIMEX_H
|
||||
#define _ASM_X86_TIMEX_H
|
||||
|
||||
//#include <asm/processor.h>
|
||||
//#include <asm/tsc.h>
|
||||
|
||||
/* Assume we use the PIT time source for the clock tick */
|
||||
#define CLOCK_TICK_RATE PIT_TICK_RATE
|
||||
|
||||
#define ARCH_HAS_READ_CURRENT_TIMER
|
||||
|
||||
#endif /* _ASM_X86_TIMEX_H */
|
20
drivers/include/asm/vga.h
Normal file
20
drivers/include/asm/vga.h
Normal file
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Access to VGA videoram
|
||||
*
|
||||
* (c) 1998 Martin Mares <mj@ucw.cz>
|
||||
*/
|
||||
|
||||
#ifndef _ASM_X86_VGA_H
|
||||
#define _ASM_X86_VGA_H
|
||||
|
||||
/*
|
||||
* On the PC, we can just recalculate addresses and then
|
||||
* access the videoram directly without any black magic.
|
||||
*/
|
||||
|
||||
#define VGA_MAP_MEM(x, s) (unsigned long)phys_to_virt(x)
|
||||
|
||||
#define vga_readb(x) (*(x))
|
||||
#define vga_writeb(x, y) (*(y) = (x))
|
||||
|
||||
#endif /* _ASM_X86_VGA_H */
|
@@ -919,7 +919,8 @@ static inline int drm_debugfs_remove_files(const struct drm_info_list *files,
|
||||
#endif
|
||||
|
||||
extern struct dma_buf *drm_gem_prime_export(struct drm_device *dev,
|
||||
struct drm_gem_object *obj, int flags);
|
||||
struct drm_gem_object *obj,
|
||||
int flags);
|
||||
extern int drm_gem_prime_handle_to_fd(struct drm_device *dev,
|
||||
struct drm_file *file_priv, uint32_t handle, uint32_t flags,
|
||||
int *prime_fd);
|
||||
|
@@ -13,6 +13,7 @@
|
||||
#include <linux/time.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/cache.h>
|
||||
#include <linux/timer.h>
|
||||
#include <linux/init.h>
|
||||
#include <asm/div64.h>
|
||||
#include <asm/io.h>
|
||||
|
@@ -251,7 +251,9 @@
|
||||
#endif
|
||||
#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */
|
||||
|
||||
#if GCC_VERSION >= 50000
|
||||
#if GCC_VERSION >= 70000
|
||||
#define KASAN_ABI_VERSION 5
|
||||
#elif GCC_VERSION >= 50000
|
||||
#define KASAN_ABI_VERSION 4
|
||||
#elif GCC_VERSION >= 40902
|
||||
#define KASAN_ABI_VERSION 3
|
||||
|
@@ -556,7 +556,7 @@ static inline void cpumask_copy(struct cpumask *dstp,
|
||||
static inline int cpumask_parse_user(const char __user *buf, int len,
|
||||
struct cpumask *dstp)
|
||||
{
|
||||
return bitmap_parse_user(buf, len, cpumask_bits(dstp), nr_cpu_ids);
|
||||
return bitmap_parse_user(buf, len, cpumask_bits(dstp), nr_cpumask_bits);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -571,7 +571,7 @@ static inline int cpumask_parselist_user(const char __user *buf, int len,
|
||||
struct cpumask *dstp)
|
||||
{
|
||||
return bitmap_parselist_user(buf, len, cpumask_bits(dstp),
|
||||
nr_cpu_ids);
|
||||
nr_cpumask_bits);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -586,7 +586,7 @@ static inline int cpumask_parse(const char *buf, struct cpumask *dstp)
|
||||
char *nl = strchr(buf, '\n');
|
||||
unsigned int len = nl ? (unsigned int)(nl - buf) : strlen(buf);
|
||||
|
||||
return bitmap_parse(buf, len, cpumask_bits(dstp), nr_cpu_ids);
|
||||
return bitmap_parse(buf, len, cpumask_bits(dstp), nr_cpumask_bits);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -598,7 +598,7 @@ static inline int cpumask_parse(const char *buf, struct cpumask *dstp)
|
||||
*/
|
||||
static inline int cpulist_parse(const char *buf, struct cpumask *dstp)
|
||||
{
|
||||
return bitmap_parselist(buf, cpumask_bits(dstp), nr_cpu_ids);
|
||||
return bitmap_parselist(buf, cpumask_bits(dstp), nr_cpumask_bits);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -8,6 +8,15 @@
|
||||
* Try not to add #includes here. It slows compilation and makes kernel
|
||||
* hackers place grumpy comments in header files.
|
||||
*/
|
||||
|
||||
/* Some toolchains use a `_' prefix for all user symbols. */
|
||||
#ifdef CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX
|
||||
#define __VMLINUX_SYMBOL(x) _##x
|
||||
#define __VMLINUX_SYMBOL_STR(x) "_" #x
|
||||
#else
|
||||
#define __VMLINUX_SYMBOL(x) x
|
||||
#define __VMLINUX_SYMBOL_STR(x) #x
|
||||
#endif
|
||||
#define EXPORT_SYMBOL(sym)
|
||||
#define EXPORT_SYMBOL_GPL(sym)
|
||||
#define EXPORT_SYMBOL_GPL_FUTURE(sym)
|
||||
|
@@ -12,5 +12,11 @@
|
||||
struct file;
|
||||
|
||||
extern void fput(struct file *);
|
||||
struct fd {
|
||||
struct file *file;
|
||||
unsigned int flags;
|
||||
};
|
||||
#define FDPUT_FPUT 1
|
||||
#define FDPUT_POS_UNLOCK 2
|
||||
extern struct file *fget(unsigned int fd);
|
||||
#endif /* __LINUX_FILE_H */
|
||||
|
@@ -32,12 +32,28 @@
|
||||
#error Wordsize not 32 or 64
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The above primes are actively bad for hashing, since they are
|
||||
* too sparse. The 32-bit one is mostly ok, the 64-bit one causes
|
||||
* real problems. Besides, the "prime" part is pointless for the
|
||||
* multiplicative hash.
|
||||
*
|
||||
* Although a random odd number will do, it turns out that the golden
|
||||
* ratio phi = (sqrt(5)-1)/2, or its negative, has particularly nice
|
||||
* properties.
|
||||
*
|
||||
* These are the negative, (1 - phi) = (phi^2) = (3 - sqrt(5))/2.
|
||||
* (See Knuth vol 3, section 6.4, exercise 9.)
|
||||
*/
|
||||
#define GOLDEN_RATIO_32 0x61C88647
|
||||
#define GOLDEN_RATIO_64 0x61C8864680B583EBull
|
||||
|
||||
static __always_inline u64 hash_64(u64 val, unsigned int bits)
|
||||
{
|
||||
u64 hash = val;
|
||||
|
||||
#if defined(CONFIG_ARCH_HAS_FAST_MULTIPLIER) && BITS_PER_LONG == 64
|
||||
hash = hash * GOLDEN_RATIO_PRIME_64;
|
||||
#if BITS_PER_LONG == 64
|
||||
hash = hash * GOLDEN_RATIO_64;
|
||||
#else
|
||||
/* Sigh, gcc can't optimise this alone like it does for 32 bits. */
|
||||
u64 n = hash;
|
||||
|
@@ -6,6 +6,7 @@
|
||||
#include <linux/bitops.h>
|
||||
#include <linux/irqreturn.h>
|
||||
#include <linux/kref.h>
|
||||
#include <linux/atomic.h>
|
||||
/*
|
||||
* These correspond to the IORESOURCE_IRQ_* defines in
|
||||
* linux/ioport.h to select the interrupt line behaviour. When
|
||||
|
@@ -1 +1,27 @@
|
||||
//stub
|
||||
/*
|
||||
* Copyright 2006 PathScale, Inc. All Rights Reserved.
|
||||
*
|
||||
* This file is free software; you can redistribute it and/or modify
|
||||
* it under the terms of version 2 of the GNU General Public License
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* 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 St, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef _LINUX_IO_H
|
||||
#define _LINUX_IO_H
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/bug.h>
|
||||
#include <linux/err.h>
|
||||
struct device;
|
||||
struct resource;
|
||||
#endif /* _LINUX_IO_H */
|
||||
|
@@ -354,7 +354,7 @@ static inline unsigned long _msecs_to_jiffies(const unsigned int m)
|
||||
* directly here and from __msecs_to_jiffies() in the case where
|
||||
* constant folding is not possible.
|
||||
*/
|
||||
static inline unsigned long msecs_to_jiffies(const unsigned int m)
|
||||
static __always_inline unsigned long msecs_to_jiffies(const unsigned int m)
|
||||
{
|
||||
if (__builtin_constant_p(m)) {
|
||||
if ((int)m < 0)
|
||||
|
@@ -201,26 +201,26 @@ extern int _cond_resched(void);
|
||||
|
||||
/**
|
||||
* abs - return absolute value of an argument
|
||||
* @x: the value. If it is unsigned type, it is converted to signed type first
|
||||
* (s64, long or int depending on its size).
|
||||
* @x: the value. If it is unsigned type, it is converted to signed type first.
|
||||
* char is treated as if it was signed (regardless of whether it really is)
|
||||
* but the macro's return type is preserved as char.
|
||||
*
|
||||
* Return: an absolute value of x. If x is 64-bit, macro's return type is s64,
|
||||
* otherwise it is signed long.
|
||||
* Return: an absolute value of x.
|
||||
*/
|
||||
#define abs(x) __builtin_choose_expr(sizeof(x) == sizeof(s64), ({ \
|
||||
s64 __x = (x); \
|
||||
(__x < 0) ? -__x : __x; \
|
||||
}), ({ \
|
||||
long ret; \
|
||||
if (sizeof(x) == sizeof(long)) { \
|
||||
long __x = (x); \
|
||||
ret = (__x < 0) ? -__x : __x; \
|
||||
} else { \
|
||||
int __x = (x); \
|
||||
ret = (__x < 0) ? -__x : __x; \
|
||||
} \
|
||||
ret; \
|
||||
}))
|
||||
#define abs(x) __abs_choose_expr(x, long long, \
|
||||
__abs_choose_expr(x, long, \
|
||||
__abs_choose_expr(x, int, \
|
||||
__abs_choose_expr(x, short, \
|
||||
__abs_choose_expr(x, char, \
|
||||
__builtin_choose_expr( \
|
||||
__builtin_types_compatible_p(typeof(x), char), \
|
||||
(char)({ signed char __x = (x); __x<0?-__x:__x; }), \
|
||||
((void)0)))))))
|
||||
|
||||
#define __abs_choose_expr(x, type, other) __builtin_choose_expr( \
|
||||
__builtin_types_compatible_p(typeof(x), signed type) || \
|
||||
__builtin_types_compatible_p(typeof(x), unsigned type), \
|
||||
({ signed type __x = (x); __x < 0 ? -__x : __x; }), other)
|
||||
|
||||
/**
|
||||
* reciprocal_scale - "scale" a value into range [0, ep_ro)
|
||||
@@ -440,7 +440,7 @@ do { \
|
||||
|
||||
#define do_trace_printk(fmt, args...) \
|
||||
do { \
|
||||
static const char *trace_printk_fmt \
|
||||
static const char *trace_printk_fmt __used \
|
||||
__attribute__((section("__trace_printk_fmt"))) = \
|
||||
__builtin_constant_p(fmt) ? fmt : NULL; \
|
||||
\
|
||||
@@ -484,7 +484,7 @@ int __trace_printk(unsigned long ip, const char *fmt, ...);
|
||||
*/
|
||||
|
||||
#define trace_puts(str) ({ \
|
||||
static const char *trace_printk_fmt \
|
||||
static const char *trace_printk_fmt __used \
|
||||
__attribute__((section("__trace_printk_fmt"))) = \
|
||||
__builtin_constant_p(str) ? str : NULL; \
|
||||
\
|
||||
@@ -506,7 +506,7 @@ extern void trace_dump_stack(int skip);
|
||||
#define ftrace_vprintk(fmt, vargs) \
|
||||
do { \
|
||||
if (__builtin_constant_p(fmt)) { \
|
||||
static const char *trace_printk_fmt \
|
||||
static const char *trace_printk_fmt __used \
|
||||
__attribute__((section("__trace_printk_fmt"))) = \
|
||||
__builtin_constant_p(fmt) ? fmt : NULL; \
|
||||
\
|
||||
|
@@ -87,7 +87,7 @@ static inline void list_add_tail(struct list_head *new, struct list_head *head)
|
||||
static inline void __list_del(struct list_head * prev, struct list_head * next)
|
||||
{
|
||||
next->prev = prev;
|
||||
prev->next = next;
|
||||
WRITE_ONCE(prev->next, next);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -615,7 +615,8 @@ static inline void __hlist_del(struct hlist_node *n)
|
||||
{
|
||||
struct hlist_node *next = n->next;
|
||||
struct hlist_node **pprev = n->pprev;
|
||||
*pprev = next;
|
||||
|
||||
WRITE_ONCE(*pprev, next);
|
||||
if (next)
|
||||
next->pprev = pprev;
|
||||
}
|
||||
|
@@ -15,12 +15,6 @@
|
||||
#include <linux/types.h>
|
||||
#include <linux/bitops.h>
|
||||
|
||||
/*
|
||||
* deal with unrepresentable constant logarithms
|
||||
*/
|
||||
extern __attribute__((const, noreturn))
|
||||
int ____ilog2_NaN(void);
|
||||
|
||||
/*
|
||||
* non-constant log of base 2 calculators
|
||||
* - the arch may override these in asm/bitops.h if they can be implemented
|
||||
@@ -85,7 +79,7 @@ unsigned long __rounddown_pow_of_two(unsigned long n)
|
||||
#define ilog2(n) \
|
||||
( \
|
||||
__builtin_constant_p(n) ? ( \
|
||||
(n) < 1 ? ____ilog2_NaN() : \
|
||||
(n) < 2 ? 0 : \
|
||||
(n) & (1ULL << 63) ? 63 : \
|
||||
(n) & (1ULL << 62) ? 62 : \
|
||||
(n) & (1ULL << 61) ? 61 : \
|
||||
@@ -148,10 +142,7 @@ unsigned long __rounddown_pow_of_two(unsigned long n)
|
||||
(n) & (1ULL << 4) ? 4 : \
|
||||
(n) & (1ULL << 3) ? 3 : \
|
||||
(n) & (1ULL << 2) ? 2 : \
|
||||
(n) & (1ULL << 1) ? 1 : \
|
||||
(n) & (1ULL << 0) ? 0 : \
|
||||
____ilog2_NaN() \
|
||||
) : \
|
||||
1 ) : \
|
||||
(sizeof(n) <= 4) ? \
|
||||
__ilog2_u32(n) : \
|
||||
__ilog2_u64(n) \
|
||||
@@ -203,6 +194,17 @@ unsigned long __rounddown_pow_of_two(unsigned long n)
|
||||
* ... and so on.
|
||||
*/
|
||||
|
||||
#define order_base_2(n) ilog2(roundup_pow_of_two(n))
|
||||
static inline __attribute_const__
|
||||
int __order_base_2(unsigned long n)
|
||||
{
|
||||
return n > 1 ? ilog2(n - 1) + 1 : 0;
|
||||
}
|
||||
|
||||
#define order_base_2(n) \
|
||||
( \
|
||||
__builtin_constant_p(n) ? ( \
|
||||
((n) == 0 || (n) == 1) ? 0 : \
|
||||
ilog2((n) - 1) + 1) : \
|
||||
__order_base_2(n) \
|
||||
)
|
||||
#endif /* _LINUX_LOG2_H */
|
||||
|
@@ -9,6 +9,7 @@
|
||||
#include <linux/list.h>
|
||||
#include <linux/compiler.h>
|
||||
#include <linux/cache.h>
|
||||
#include <linux/init.h>
|
||||
|
||||
#include <linux/kobject.h>
|
||||
#include <linux/moduleparam.h>
|
||||
|
@@ -1,6 +1,7 @@
|
||||
#ifndef _LINUX_MODULE_PARAMS_H
|
||||
#define _LINUX_MODULE_PARAMS_H
|
||||
/* (C) Copyright 2001, 2002 Rusty Russell IBM Corporation */
|
||||
#include <linux/init.h>
|
||||
#include <linux/kernel.h>
|
||||
/**
|
||||
* module_param - typesafe helper for a module/cmdline parameter
|
||||
|
@@ -59,6 +59,11 @@ struct pci_slot {
|
||||
struct kobject kobj;
|
||||
};
|
||||
|
||||
static inline const char *pci_slot_name(const struct pci_slot *slot)
|
||||
{
|
||||
return kobject_name(&slot->kobj);
|
||||
}
|
||||
|
||||
/* File state for mmap()s on /proc/bus/pci/X/Y */
|
||||
enum pci_mmap_state {
|
||||
pci_mmap_io,
|
||||
@@ -352,6 +357,7 @@ struct pci_dev {
|
||||
unsigned int io_window_1k:1; /* Intel P2P bridge 1K I/O windows */
|
||||
unsigned int irq_managed:1;
|
||||
unsigned int has_secondary_link:1;
|
||||
unsigned int non_compliant_bars:1; /* broken BARs; ignore them */
|
||||
pci_dev_flags_t dev_flags;
|
||||
atomic_t enable_cnt; /* pci_enable_device has been called */
|
||||
|
||||
|
@@ -2495,6 +2495,13 @@
|
||||
#define PCI_DEVICE_ID_KORENIX_JETCARDF2 0x1700
|
||||
#define PCI_DEVICE_ID_KORENIX_JETCARDF3 0x17ff
|
||||
|
||||
#define PCI_VENDOR_ID_NETRONOME 0x19ee
|
||||
#define PCI_DEVICE_ID_NETRONOME_NFP3200 0x3200
|
||||
#define PCI_DEVICE_ID_NETRONOME_NFP3240 0x3240
|
||||
#define PCI_DEVICE_ID_NETRONOME_NFP4000 0x4000
|
||||
#define PCI_DEVICE_ID_NETRONOME_NFP6000 0x6000
|
||||
#define PCI_DEVICE_ID_NETRONOME_NFP6000_VF 0x6003
|
||||
|
||||
#define PCI_VENDOR_ID_QMI 0x1a32
|
||||
|
||||
#define PCI_VENDOR_ID_AZWAVE 0x1a3b
|
||||
|
@@ -3,42 +3,6 @@
|
||||
|
||||
#include <uapi/linux/personality.h>
|
||||
|
||||
|
||||
/*
|
||||
* Handling of different ABIs (personalities).
|
||||
*/
|
||||
|
||||
struct exec_domain;
|
||||
struct pt_regs;
|
||||
|
||||
extern int register_exec_domain(struct exec_domain *);
|
||||
extern int unregister_exec_domain(struct exec_domain *);
|
||||
extern int __set_personality(unsigned int);
|
||||
|
||||
|
||||
/*
|
||||
* Description of an execution domain.
|
||||
*
|
||||
* The first two members are refernced from assembly source
|
||||
* and should stay where they are unless explicitly needed.
|
||||
*/
|
||||
typedef void (*handler_t)(int, struct pt_regs *);
|
||||
|
||||
struct exec_domain {
|
||||
const char *name; /* name of the execdomain */
|
||||
handler_t handler; /* handler for syscalls */
|
||||
unsigned char pers_low; /* lowest personality */
|
||||
unsigned char pers_high; /* highest personality */
|
||||
unsigned long *signal_map; /* signal mapping */
|
||||
unsigned long *signal_invmap; /* reverse signal mapping */
|
||||
struct map_segment *err_map; /* error mapping */
|
||||
struct map_segment *socktype_map; /* socket type mapping */
|
||||
struct map_segment *sockopt_map; /* socket option mapping */
|
||||
struct map_segment *af_map; /* address family mapping */
|
||||
struct module *module; /* module context of the ed. */
|
||||
struct exec_domain *next; /* linked list (internal) */
|
||||
};
|
||||
|
||||
/*
|
||||
* Return the base personality without flags.
|
||||
*/
|
||||
|
@@ -25,7 +25,7 @@
|
||||
#include <linux/workqueue.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/wait.h>
|
||||
//#include <linux/timer.h>
|
||||
#include <linux/timer.h>
|
||||
#include <linux/completion.h>
|
||||
|
||||
/*
|
||||
|
@@ -5,6 +5,7 @@
|
||||
#include <linux/types.h>
|
||||
#include <linux/bug.h>
|
||||
#include <linux/mm.h>
|
||||
#include <asm/io.h>
|
||||
|
||||
struct scatterlist {
|
||||
#ifdef CONFIG_DEBUG_SG
|
||||
|
@@ -33,7 +33,7 @@
|
||||
*/
|
||||
|
||||
#include <linux/spinlock.h>
|
||||
//#include <linux/preempt.h>
|
||||
#include <linux/preempt.h>
|
||||
#include <linux/lockdep.h>
|
||||
#include <linux/compiler.h>
|
||||
#include <asm/processor.h>
|
||||
|
@@ -127,7 +127,11 @@ extern char **argv_split(gfp_t gfp, const char *str, int *argcp);
|
||||
extern void argv_free(char **argv);
|
||||
|
||||
extern bool sysfs_streq(const char *s1, const char *s2);
|
||||
extern int strtobool(const char *s, bool *res);
|
||||
extern int kstrtobool(const char *s, bool *res);
|
||||
static inline int strtobool(const char *s, bool *res)
|
||||
{
|
||||
return kstrtobool(s, res);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_BINARY_PRINTF
|
||||
int vbin_printf(u32 *bin_buf, size_t size, const char *fmt, va_list args);
|
||||
|
@@ -2,6 +2,9 @@
|
||||
#define _LINUX_SWAP_H
|
||||
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/atomic.h>
|
||||
|
||||
struct notifier_block;
|
||||
|
||||
|
@@ -14,6 +14,7 @@
|
||||
#include <linux/compiler.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/lockdep.h>
|
||||
#include <linux/atomic.h>
|
||||
|
||||
struct kobject;
|
||||
|
@@ -125,6 +125,32 @@ static inline bool timeval_valid(const struct timeval *tv)
|
||||
|
||||
extern struct timespec timespec_trunc(struct timespec t, unsigned gran);
|
||||
|
||||
/*
|
||||
* Validates if a timespec/timeval used to inject a time offset is valid.
|
||||
* Offsets can be postive or negative. The value of the timeval/timespec
|
||||
* is the sum of its fields, but *NOTE*: the field tv_usec/tv_nsec must
|
||||
* always be non-negative.
|
||||
*/
|
||||
static inline bool timeval_inject_offset_valid(const struct timeval *tv)
|
||||
{
|
||||
/* We don't check the tv_sec as it can be positive or negative */
|
||||
|
||||
/* Can't have more microseconds then a second */
|
||||
if (tv->tv_usec < 0 || tv->tv_usec >= USEC_PER_SEC)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
static inline bool timespec_inject_offset_valid(const struct timespec *ts)
|
||||
{
|
||||
/* We don't check the tv_sec as it can be positive or negative */
|
||||
|
||||
/* Can't have more nanoseconds then a second */
|
||||
if (ts->tv_nsec < 0 || ts->tv_nsec >= NSEC_PER_SEC)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
#define CURRENT_TIME (current_kernel_time())
|
||||
#define CURRENT_TIME_SEC ((struct timespec) { get_seconds(), 0 })
|
||||
|
||||
|
16
drivers/include/linux/timer.h
Normal file
16
drivers/include/linux/timer.h
Normal file
@@ -0,0 +1,16 @@
|
||||
#ifndef _LINUX_TIMER_H
|
||||
#define _LINUX_TIMER_H
|
||||
|
||||
#include <linux/list.h>
|
||||
|
||||
unsigned long __round_jiffies(unsigned long j, int cpu);
|
||||
unsigned long __round_jiffies_relative(unsigned long j, int cpu);
|
||||
unsigned long round_jiffies(unsigned long j);
|
||||
unsigned long round_jiffies_relative(unsigned long j);
|
||||
|
||||
unsigned long __round_jiffies_up(unsigned long j, int cpu);
|
||||
unsigned long __round_jiffies_up_relative(unsigned long j, int cpu);
|
||||
unsigned long round_jiffies_up(unsigned long j);
|
||||
unsigned long round_jiffies_up_relative(unsigned long j);
|
||||
|
||||
#endif
|
@@ -53,12 +53,15 @@
|
||||
#ifndef _LINUX_TIMEX_H
|
||||
#define _LINUX_TIMEX_H
|
||||
|
||||
#include <uapi/linux/timex.h>
|
||||
|
||||
#define ADJ_ADJTIME 0x8000 /* switch between adjtime/adjtimex modes */
|
||||
#define ADJ_OFFSET_SINGLESHOT 0x0001 /* old-fashioned adjtime */
|
||||
#define ADJ_OFFSET_READONLY 0x2000 /* read-only adjtime */
|
||||
#include <linux/compiler.h>
|
||||
#include <linux/types.h>
|
||||
|
||||
#include <asm/timex.h>
|
||||
|
||||
#ifndef random_get_entropy
|
||||
/*
|
||||
@@ -147,7 +150,8 @@ extern unsigned long tick_nsec; /* SHIFTED_HZ period (nsec) */
|
||||
#define NTP_INTERVAL_FREQ (HZ)
|
||||
#define NTP_INTERVAL_LENGTH (NSEC_PER_SEC/NTP_INTERVAL_FREQ)
|
||||
|
||||
|
||||
extern int do_adjtimex(struct timex *);
|
||||
extern void hardpps(const struct timespec64 *, const struct timespec64 *);
|
||||
|
||||
int read_current_timer(unsigned long *timer_val);
|
||||
void ntp_notify_cmos_timer(void);
|
||||
|
20
drivers/include/linux/uaccess.h
Normal file
20
drivers/include/linux/uaccess.h
Normal file
@@ -0,0 +1,20 @@
|
||||
#ifndef __LINUX_UACCESS_H__
|
||||
#define __LINUX_UACCESS_H__
|
||||
|
||||
#include <linux/sched.h>
|
||||
/*
|
||||
* These routines enable/disable the pagefault handler. If disabled, it will
|
||||
* not take any locks and go straight to the fixup table.
|
||||
*
|
||||
* User access methods will not sleep when called from a pagefault_disabled()
|
||||
* environment.
|
||||
*/
|
||||
static inline void pagefault_disable(void)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void pagefault_enable(void)
|
||||
{
|
||||
}
|
||||
|
||||
#endif /* __LINUX_UACCESS_H__ */
|
@@ -31,7 +31,7 @@
|
||||
#ifndef LINUX_VGA_H
|
||||
#define LINUX_VGA_H
|
||||
|
||||
//#include <video/vga.h>
|
||||
#include <video/vga.h>
|
||||
|
||||
/* Legacy VGA regions */
|
||||
#define VGA_RSRC_NONE 0x00
|
||||
|
@@ -4,6 +4,8 @@
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/rbtree.h>
|
||||
|
||||
struct vm_area_struct; /* vma defining user mapping in mm_types.h */
|
||||
|
||||
/* bits in flags of vmalloc's vm_struct below */
|
||||
|
@@ -5,7 +5,7 @@
|
||||
#ifndef _LINUX_WORKQUEUE_H
|
||||
#define _LINUX_WORKQUEUE_H
|
||||
|
||||
#include <linux/list.h>
|
||||
#include <linux/timer.h>
|
||||
#include <linux/linkage.h>
|
||||
#include <linux/bitops.h>
|
||||
#include <linux/lockdep.h>
|
||||
|
166
drivers/include/uapi/linux/timex.h
Normal file
166
drivers/include/uapi/linux/timex.h
Normal file
@@ -0,0 +1,166 @@
|
||||
/*****************************************************************************
|
||||
* *
|
||||
* Copyright (c) David L. Mills 1993 *
|
||||
* *
|
||||
* Permission to use, copy, modify, and distribute this software and its *
|
||||
* documentation for any purpose and without fee is hereby granted, provided *
|
||||
* that the above copyright notice appears in all copies and that both the *
|
||||
* copyright notice and this permission notice appear in supporting *
|
||||
* documentation, and that the name University of Delaware not be used in *
|
||||
* advertising or publicity pertaining to distribution of the software *
|
||||
* without specific, written prior permission. The University of Delaware *
|
||||
* makes no representations about the suitability this software for any *
|
||||
* purpose. It is provided "as is" without express or implied warranty. *
|
||||
* *
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Modification history timex.h
|
||||
*
|
||||
* 29 Dec 97 Russell King
|
||||
* Moved CLOCK_TICK_RATE, CLOCK_TICK_FACTOR and FINETUNE to asm/timex.h
|
||||
* for ARM machines
|
||||
*
|
||||
* 9 Jan 97 Adrian Sun
|
||||
* Shifted LATCH define to allow access to alpha machines.
|
||||
*
|
||||
* 26 Sep 94 David L. Mills
|
||||
* Added defines for hybrid phase/frequency-lock loop.
|
||||
*
|
||||
* 19 Mar 94 David L. Mills
|
||||
* Moved defines from kernel routines to header file and added new
|
||||
* defines for PPS phase-lock loop.
|
||||
*
|
||||
* 20 Feb 94 David L. Mills
|
||||
* Revised status codes and structures for external clock and PPS
|
||||
* signal discipline.
|
||||
*
|
||||
* 28 Nov 93 David L. Mills
|
||||
* Adjusted parameters to improve stability and increase poll
|
||||
* interval.
|
||||
*
|
||||
* 17 Sep 93 David L. Mills
|
||||
* Created file $NTP/include/sys/timex.h
|
||||
* 07 Oct 93 Torsten Duwe
|
||||
* Derived linux/timex.h
|
||||
* 1995-08-13 Torsten Duwe
|
||||
* kernel PLL updated to 1994-12-13 specs (rfc-1589)
|
||||
* 1997-08-30 Ulrich Windl
|
||||
* Added new constant NTP_PHASE_LIMIT
|
||||
* 2004-08-12 Christoph Lameter
|
||||
* Reworked time interpolation logic
|
||||
*/
|
||||
#ifndef _UAPI_LINUX_TIMEX_H
|
||||
#define _UAPI_LINUX_TIMEX_H
|
||||
|
||||
#include <linux/time.h>
|
||||
|
||||
#define NTP_API 4 /* NTP API version */
|
||||
|
||||
/*
|
||||
* syscall interface - used (mainly by NTP daemon)
|
||||
* to discipline kernel clock oscillator
|
||||
*/
|
||||
struct timex {
|
||||
unsigned int modes; /* mode selector */
|
||||
__kernel_long_t offset; /* time offset (usec) */
|
||||
__kernel_long_t freq; /* frequency offset (scaled ppm) */
|
||||
__kernel_long_t maxerror;/* maximum error (usec) */
|
||||
__kernel_long_t esterror;/* estimated error (usec) */
|
||||
int status; /* clock command/status */
|
||||
__kernel_long_t constant;/* pll time constant */
|
||||
__kernel_long_t precision;/* clock precision (usec) (read only) */
|
||||
__kernel_long_t tolerance;/* clock frequency tolerance (ppm)
|
||||
* (read only)
|
||||
*/
|
||||
struct timeval time; /* (read only, except for ADJ_SETOFFSET) */
|
||||
__kernel_long_t tick; /* (modified) usecs between clock ticks */
|
||||
|
||||
__kernel_long_t ppsfreq;/* pps frequency (scaled ppm) (ro) */
|
||||
__kernel_long_t jitter; /* pps jitter (us) (ro) */
|
||||
int shift; /* interval duration (s) (shift) (ro) */
|
||||
__kernel_long_t stabil; /* pps stability (scaled ppm) (ro) */
|
||||
__kernel_long_t jitcnt; /* jitter limit exceeded (ro) */
|
||||
__kernel_long_t calcnt; /* calibration intervals (ro) */
|
||||
__kernel_long_t errcnt; /* calibration errors (ro) */
|
||||
__kernel_long_t stbcnt; /* stability limit exceeded (ro) */
|
||||
|
||||
int tai; /* TAI offset (ro) */
|
||||
|
||||
int :32; int :32; int :32; int :32;
|
||||
int :32; int :32; int :32; int :32;
|
||||
int :32; int :32; int :32;
|
||||
};
|
||||
|
||||
/*
|
||||
* Mode codes (timex.mode)
|
||||
*/
|
||||
#define ADJ_OFFSET 0x0001 /* time offset */
|
||||
#define ADJ_FREQUENCY 0x0002 /* frequency offset */
|
||||
#define ADJ_MAXERROR 0x0004 /* maximum time error */
|
||||
#define ADJ_ESTERROR 0x0008 /* estimated time error */
|
||||
#define ADJ_STATUS 0x0010 /* clock status */
|
||||
#define ADJ_TIMECONST 0x0020 /* pll time constant */
|
||||
#define ADJ_TAI 0x0080 /* set TAI offset */
|
||||
#define ADJ_SETOFFSET 0x0100 /* add 'time' to current time */
|
||||
#define ADJ_MICRO 0x1000 /* select microsecond resolution */
|
||||
#define ADJ_NANO 0x2000 /* select nanosecond resolution */
|
||||
#define ADJ_TICK 0x4000 /* tick value */
|
||||
|
||||
#ifndef __KERNEL__
|
||||
#define ADJ_OFFSET_SINGLESHOT 0x8001 /* old-fashioned adjtime */
|
||||
#define ADJ_OFFSET_SS_READ 0xa001 /* read-only adjtime */
|
||||
#endif
|
||||
|
||||
/* NTP userland likes the MOD_ prefix better */
|
||||
#define MOD_OFFSET ADJ_OFFSET
|
||||
#define MOD_FREQUENCY ADJ_FREQUENCY
|
||||
#define MOD_MAXERROR ADJ_MAXERROR
|
||||
#define MOD_ESTERROR ADJ_ESTERROR
|
||||
#define MOD_STATUS ADJ_STATUS
|
||||
#define MOD_TIMECONST ADJ_TIMECONST
|
||||
#define MOD_TAI ADJ_TAI
|
||||
#define MOD_MICRO ADJ_MICRO
|
||||
#define MOD_NANO ADJ_NANO
|
||||
|
||||
|
||||
/*
|
||||
* Status codes (timex.status)
|
||||
*/
|
||||
#define STA_PLL 0x0001 /* enable PLL updates (rw) */
|
||||
#define STA_PPSFREQ 0x0002 /* enable PPS freq discipline (rw) */
|
||||
#define STA_PPSTIME 0x0004 /* enable PPS time discipline (rw) */
|
||||
#define STA_FLL 0x0008 /* select frequency-lock mode (rw) */
|
||||
|
||||
#define STA_INS 0x0010 /* insert leap (rw) */
|
||||
#define STA_DEL 0x0020 /* delete leap (rw) */
|
||||
#define STA_UNSYNC 0x0040 /* clock unsynchronized (rw) */
|
||||
#define STA_FREQHOLD 0x0080 /* hold frequency (rw) */
|
||||
|
||||
#define STA_PPSSIGNAL 0x0100 /* PPS signal present (ro) */
|
||||
#define STA_PPSJITTER 0x0200 /* PPS signal jitter exceeded (ro) */
|
||||
#define STA_PPSWANDER 0x0400 /* PPS signal wander exceeded (ro) */
|
||||
#define STA_PPSERROR 0x0800 /* PPS signal calibration error (ro) */
|
||||
|
||||
#define STA_CLOCKERR 0x1000 /* clock hardware fault (ro) */
|
||||
#define STA_NANO 0x2000 /* resolution (0 = us, 1 = ns) (ro) */
|
||||
#define STA_MODE 0x4000 /* mode (0 = PLL, 1 = FLL) (ro) */
|
||||
#define STA_CLK 0x8000 /* clock source (0 = A, 1 = B) (ro) */
|
||||
|
||||
/* read-only bits */
|
||||
#define STA_RONLY (STA_PPSSIGNAL | STA_PPSJITTER | STA_PPSWANDER | \
|
||||
STA_PPSERROR | STA_CLOCKERR | STA_NANO | STA_MODE | STA_CLK)
|
||||
|
||||
/*
|
||||
* Clock states (time_state)
|
||||
*/
|
||||
#define TIME_OK 0 /* clock synchronized, no leap second */
|
||||
#define TIME_INS 1 /* insert leap second */
|
||||
#define TIME_DEL 2 /* delete leap second */
|
||||
#define TIME_OOP 3 /* leap second in progress */
|
||||
#define TIME_WAIT 4 /* leap second has occurred */
|
||||
#define TIME_ERROR 5 /* clock not synchronized */
|
||||
#define TIME_BAD TIME_ERROR /* bw compat */
|
||||
|
||||
|
||||
#endif /* _UAPI_LINUX_TIMEX_H */
|
459
drivers/include/video/vga.h
Normal file
459
drivers/include/video/vga.h
Normal file
@@ -0,0 +1,459 @@
|
||||
/*
|
||||
* linux/include/video/vga.h -- standard VGA chipset interaction
|
||||
*
|
||||
* Copyright 1999 Jeff Garzik <jgarzik@pobox.com>
|
||||
*
|
||||
* Copyright history from vga16fb.c:
|
||||
* Copyright 1999 Ben Pfaff and Petr Vandrovec
|
||||
* Based on VGA info at http://www.osdever.net/FreeVGA/home.htm
|
||||
* Based on VESA framebuffer (c) 1998 Gerd Knorr
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU General
|
||||
* Public License. See the file COPYING in the main directory of this
|
||||
* archive for more details.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __linux_video_vga_h__
|
||||
#define __linux_video_vga_h__
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/io.h>
|
||||
#include <asm/vga.h>
|
||||
#include <asm/byteorder.h>
|
||||
|
||||
|
||||
/* Some of the code below is taken from SVGAlib. The original,
|
||||
unmodified copyright notice for that code is below. */
|
||||
/* VGAlib version 1.2 - (c) 1993 Tommy Frandsen */
|
||||
/* */
|
||||
/* This library is free software; you can redistribute it and/or */
|
||||
/* modify it without any restrictions. This library is distributed */
|
||||
/* in the hope that it will be useful, but without any warranty. */
|
||||
|
||||
/* Multi-chipset support Copyright 1993 Harm Hanemaayer */
|
||||
/* partially copyrighted (C) 1993 by Hartmut Schirmer */
|
||||
|
||||
/* VGA data register ports */
|
||||
#define VGA_CRT_DC 0x3D5 /* CRT Controller Data Register - color emulation */
|
||||
#define VGA_CRT_DM 0x3B5 /* CRT Controller Data Register - mono emulation */
|
||||
#define VGA_ATT_R 0x3C1 /* Attribute Controller Data Read Register */
|
||||
#define VGA_ATT_W 0x3C0 /* Attribute Controller Data Write Register */
|
||||
#define VGA_GFX_D 0x3CF /* Graphics Controller Data Register */
|
||||
#define VGA_SEQ_D 0x3C5 /* Sequencer Data Register */
|
||||
#define VGA_MIS_R 0x3CC /* Misc Output Read Register */
|
||||
#define VGA_MIS_W 0x3C2 /* Misc Output Write Register */
|
||||
#define VGA_FTC_R 0x3CA /* Feature Control Read Register */
|
||||
#define VGA_IS1_RC 0x3DA /* Input Status Register 1 - color emulation */
|
||||
#define VGA_IS1_RM 0x3BA /* Input Status Register 1 - mono emulation */
|
||||
#define VGA_PEL_D 0x3C9 /* PEL Data Register */
|
||||
#define VGA_PEL_MSK 0x3C6 /* PEL mask register */
|
||||
|
||||
/* EGA-specific registers */
|
||||
#define EGA_GFX_E0 0x3CC /* Graphics enable processor 0 */
|
||||
#define EGA_GFX_E1 0x3CA /* Graphics enable processor 1 */
|
||||
|
||||
/* VGA index register ports */
|
||||
#define VGA_CRT_IC 0x3D4 /* CRT Controller Index - color emulation */
|
||||
#define VGA_CRT_IM 0x3B4 /* CRT Controller Index - mono emulation */
|
||||
#define VGA_ATT_IW 0x3C0 /* Attribute Controller Index & Data Write Register */
|
||||
#define VGA_GFX_I 0x3CE /* Graphics Controller Index */
|
||||
#define VGA_SEQ_I 0x3C4 /* Sequencer Index */
|
||||
#define VGA_PEL_IW 0x3C8 /* PEL Write Index */
|
||||
#define VGA_PEL_IR 0x3C7 /* PEL Read Index */
|
||||
|
||||
/* standard VGA indexes max counts */
|
||||
#define VGA_CRT_C 0x19 /* Number of CRT Controller Registers */
|
||||
#define VGA_ATT_C 0x15 /* Number of Attribute Controller Registers */
|
||||
#define VGA_GFX_C 0x09 /* Number of Graphics Controller Registers */
|
||||
#define VGA_SEQ_C 0x05 /* Number of Sequencer Registers */
|
||||
#define VGA_MIS_C 0x01 /* Number of Misc Output Register */
|
||||
|
||||
/* VGA misc register bit masks */
|
||||
#define VGA_MIS_COLOR 0x01
|
||||
#define VGA_MIS_ENB_MEM_ACCESS 0x02
|
||||
#define VGA_MIS_DCLK_28322_720 0x04
|
||||
#define VGA_MIS_ENB_PLL_LOAD (0x04 | 0x08)
|
||||
#define VGA_MIS_SEL_HIGH_PAGE 0x20
|
||||
|
||||
/* VGA CRT controller register indices */
|
||||
#define VGA_CRTC_H_TOTAL 0
|
||||
#define VGA_CRTC_H_DISP 1
|
||||
#define VGA_CRTC_H_BLANK_START 2
|
||||
#define VGA_CRTC_H_BLANK_END 3
|
||||
#define VGA_CRTC_H_SYNC_START 4
|
||||
#define VGA_CRTC_H_SYNC_END 5
|
||||
#define VGA_CRTC_V_TOTAL 6
|
||||
#define VGA_CRTC_OVERFLOW 7
|
||||
#define VGA_CRTC_PRESET_ROW 8
|
||||
#define VGA_CRTC_MAX_SCAN 9
|
||||
#define VGA_CRTC_CURSOR_START 0x0A
|
||||
#define VGA_CRTC_CURSOR_END 0x0B
|
||||
#define VGA_CRTC_START_HI 0x0C
|
||||
#define VGA_CRTC_START_LO 0x0D
|
||||
#define VGA_CRTC_CURSOR_HI 0x0E
|
||||
#define VGA_CRTC_CURSOR_LO 0x0F
|
||||
#define VGA_CRTC_V_SYNC_START 0x10
|
||||
#define VGA_CRTC_V_SYNC_END 0x11
|
||||
#define VGA_CRTC_V_DISP_END 0x12
|
||||
#define VGA_CRTC_OFFSET 0x13
|
||||
#define VGA_CRTC_UNDERLINE 0x14
|
||||
#define VGA_CRTC_V_BLANK_START 0x15
|
||||
#define VGA_CRTC_V_BLANK_END 0x16
|
||||
#define VGA_CRTC_MODE 0x17
|
||||
#define VGA_CRTC_LINE_COMPARE 0x18
|
||||
#define VGA_CRTC_REGS VGA_CRT_C
|
||||
|
||||
/* VGA CRT controller bit masks */
|
||||
#define VGA_CR11_LOCK_CR0_CR7 0x80 /* lock writes to CR0 - CR7 */
|
||||
#define VGA_CR17_H_V_SIGNALS_ENABLED 0x80
|
||||
|
||||
/* VGA attribute controller register indices */
|
||||
#define VGA_ATC_PALETTE0 0x00
|
||||
#define VGA_ATC_PALETTE1 0x01
|
||||
#define VGA_ATC_PALETTE2 0x02
|
||||
#define VGA_ATC_PALETTE3 0x03
|
||||
#define VGA_ATC_PALETTE4 0x04
|
||||
#define VGA_ATC_PALETTE5 0x05
|
||||
#define VGA_ATC_PALETTE6 0x06
|
||||
#define VGA_ATC_PALETTE7 0x07
|
||||
#define VGA_ATC_PALETTE8 0x08
|
||||
#define VGA_ATC_PALETTE9 0x09
|
||||
#define VGA_ATC_PALETTEA 0x0A
|
||||
#define VGA_ATC_PALETTEB 0x0B
|
||||
#define VGA_ATC_PALETTEC 0x0C
|
||||
#define VGA_ATC_PALETTED 0x0D
|
||||
#define VGA_ATC_PALETTEE 0x0E
|
||||
#define VGA_ATC_PALETTEF 0x0F
|
||||
#define VGA_ATC_MODE 0x10
|
||||
#define VGA_ATC_OVERSCAN 0x11
|
||||
#define VGA_ATC_PLANE_ENABLE 0x12
|
||||
#define VGA_ATC_PEL 0x13
|
||||
#define VGA_ATC_COLOR_PAGE 0x14
|
||||
|
||||
#define VGA_AR_ENABLE_DISPLAY 0x20
|
||||
|
||||
/* VGA sequencer register indices */
|
||||
#define VGA_SEQ_RESET 0x00
|
||||
#define VGA_SEQ_CLOCK_MODE 0x01
|
||||
#define VGA_SEQ_PLANE_WRITE 0x02
|
||||
#define VGA_SEQ_CHARACTER_MAP 0x03
|
||||
#define VGA_SEQ_MEMORY_MODE 0x04
|
||||
|
||||
/* VGA sequencer register bit masks */
|
||||
#define VGA_SR01_CHAR_CLK_8DOTS 0x01 /* bit 0: character clocks 8 dots wide are generated */
|
||||
#define VGA_SR01_SCREEN_OFF 0x20 /* bit 5: Screen is off */
|
||||
#define VGA_SR02_ALL_PLANES 0x0F /* bits 3-0: enable access to all planes */
|
||||
#define VGA_SR04_EXT_MEM 0x02 /* bit 1: allows complete mem access to 256K */
|
||||
#define VGA_SR04_SEQ_MODE 0x04 /* bit 2: directs system to use a sequential addressing mode */
|
||||
#define VGA_SR04_CHN_4M 0x08 /* bit 3: selects modulo 4 addressing for CPU access to display memory */
|
||||
|
||||
/* VGA graphics controller register indices */
|
||||
#define VGA_GFX_SR_VALUE 0x00
|
||||
#define VGA_GFX_SR_ENABLE 0x01
|
||||
#define VGA_GFX_COMPARE_VALUE 0x02
|
||||
#define VGA_GFX_DATA_ROTATE 0x03
|
||||
#define VGA_GFX_PLANE_READ 0x04
|
||||
#define VGA_GFX_MODE 0x05
|
||||
#define VGA_GFX_MISC 0x06
|
||||
#define VGA_GFX_COMPARE_MASK 0x07
|
||||
#define VGA_GFX_BIT_MASK 0x08
|
||||
|
||||
/* VGA graphics controller bit masks */
|
||||
#define VGA_GR06_GRAPHICS_MODE 0x01
|
||||
|
||||
/* macro for composing an 8-bit VGA register index and value
|
||||
* into a single 16-bit quantity */
|
||||
#define VGA_OUT16VAL(v, r) (((v) << 8) | (r))
|
||||
|
||||
/* decide whether we should enable the faster 16-bit VGA register writes */
|
||||
#ifdef __LITTLE_ENDIAN
|
||||
#define VGA_OUTW_WRITE
|
||||
#endif
|
||||
|
||||
/* VGA State Save and Restore */
|
||||
#define VGA_SAVE_FONT0 1 /* save/restore plane 2 fonts */
|
||||
#define VGA_SAVE_FONT1 2 /* save/restore plane 3 fonts */
|
||||
#define VGA_SAVE_TEXT 4 /* save/restore plane 0/1 fonts */
|
||||
#define VGA_SAVE_FONTS 7 /* save/restore all fonts */
|
||||
#define VGA_SAVE_MODE 8 /* save/restore video mode */
|
||||
#define VGA_SAVE_CMAP 16 /* save/restore color map/DAC */
|
||||
|
||||
struct vgastate {
|
||||
void __iomem *vgabase; /* mmio base, if supported */
|
||||
unsigned long membase; /* VGA window base, 0 for default - 0xA000 */
|
||||
__u32 memsize; /* VGA window size, 0 for default 64K */
|
||||
__u32 flags; /* what state[s] to save (see VGA_SAVE_*) */
|
||||
__u32 depth; /* current fb depth, not important */
|
||||
__u32 num_attr; /* number of att registers, 0 for default */
|
||||
__u32 num_crtc; /* number of crt registers, 0 for default */
|
||||
__u32 num_gfx; /* number of gfx registers, 0 for default */
|
||||
__u32 num_seq; /* number of seq registers, 0 for default */
|
||||
void *vidstate;
|
||||
};
|
||||
|
||||
extern int save_vga(struct vgastate *state);
|
||||
extern int restore_vga(struct vgastate *state);
|
||||
|
||||
/*
|
||||
* generic VGA port read/write
|
||||
*/
|
||||
|
||||
static inline unsigned char vga_io_r (unsigned short port)
|
||||
{
|
||||
return inb_p(port);
|
||||
}
|
||||
|
||||
static inline void vga_io_w (unsigned short port, unsigned char val)
|
||||
{
|
||||
outb_p(val, port);
|
||||
}
|
||||
|
||||
static inline void vga_io_w_fast (unsigned short port, unsigned char reg,
|
||||
unsigned char val)
|
||||
{
|
||||
outw(VGA_OUT16VAL (val, reg), port);
|
||||
}
|
||||
|
||||
static inline unsigned char vga_mm_r (void __iomem *regbase, unsigned short port)
|
||||
{
|
||||
return readb (regbase + port);
|
||||
}
|
||||
|
||||
static inline void vga_mm_w (void __iomem *regbase, unsigned short port, unsigned char val)
|
||||
{
|
||||
writeb (val, regbase + port);
|
||||
}
|
||||
|
||||
static inline void vga_mm_w_fast (void __iomem *regbase, unsigned short port,
|
||||
unsigned char reg, unsigned char val)
|
||||
{
|
||||
writew (VGA_OUT16VAL (val, reg), regbase + port);
|
||||
}
|
||||
|
||||
static inline unsigned char vga_r (void __iomem *regbase, unsigned short port)
|
||||
{
|
||||
if (regbase)
|
||||
return vga_mm_r (regbase, port);
|
||||
else
|
||||
return vga_io_r (port);
|
||||
}
|
||||
|
||||
static inline void vga_w (void __iomem *regbase, unsigned short port, unsigned char val)
|
||||
{
|
||||
if (regbase)
|
||||
vga_mm_w (regbase, port, val);
|
||||
else
|
||||
vga_io_w (port, val);
|
||||
}
|
||||
|
||||
|
||||
static inline void vga_w_fast (void __iomem *regbase, unsigned short port,
|
||||
unsigned char reg, unsigned char val)
|
||||
{
|
||||
if (regbase)
|
||||
vga_mm_w_fast (regbase, port, reg, val);
|
||||
else
|
||||
vga_io_w_fast (port, reg, val);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* VGA CRTC register read/write
|
||||
*/
|
||||
|
||||
static inline unsigned char vga_rcrt (void __iomem *regbase, unsigned char reg)
|
||||
{
|
||||
vga_w (regbase, VGA_CRT_IC, reg);
|
||||
return vga_r (regbase, VGA_CRT_DC);
|
||||
}
|
||||
|
||||
static inline void vga_wcrt (void __iomem *regbase, unsigned char reg, unsigned char val)
|
||||
{
|
||||
#ifdef VGA_OUTW_WRITE
|
||||
vga_w_fast (regbase, VGA_CRT_IC, reg, val);
|
||||
#else
|
||||
vga_w (regbase, VGA_CRT_IC, reg);
|
||||
vga_w (regbase, VGA_CRT_DC, val);
|
||||
#endif /* VGA_OUTW_WRITE */
|
||||
}
|
||||
|
||||
static inline unsigned char vga_io_rcrt (unsigned char reg)
|
||||
{
|
||||
vga_io_w (VGA_CRT_IC, reg);
|
||||
return vga_io_r (VGA_CRT_DC);
|
||||
}
|
||||
|
||||
static inline void vga_io_wcrt (unsigned char reg, unsigned char val)
|
||||
{
|
||||
#ifdef VGA_OUTW_WRITE
|
||||
vga_io_w_fast (VGA_CRT_IC, reg, val);
|
||||
#else
|
||||
vga_io_w (VGA_CRT_IC, reg);
|
||||
vga_io_w (VGA_CRT_DC, val);
|
||||
#endif /* VGA_OUTW_WRITE */
|
||||
}
|
||||
|
||||
static inline unsigned char vga_mm_rcrt (void __iomem *regbase, unsigned char reg)
|
||||
{
|
||||
vga_mm_w (regbase, VGA_CRT_IC, reg);
|
||||
return vga_mm_r (regbase, VGA_CRT_DC);
|
||||
}
|
||||
|
||||
static inline void vga_mm_wcrt (void __iomem *regbase, unsigned char reg, unsigned char val)
|
||||
{
|
||||
#ifdef VGA_OUTW_WRITE
|
||||
vga_mm_w_fast (regbase, VGA_CRT_IC, reg, val);
|
||||
#else
|
||||
vga_mm_w (regbase, VGA_CRT_IC, reg);
|
||||
vga_mm_w (regbase, VGA_CRT_DC, val);
|
||||
#endif /* VGA_OUTW_WRITE */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* VGA sequencer register read/write
|
||||
*/
|
||||
|
||||
static inline unsigned char vga_rseq (void __iomem *regbase, unsigned char reg)
|
||||
{
|
||||
vga_w (regbase, VGA_SEQ_I, reg);
|
||||
return vga_r (regbase, VGA_SEQ_D);
|
||||
}
|
||||
|
||||
static inline void vga_wseq (void __iomem *regbase, unsigned char reg, unsigned char val)
|
||||
{
|
||||
#ifdef VGA_OUTW_WRITE
|
||||
vga_w_fast (regbase, VGA_SEQ_I, reg, val);
|
||||
#else
|
||||
vga_w (regbase, VGA_SEQ_I, reg);
|
||||
vga_w (regbase, VGA_SEQ_D, val);
|
||||
#endif /* VGA_OUTW_WRITE */
|
||||
}
|
||||
|
||||
static inline unsigned char vga_io_rseq (unsigned char reg)
|
||||
{
|
||||
vga_io_w (VGA_SEQ_I, reg);
|
||||
return vga_io_r (VGA_SEQ_D);
|
||||
}
|
||||
|
||||
static inline void vga_io_wseq (unsigned char reg, unsigned char val)
|
||||
{
|
||||
#ifdef VGA_OUTW_WRITE
|
||||
vga_io_w_fast (VGA_SEQ_I, reg, val);
|
||||
#else
|
||||
vga_io_w (VGA_SEQ_I, reg);
|
||||
vga_io_w (VGA_SEQ_D, val);
|
||||
#endif /* VGA_OUTW_WRITE */
|
||||
}
|
||||
|
||||
static inline unsigned char vga_mm_rseq (void __iomem *regbase, unsigned char reg)
|
||||
{
|
||||
vga_mm_w (regbase, VGA_SEQ_I, reg);
|
||||
return vga_mm_r (regbase, VGA_SEQ_D);
|
||||
}
|
||||
|
||||
static inline void vga_mm_wseq (void __iomem *regbase, unsigned char reg, unsigned char val)
|
||||
{
|
||||
#ifdef VGA_OUTW_WRITE
|
||||
vga_mm_w_fast (regbase, VGA_SEQ_I, reg, val);
|
||||
#else
|
||||
vga_mm_w (regbase, VGA_SEQ_I, reg);
|
||||
vga_mm_w (regbase, VGA_SEQ_D, val);
|
||||
#endif /* VGA_OUTW_WRITE */
|
||||
}
|
||||
|
||||
/*
|
||||
* VGA graphics controller register read/write
|
||||
*/
|
||||
|
||||
static inline unsigned char vga_rgfx (void __iomem *regbase, unsigned char reg)
|
||||
{
|
||||
vga_w (regbase, VGA_GFX_I, reg);
|
||||
return vga_r (regbase, VGA_GFX_D);
|
||||
}
|
||||
|
||||
static inline void vga_wgfx (void __iomem *regbase, unsigned char reg, unsigned char val)
|
||||
{
|
||||
#ifdef VGA_OUTW_WRITE
|
||||
vga_w_fast (regbase, VGA_GFX_I, reg, val);
|
||||
#else
|
||||
vga_w (regbase, VGA_GFX_I, reg);
|
||||
vga_w (regbase, VGA_GFX_D, val);
|
||||
#endif /* VGA_OUTW_WRITE */
|
||||
}
|
||||
|
||||
static inline unsigned char vga_io_rgfx (unsigned char reg)
|
||||
{
|
||||
vga_io_w (VGA_GFX_I, reg);
|
||||
return vga_io_r (VGA_GFX_D);
|
||||
}
|
||||
|
||||
static inline void vga_io_wgfx (unsigned char reg, unsigned char val)
|
||||
{
|
||||
#ifdef VGA_OUTW_WRITE
|
||||
vga_io_w_fast (VGA_GFX_I, reg, val);
|
||||
#else
|
||||
vga_io_w (VGA_GFX_I, reg);
|
||||
vga_io_w (VGA_GFX_D, val);
|
||||
#endif /* VGA_OUTW_WRITE */
|
||||
}
|
||||
|
||||
static inline unsigned char vga_mm_rgfx (void __iomem *regbase, unsigned char reg)
|
||||
{
|
||||
vga_mm_w (regbase, VGA_GFX_I, reg);
|
||||
return vga_mm_r (regbase, VGA_GFX_D);
|
||||
}
|
||||
|
||||
static inline void vga_mm_wgfx (void __iomem *regbase, unsigned char reg, unsigned char val)
|
||||
{
|
||||
#ifdef VGA_OUTW_WRITE
|
||||
vga_mm_w_fast (regbase, VGA_GFX_I, reg, val);
|
||||
#else
|
||||
vga_mm_w (regbase, VGA_GFX_I, reg);
|
||||
vga_mm_w (regbase, VGA_GFX_D, val);
|
||||
#endif /* VGA_OUTW_WRITE */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* VGA attribute controller register read/write
|
||||
*/
|
||||
|
||||
static inline unsigned char vga_rattr (void __iomem *regbase, unsigned char reg)
|
||||
{
|
||||
vga_w (regbase, VGA_ATT_IW, reg);
|
||||
return vga_r (regbase, VGA_ATT_R);
|
||||
}
|
||||
|
||||
static inline void vga_wattr (void __iomem *regbase, unsigned char reg, unsigned char val)
|
||||
{
|
||||
vga_w (regbase, VGA_ATT_IW, reg);
|
||||
vga_w (regbase, VGA_ATT_W, val);
|
||||
}
|
||||
|
||||
static inline unsigned char vga_io_rattr (unsigned char reg)
|
||||
{
|
||||
vga_io_w (VGA_ATT_IW, reg);
|
||||
return vga_io_r (VGA_ATT_R);
|
||||
}
|
||||
|
||||
static inline void vga_io_wattr (unsigned char reg, unsigned char val)
|
||||
{
|
||||
vga_io_w (VGA_ATT_IW, reg);
|
||||
vga_io_w (VGA_ATT_W, val);
|
||||
}
|
||||
|
||||
static inline unsigned char vga_mm_rattr (void __iomem *regbase, unsigned char reg)
|
||||
{
|
||||
vga_mm_w (regbase, VGA_ATT_IW, reg);
|
||||
return vga_mm_r (regbase, VGA_ATT_R);
|
||||
}
|
||||
|
||||
static inline void vga_mm_wattr (void __iomem *regbase, unsigned char reg, unsigned char val)
|
||||
{
|
||||
vga_mm_w (regbase, VGA_ATT_IW, reg);
|
||||
vga_mm_w (regbase, VGA_ATT_W, val);
|
||||
}
|
||||
|
||||
#endif /* __linux_video_vga_h__ */
|
Reference in New Issue
Block a user