ddk: missing files

git-svn-id: svn://kolibrios.org@1870 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Sergey Semyonov (Serge) 2011-02-16 18:08:06 +00:00
parent 1a1c5168f8
commit 888c0bb31e
7 changed files with 188 additions and 6 deletions

View File

@ -103,14 +103,14 @@ int vsnprintf(char *s, size_t n, const char *format, va_list arg);
int printf(const char* format, ...) int printf(const char* format, ...)
{ {
char txtbuf[256]; char txtbuf[1024];
int len = 0; int len = 0;
va_list ap; va_list ap;
va_start(ap, format); va_start(ap, format);
if (format) if (format)
len = vsnprintf(txtbuf, 256, format, ap); len = vsnprintf(txtbuf, 1024, format, ap);
va_end(ap); va_end(ap);
if( len ) if( len )
@ -122,7 +122,7 @@ int printf(const char* format, ...)
int dbgprintf(const char* format, ...) int dbgprintf(const char* format, ...)
{ {
char txtbuf[256]; char txtbuf[1024];
unsigned writes; unsigned writes;
int len = 0; int len = 0;
@ -130,7 +130,7 @@ int dbgprintf(const char* format, ...)
va_start(ap, format); va_start(ap, format);
if (format) if (format)
len = vsnprintf(txtbuf, 256, format, ap); len = vsnprintf(txtbuf, 1024, format, ap);
va_end(ap); va_end(ap);
if( len ) if( len )
@ -150,7 +150,7 @@ int dbgprintf(const char* format, ...)
int xf86DrvMsg(int skip, int code, const char* format, ...) int xf86DrvMsg(int skip, int code, const char* format, ...)
{ {
char txtbuf[256]; char txtbuf[1024];
unsigned writes; unsigned writes;
va_list ap; va_list ap;
@ -158,7 +158,7 @@ int xf86DrvMsg(int skip, int code, const char* format, ...)
va_start(ap, format); va_start(ap, format);
if (format) if (format)
len = vsnprintf(txtbuf, 256, format, ap); len = vsnprintf(txtbuf, 1024, format, ap);
va_end(ap); va_end(ap);
if( len ) if( len )

36
drivers/ddk/linux/ctype.c Normal file
View File

@ -0,0 +1,36 @@
/*
* linux/lib/ctype.c
*
* Copyright (C) 1991, 1992 Linus Torvalds
*/
#include <linux/ctype.h>
#include <linux/module.h>
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);

16
drivers/devman/dmdev.h Normal file
View File

@ -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_ */

View File

@ -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 */

View File

@ -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

View File

@ -113,6 +113,18 @@ static inline void *kcalloc(size_t n, size_t size, uint32_t flags)
return kzalloc(n * size, 0); 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); void free (void *ptr);
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */

View File

@ -371,6 +371,8 @@ struct pci_dev {
pci_channel_state_t error_state; /* current connectivity state */ pci_channel_state_t error_state; /* current connectivity state */
struct device dev; /* Generic device interface */ struct device dev; /* Generic device interface */
struct acpi_device *acpi_dev;
int cfg_size; /* Size of configuration space */ 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); void pcibios_fixup_bus(struct pci_bus *b);
u8 pci_swizzle_interrupt_pin(struct pci_dev *dev, u8 pin); 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) static inline bool pci_is_root_bus(struct pci_bus *pbus)
{ {