diff --git a/drivers/ddk/debug/dbglog.c b/drivers/ddk/debug/dbglog.c index 736b77659c..bb964ebb41 100644 --- a/drivers/ddk/debug/dbglog.c +++ b/drivers/ddk/debug/dbglog.c @@ -103,14 +103,14 @@ int vsnprintf(char *s, size_t n, const char *format, va_list arg); int printf(const char* format, ...) { - char txtbuf[256]; + char txtbuf[1024]; int len = 0; va_list ap; va_start(ap, format); if (format) - len = vsnprintf(txtbuf, 256, format, ap); + len = vsnprintf(txtbuf, 1024, format, ap); va_end(ap); if( len ) @@ -122,7 +122,7 @@ int printf(const char* format, ...) int dbgprintf(const char* format, ...) { - char txtbuf[256]; + char txtbuf[1024]; unsigned writes; int len = 0; @@ -130,7 +130,7 @@ int dbgprintf(const char* format, ...) va_start(ap, format); if (format) - len = vsnprintf(txtbuf, 256, format, ap); + len = vsnprintf(txtbuf, 1024, format, ap); va_end(ap); if( len ) @@ -150,7 +150,7 @@ int dbgprintf(const char* format, ...) int xf86DrvMsg(int skip, int code, const char* format, ...) { - char txtbuf[256]; + char txtbuf[1024]; unsigned writes; va_list ap; @@ -158,7 +158,7 @@ int xf86DrvMsg(int skip, int code, const char* format, ...) va_start(ap, format); if (format) - len = vsnprintf(txtbuf, 256, format, ap); + len = vsnprintf(txtbuf, 1024, format, ap); va_end(ap); if( len ) diff --git a/drivers/ddk/linux/ctype.c b/drivers/ddk/linux/ctype.c new file mode 100644 index 0000000000..2242d4d5ee --- /dev/null +++ b/drivers/ddk/linux/ctype.c @@ -0,0 +1,36 @@ +/* + * linux/lib/ctype.c + * + * Copyright (C) 1991, 1992 Linus Torvalds + */ + +#include +#include + +const unsigned char _ctype[] = { +_C,_C,_C,_C,_C,_C,_C,_C, /* 0-7 */ +_C,_C|_S,_C|_S,_C|_S,_C|_S,_C|_S,_C,_C, /* 8-15 */ +_C,_C,_C,_C,_C,_C,_C,_C, /* 16-23 */ +_C,_C,_C,_C,_C,_C,_C,_C, /* 24-31 */ +_S|_SP,_P,_P,_P,_P,_P,_P,_P, /* 32-39 */ +_P,_P,_P,_P,_P,_P,_P,_P, /* 40-47 */ +_D,_D,_D,_D,_D,_D,_D,_D, /* 48-55 */ +_D,_D,_P,_P,_P,_P,_P,_P, /* 56-63 */ +_P,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U, /* 64-71 */ +_U,_U,_U,_U,_U,_U,_U,_U, /* 72-79 */ +_U,_U,_U,_U,_U,_U,_U,_U, /* 80-87 */ +_U,_U,_U,_P,_P,_P,_P,_P, /* 88-95 */ +_P,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L, /* 96-103 */ +_L,_L,_L,_L,_L,_L,_L,_L, /* 104-111 */ +_L,_L,_L,_L,_L,_L,_L,_L, /* 112-119 */ +_L,_L,_L,_P,_P,_P,_P,_C, /* 120-127 */ +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 128-143 */ +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 144-159 */ +_S|_SP,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P, /* 160-175 */ +_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P, /* 176-191 */ +_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U, /* 192-207 */ +_U,_U,_U,_U,_U,_U,_U,_P,_U,_U,_U,_U,_U,_U,_U,_L, /* 208-223 */ +_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L, /* 224-239 */ +_L,_L,_L,_L,_L,_L,_L,_P,_L,_L,_L,_L,_L,_L,_L,_L}; /* 240-255 */ + +EXPORT_SYMBOL(_ctype); diff --git a/drivers/devman/dmdev.h b/drivers/devman/dmdev.h new file mode 100644 index 0000000000..b28561c4de --- /dev/null +++ b/drivers/devman/dmdev.h @@ -0,0 +1,16 @@ + +#ifndef __DMDEV_H__ +#define __DMDEV_H__ + + +typedef struct +{ + struct list_head list; + uint32_t type; + struct acpi_device *acpi_dev; + struct pci_dev *pci_dev; + +}dmdev_t; + + +#endif /* __DMDEV_H_ */ diff --git a/drivers/include/linux/asm/div64.h b/drivers/include/linux/asm/div64.h new file mode 100644 index 0000000000..0454c86891 --- /dev/null +++ b/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 + +/* + * 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 +#endif /* CONFIG_X86_32 */ + +#endif /* _ASM_X86_DIV64_H */ diff --git a/drivers/include/linux/ctype.h b/drivers/include/linux/ctype.h new file mode 100644 index 0000000000..3f81041a95 --- /dev/null +++ b/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 diff --git a/drivers/include/linux/kernel.h b/drivers/include/linux/kernel.h index 5eb2373716..dc23f601fe 100644 --- a/drivers/include/linux/kernel.h +++ b/drivers/include/linux/kernel.h @@ -113,6 +113,18 @@ static inline void *kcalloc(size_t n, size_t size, uint32_t flags) 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__ */ diff --git a/drivers/include/linux/pci.h b/drivers/include/linux/pci.h index 839b4f300b..e6ef9f03ac 100644 --- a/drivers/include/linux/pci.h +++ b/drivers/include/linux/pci.h @@ -371,6 +371,8 @@ struct pci_dev { 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 @@ unsigned int pci_scan_child_bus(struct pci_bus *bus); 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) {