/drivers/include/linux/asm/div64.h |
---|
0,0 → 1,60 |
#ifndef _ASM_X86_DIV64_H |
#define _ASM_X86_DIV64_H |
#ifdef CONFIG_X86_32 |
#include <linux/types.h> |
/* |
* do_div() is NOT a C function. It wants to return |
* two values (the quotient and the remainder), but |
* since that doesn't work very well in C, what it |
* does is: |
* |
* - modifies the 64-bit dividend _in_place_ |
* - returns the 32-bit remainder |
* |
* This ends up being the most efficient "calling |
* convention" on x86. |
*/ |
#define do_div(n, base) \ |
({ \ |
unsigned long __upper, __low, __high, __mod, __base; \ |
__base = (base); \ |
asm("":"=a" (__low), "=d" (__high) : "A" (n)); \ |
__upper = __high; \ |
if (__high) { \ |
__upper = __high % (__base); \ |
__high = __high / (__base); \ |
} \ |
asm("divl %2":"=a" (__low), "=d" (__mod) \ |
: "rm" (__base), "0" (__low), "1" (__upper)); \ |
asm("":"=A" (n) : "a" (__low), "d" (__high)); \ |
__mod; \ |
}) |
static inline u64 div_u64_rem(u64 dividend, u32 divisor, u32 *remainder) |
{ |
union { |
u64 v64; |
u32 v32[2]; |
} d = { dividend }; |
u32 upper; |
upper = d.v32[1]; |
d.v32[1] = 0; |
if (upper >= divisor) { |
d.v32[1] = upper / divisor; |
upper %= divisor; |
} |
asm ("divl %2" : "=a" (d.v32[0]), "=d" (*remainder) : |
"rm" (divisor), "0" (d.v32[0]), "1" (upper)); |
return d.v64; |
} |
#define div_u64_rem div_u64_rem |
#else |
# include <asm-generic/div64.h> |
#endif /* CONFIG_X86_32 */ |
#endif /* _ASM_X86_DIV64_H */ |
/drivers/include/linux/ctype.h |
---|
0,0 → 1,55 |
#ifndef _LINUX_CTYPE_H |
#define _LINUX_CTYPE_H |
/* |
* NOTE! This ctype does not handle EOF like the standard C |
* library is required to. |
*/ |
#define _U 0x01 /* upper */ |
#define _L 0x02 /* lower */ |
#define _D 0x04 /* digit */ |
#define _C 0x08 /* cntrl */ |
#define _P 0x10 /* punct */ |
#define _S 0x20 /* white space (space/lf/tab) */ |
#define _X 0x40 /* hex digit */ |
#define _SP 0x80 /* hard space (0x20) */ |
extern const unsigned char _ctype[]; |
#define __ismask(x) (_ctype[(int)(unsigned char)(x)]) |
#define isalnum(c) ((__ismask(c)&(_U|_L|_D)) != 0) |
#define isalpha(c) ((__ismask(c)&(_U|_L)) != 0) |
#define iscntrl(c) ((__ismask(c)&(_C)) != 0) |
#define isdigit(c) ((__ismask(c)&(_D)) != 0) |
#define isgraph(c) ((__ismask(c)&(_P|_U|_L|_D)) != 0) |
#define islower(c) ((__ismask(c)&(_L)) != 0) |
#define isprint(c) ((__ismask(c)&(_P|_U|_L|_D|_SP)) != 0) |
#define ispunct(c) ((__ismask(c)&(_P)) != 0) |
/* Note: isspace() must return false for %NUL-terminator */ |
#define isspace(c) ((__ismask(c)&(_S)) != 0) |
#define isupper(c) ((__ismask(c)&(_U)) != 0) |
#define isxdigit(c) ((__ismask(c)&(_D|_X)) != 0) |
#define isascii(c) (((unsigned char)(c))<=0x7f) |
#define toascii(c) (((unsigned char)(c))&0x7f) |
static inline unsigned char __tolower(unsigned char c) |
{ |
if (isupper(c)) |
c -= 'A'-'a'; |
return c; |
} |
static inline unsigned char __toupper(unsigned char c) |
{ |
if (islower(c)) |
c -= 'a'-'A'; |
return c; |
} |
#define tolower(c) __tolower(c) |
#define toupper(c) __toupper(c) |
#endif |
/drivers/include/linux/kernel.h |
---|
113,6 → 113,18 |
return kzalloc(n * size, 0); |
} |
extern const char hex_asc[]; |
#define hex_asc_lo(x) hex_asc[((x) & 0x0f)] |
#define hex_asc_hi(x) hex_asc[((x) & 0xf0) >> 4] |
static inline char *pack_hex_byte(char *buf, u8 byte) |
{ |
*buf++ = hex_asc_hi(byte); |
*buf++ = hex_asc_lo(byte); |
return buf; |
} |
void free (void *ptr); |
#endif /* __KERNEL__ */ |
/drivers/include/linux/pci.h |
---|
371,6 → 371,8 |
pci_channel_state_t error_state; /* current connectivity state */ |
struct device dev; /* Generic device interface */ |
struct acpi_device *acpi_dev; |
int cfg_size; /* Size of configuration space */ |
/* |
577,6 → 579,7 |
void pcibios_fixup_bus(struct pci_bus *b); |
u8 pci_swizzle_interrupt_pin(struct pci_dev *dev, u8 pin); |
struct pci_dev * pci_get_slot(struct pci_bus *bus, unsigned int devfn); |
static inline bool pci_is_root_bus(struct pci_bus *pbus) |
{ |