diff --git a/newlib-files/asm/byteorder.h b/newlib-files/asm/byteorder.h new file mode 100644 index 0000000..cf5da9f --- /dev/null +++ b/newlib-files/asm/byteorder.h @@ -0,0 +1,371 @@ +typedef __signed__ char __s8; +typedef unsigned char __u8; + +typedef __signed__ short __s16; +typedef unsigned short __u16; + +typedef __signed__ int __s32; +typedef unsigned int __u32; + +typedef unsigned char u_int8_t; +typedef unsigned short u_int16_t; +typedef unsigned int u_int32_t; + + +__extension__ typedef __signed__ long long __s64; +__extension__ typedef unsigned long long __u64; +# 8 "/usr/include/asm-generic/types.h" 2 3 4 +# 5 "/usr/include/asm/types.h" 2 3 4 +# 5 "/usr/include/linux/types.h" 2 3 4 + + + +# 1 "/usr/include/linux/posix_types.h" 1 3 4 + + + +# 1 "/usr/include/linux/stddef.h" 1 3 4 +# 14 "/usr/include/linux/stddef.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-pc-linux-gnu/4.6.3/include/stddef.h" 1 3 4 +# 150 "/usr/lib/gcc/x86_64-pc-linux-gnu/4.6.3/include/stddef.h" 3 4 +typedef long int ptrdiff_t; +# 212 "/usr/lib/gcc/x86_64-pc-linux-gnu/4.6.3/include/stddef.h" 3 4 +typedef long unsigned int size_t; +# 324 "/usr/lib/gcc/x86_64-pc-linux-gnu/4.6.3/include/stddef.h" 3 4 +typedef int wchar_t; +# 15 "/usr/include/linux/stddef.h" 2 3 4 +# 5 "/usr/include/linux/posix_types.h" 2 3 4 +# 36 "/usr/include/linux/posix_types.h" 3 4 +typedef struct { + unsigned long fds_bits [(1024/(8 * sizeof(unsigned long)))]; +} __kernel_fd_set; + + +typedef void (*__kernel_sighandler_t)(int); + + +typedef int __kernel_key_t; +typedef int __kernel_mqd_t; + +# 1 "/usr/include/asm/posix_types.h" 1 3 4 + + + +# 1 "/usr/include/asm/posix_types_64.h" 1 3 4 +# 10 "/usr/include/asm/posix_types_64.h" 3 4 +typedef unsigned long __kernel_ino_t; +typedef unsigned int __kernel_mode_t; +typedef unsigned long __kernel_nlink_t; +typedef long __kernel_off_t; +typedef int __kernel_pid_t; +typedef int __kernel_ipc_pid_t; +typedef unsigned int __kernel_uid_t; +typedef unsigned int __kernel_gid_t; +typedef unsigned long __kernel_size_t; +typedef long __kernel_ssize_t; +typedef long __kernel_ptrdiff_t; +typedef long __kernel_time_t; +typedef long __kernel_suseconds_t; +typedef long __kernel_clock_t; +typedef int __kernel_timer_t; +typedef int __kernel_clockid_t; +typedef int __kernel_daddr_t; +typedef char * __kernel_caddr_t; +typedef unsigned short __kernel_uid16_t; +typedef unsigned short __kernel_gid16_t; + + +typedef long long __kernel_loff_t; + + +typedef struct { + int val[2]; +} __kernel_fsid_t; + +typedef unsigned short __kernel_old_uid_t; +typedef unsigned short __kernel_old_gid_t; +typedef __kernel_uid_t __kernel_uid32_t; +typedef __kernel_gid_t __kernel_gid32_t; + +typedef unsigned long __kernel_old_dev_t; +# 5 "/usr/include/asm/posix_types.h" 2 3 4 +# 48 "/usr/include/linux/posix_types.h" 2 3 4 +# 9 "/usr/include/linux/types.h" 2 3 4 +# 27 "/usr/include/linux/types.h" 3 4 +typedef __u16 __le16; +typedef __u16 __be16; +typedef __u32 __le32; +typedef __u32 __be32; +typedef __u64 __le64; +typedef __u64 __be64; + +typedef __u16 __sum16; +typedef __u32 __wsum; +# 12 "/usr/include/linux/byteorder/little_endian.h" 2 3 4 +# 1 "/usr/include/linux/swab.h" 1 3 4 + + + + + +# 1 "/usr/include/asm/swab.h" 1 3 4 + + + + + + +static __inline__ __u32 __arch_swab32(__u32 val) +{ +# 21 "/usr/include/asm/swab.h" 3 4 + __asm__("bswapl %0" + : "=r" (val) + : "0" (val)); + + return val; +} + + +static __inline__ __u64 __arch_swab64(__u64 val) +{ +# 53 "/usr/include/asm/swab.h" 3 4 + __asm__("bswapq %0" + : "=r" (val) + : "0" (val)); + return val; + +} +# 7 "/usr/include/linux/swab.h" 2 3 4 +# 46 "/usr/include/linux/swab.h" 3 4 +static __inline__ __u16 __fswab16(__u16 val) +{ + + + + return ((__u16)( (((__u16)(val) & (__u16)0x00ffU) << 8) | (((__u16)(val) & (__u16)0xff00U) >> 8))); + +} + +static __inline__ __u32 __fswab32(__u32 val) +{ + + return __arch_swab32(val); + + + +} + +static __inline__ __u64 __fswab64(__u64 val) +{ + + return __arch_swab64(val); + + + + + + + +} + +static __inline__ __u32 __fswahw32(__u32 val) +{ + + + + return ((__u32)( (((__u32)(val) & (__u32)0x0000ffffUL) << 16) | (((__u32)(val) & (__u32)0xffff0000UL) >> 16))); + +} + +static __inline__ __u32 __fswahb32(__u32 val) +{ + + + + return ((__u32)( (((__u32)(val) & (__u32)0x00ff00ffUL) << 8) | (((__u32)(val) & (__u32)0xff00ff00UL) >> 8))); + +} +# 148 "/usr/include/linux/swab.h" 3 4 +static __inline__ __u16 __swab16p(const __u16 *p) +{ + + + + return (__builtin_constant_p((__u16)(*p)) ? ((__u16)( (((__u16)(*p) & (__u16)0x00ffU) << 8) | (((__u16)(*p) & (__u16)0xff00U) >> 8))) : __fswab16(*p)); + +} + + + + + +static __inline__ __u32 __swab32p(const __u32 *p) +{ + + + + return (__builtin_constant_p((__u32)(*p)) ? ((__u32)( (((__u32)(*p) & (__u32)0x000000ffUL) << 24) | (((__u32)(*p) & (__u32)0x0000ff00UL) << 8) | (((__u32)(*p) & (__u32)0x00ff0000UL) >> 8) | (((__u32)(*p) & (__u32)0xff000000UL) >> 24))) : __fswab32(*p)); + +} + + + + + +static __inline__ __u64 __swab64p(const __u64 *p) +{ + + + + return (__builtin_constant_p((__u64)(*p)) ? ((__u64)( (((__u64)(*p) & (__u64)0x00000000000000ffULL) << 56) | (((__u64)(*p) & (__u64)0x000000000000ff00ULL) << 40) | (((__u64)(*p) & (__u64)0x0000000000ff0000ULL) << 24) | (((__u64)(*p) & (__u64)0x00000000ff000000ULL) << 8) | (((__u64)(*p) & (__u64)0x000000ff00000000ULL) >> 8) | (((__u64)(*p) & (__u64)0x0000ff0000000000ULL) >> 24) | (((__u64)(*p) & (__u64)0x00ff000000000000ULL) >> 40) | (((__u64)(*p) & (__u64)0xff00000000000000ULL) >> 56))) : __fswab64(*p)); + +} + + + + + + + +static __inline__ __u32 __swahw32p(const __u32 *p) +{ + + + + return (__builtin_constant_p((__u32)(*p)) ? ((__u32)( (((__u32)(*p) & (__u32)0x0000ffffUL) << 16) | (((__u32)(*p) & (__u32)0xffff0000UL) >> 16))) : __fswahw32(*p)); + +} + + + + + + + +static __inline__ __u32 __swahb32p(const __u32 *p) +{ + + + + return (__builtin_constant_p((__u32)(*p)) ? ((__u32)( (((__u32)(*p) & (__u32)0x00ff00ffUL) << 8) | (((__u32)(*p) & (__u32)0xff00ff00UL) >> 8))) : __fswahb32(*p)); + +} + + + + + +static __inline__ void __swab16s(__u16 *p) +{ + + + + *p = __swab16p(p); + +} + + + + +static __inline__ void __swab32s(__u32 *p) +{ + + + + *p = __swab32p(p); + +} + + + + + +static __inline__ void __swab64s(__u64 *p) +{ + + + + *p = __swab64p(p); + +} + + + + + + + +static __inline__ void __swahw32s(__u32 *p) +{ + + + + *p = __swahw32p(p); + +} + + + + + + + +static __inline__ void __swahb32s(__u32 *p) +{ + + + + *p = __swahb32p(p); + +} +# 13 "/usr/include/linux/byteorder/little_endian.h" 2 3 4 +# 43 "/usr/include/linux/byteorder/little_endian.h" 3 4 +static __inline__ __le64 __cpu_to_le64p(const __u64 *p) +{ + return (__le64)*p; +} +static __inline__ __u64 __le64_to_cpup(const __le64 *p) +{ + return (__u64)*p; +} +static __inline__ __le32 __cpu_to_le32p(const __u32 *p) +{ + return (__le32)*p; +} +static __inline__ __u32 __le32_to_cpup(const __le32 *p) +{ + return (__u32)*p; +} +static __inline__ __le16 __cpu_to_le16p(const __u16 *p) +{ + return (__le16)*p; +} +static __inline__ __u16 __le16_to_cpup(const __le16 *p) +{ + return (__u16)*p; +} +static __inline__ __be64 __cpu_to_be64p(const __u64 *p) +{ + return (__be64)__swab64p(p); +} +static __inline__ __u64 __be64_to_cpup(const __be64 *p) +{ + return __swab64p((__u64 *)p); +} +static __inline__ __be32 __cpu_to_be32p(const __u32 *p) +{ + return (__be32)__swab32p(p); +} +static __inline__ __u32 __be32_to_cpup(const __be32 *p) +{ + return __swab32p((__u32 *)p); +} +static __inline__ __be16 __cpu_to_be16p(const __u16 *p) +{ + return (__be16)__swab16p(p); +} +static __inline__ __u16 __be16_to_cpup(const __be16 *p) +{ + return __swab16p((__u16 *)p); +} +# 5 "/usr/include/asm/byteorder.h" 2 diff --git a/newlib-files/asm/io.h b/newlib-files/asm/io.h new file mode 100644 index 0000000..a0418ea --- /dev/null +++ b/newlib-files/asm/io.h @@ -0,0 +1,141 @@ +extern int ioperm (unsigned long int __from, unsigned long int __num, + int __turn_on) __attribute__ ((__nothrow__ )); + + +//extern int iopl (int __level) __attribute__ ((__nothrow__ )); +int iopl(int level){return 0;} + +static __inline unsigned char +inb (unsigned short int __port) +{ + unsigned char _v; + + __asm__ __volatile__ ("inb %w1,%0":"=a" (_v):"Nd" (__port)); + return _v; +} + +static __inline unsigned char +inb_p (unsigned short int __port) +{ + unsigned char _v; + + __asm__ __volatile__ ("inb %w1,%0\noutb %%al,$0x80":"=a" (_v):"Nd" (__port)); + return _v; +} + +static __inline unsigned short int +inw (unsigned short int __port) +{ + unsigned short _v; + + __asm__ __volatile__ ("inw %w1,%0":"=a" (_v):"Nd" (__port)); + return _v; +} + +static __inline unsigned short int +inw_p (unsigned short int __port) +{ + unsigned short int _v; + + __asm__ __volatile__ ("inw %w1,%0\noutb %%al,$0x80":"=a" (_v):"Nd" (__port)); + return _v; +} + +static __inline unsigned int +inl (unsigned short int __port) +{ + unsigned int _v; + + __asm__ __volatile__ ("inl %w1,%0":"=a" (_v):"Nd" (__port)); + return _v; +} + +static __inline unsigned int +inl_p (unsigned short int __port) +{ + unsigned int _v; + __asm__ __volatile__ ("inl %w1,%0\noutb %%al,$0x80":"=a" (_v):"Nd" (__port)); + return _v; +} + +static __inline void +outb (unsigned char __value, unsigned short int __port) +{ + __asm__ __volatile__ ("outb %b0,%w1": :"a" (__value), "Nd" (__port)); +} + +static __inline void +outb_p (unsigned char __value, unsigned short int __port) +{ + __asm__ __volatile__ ("outb %b0,%w1\noutb %%al,$0x80": :"a" (__value), + "Nd" (__port)); +} + +static __inline void +outw (unsigned short int __value, unsigned short int __port) +{ + __asm__ __volatile__ ("outw %w0,%w1": :"a" (__value), "Nd" (__port)); + +} + +static __inline void +outw_p (unsigned short int __value, unsigned short int __port) +{ + __asm__ __volatile__ ("outw %w0,%w1\noutb %%al,$0x80": :"a" (__value), + "Nd" (__port)); +} + +static __inline void +outl (unsigned int __value, unsigned short int __port) +{ + __asm__ __volatile__ ("outl %0,%w1": :"a" (__value), "Nd" (__port)); +} + +static __inline void +outl_p (unsigned int __value, unsigned short int __port) +{ + __asm__ __volatile__ ("outl %0,%w1\noutb %%al,$0x80": :"a" (__value), + "Nd" (__port)); +} + +static __inline void +insb (unsigned short int __port, void *addr, unsigned long int __count) +{ + __asm__ __volatile__ ("cld ; rep ; insb":"=D" (addr), "=c" (__count) + :"d" (__port), "0" (addr), "1" (__count)); +} + +static __inline void +insw (unsigned short int __port, void *addr, unsigned long int __count) +{ + __asm__ __volatile__ ("cld ; rep ; insw":"=D" (addr), "=c" (__count) + :"d" (__port), "0" (addr), "1" (__count)); +} + +static __inline void +insl (unsigned short int __port, void *addr, unsigned long int __count) +{ + __asm__ __volatile__ ("cld ; rep ; insl":"=D" (addr), "=c" (__count) + :"d" (__port), "0" (addr), "1" (__count)); +} + +static __inline void +outsb (unsigned short int __port, const void *addr, unsigned long int __count) +{ + __asm__ __volatile__ ("cld ; rep ; outsb":"=S" (addr), "=c" (__count) + :"d" (__port), "0" (addr), "1" (__count)); +} + +static __inline void +outsw (unsigned short int __port, const void *addr, unsigned long int __count) +{ + __asm__ __volatile__ ("cld ; rep ; outsw":"=S" (addr), "=c" (__count) + :"d" (__port), "0" (addr), "1" (__count)); +} + +static __inline void +outsl (unsigned short int __port, const void *addr, unsigned long int __count) +{ + __asm__ __volatile__ ("cld ; rep ; outsl":"=S" (addr), "=c" (__count) + :"d" (__port), "0" (addr), "1" (__count)); +} diff --git a/patches/pciutils.patch b/patches/pciutils.patch new file mode 100644 index 0000000..3226d02 --- /dev/null +++ b/patches/pciutils.patch @@ -0,0 +1,58 @@ +diff -rupN ../pciutils-3.1.9/lib/configure ./lib/configure +--- ../pciutils-3.1.9/lib/configure 2011-01-07 13:04:28.000000000 -0800 ++++ ./lib/configure 2012-06-12 17:08:35.567795369 -0700 +@@ -132,6 +132,14 @@ case $sys in + esac + echo >>$c '#define PCI_HAVE_STDINT_H' + ;; ++ xomb) ++ case $cpu in ++ i?86|x86_64) echo_n " i386-ports" ++ echo >>$c '#define PCI_HAVE_PM_INTEL_CONF' ++ ;; ++ esac ++ echo >>$c '#define PCI_HAVE_64BIT_ADDRESS' ++ ;; + *) + echo " Unfortunately, your OS is not supported by the PCI Library" + exit 1 +diff -rupN ../pciutils-3.1.9/lib/i386-ports.c ./lib/i386-ports.c +--- ../pciutils-3.1.9/lib/i386-ports.c 2011-01-07 13:04:28.000000000 -0800 ++++ ./lib/i386-ports.c 2012-06-12 17:08:35.567795369 -0700 +@@ -26,6 +26,8 @@ + #include "i386-io-haiku.h" + #elif defined(PCI_OS_BEOS) + #include "i386-io-beos.h" ++#elif defined(PCI_OS_XOMB) ++#include "i386-io-linux.h" + #else + #error Do not know how to access I/O ports on this OS. + #endif +diff -rupN ../pciutils-3.1.9/lib/init.c ./lib/init.c +--- ../pciutils-3.1.9/lib/init.c 2011-01-07 13:04:28.000000000 -0800 ++++ ./lib/init.c 2012-06-12 17:08:35.567795369 -0700 +@@ -152,7 +152,7 @@ pci_alloc(void) + int i; + + memset(a, 0, sizeof(*a)); +- pci_set_name_list_path(a, PCI_PATH_IDS_DIR "/" PCI_IDS, 0); ++ pci_set_name_list_path(a, "/data/pci.ids", 0); + #ifdef PCI_USE_DNS + pci_define_param(a, "net.domain", PCI_ID_DOMAIN, "DNS domain used for resolving of ID's"); + pci_define_param(a, "net.cache_name", "~/.pciids-cache", "Name of the ID cache file"); +diff -rupN ../pciutils-3.1.9/lib/types.h ./lib/types.h +--- ../pciutils-3.1.9/lib/types.h 2011-01-07 13:04:28.000000000 -0800 ++++ ./lib/types.h 2012-06-12 17:08:35.568795369 -0700 +@@ -21,9 +21,9 @@ typedef uint8_t u8; + typedef uint16_t u16; + typedef uint32_t u32; + #else +-typedef u_int8_t u8; +-typedef u_int16_t u16; +-typedef u_int32_t u32; ++typedef unsigned char u8; ++typedef unsigned short u16; ++typedef unsigned int u32; + #endif + + #ifdef PCI_HAVE_64BIT_ADDRESS diff --git a/pciutils.sh b/pciutils.sh new file mode 100755 index 0000000..937f681 --- /dev/null +++ b/pciutils.sh @@ -0,0 +1,39 @@ + +source scripts/functions.sh + +# --- Variables --- + +source scripts/nativevars.sh + + +# --- Directory creation --- + +mkdir -p build +mkdir -p $PREFIX +cd build + +setphase "MAKE OBJECT DIRECTORIES" +mkdir -p pciutils-obj + +PCIUTILS_VER=3.1.9 + +# --- Fetch and extract each package --- +wget $WFLAGS ftp://atrey.karlin.mff.cuni.cz/pub/linux/pci/pciutils-${PCIUTILS_VER}.tar.gz +tar -xf pciutils-${PCIUTILS_VER}.tar.gz + +doPatch pciutils + +# --- Compile all packages --- + +setphase "COMPILE PCIUTILS" +cd pciutils-obj +cp -R ../pciutils-${PCIUTILS_VER}/* . || exit + +FLAGS="ZLIB=no DNS=no SHARED=no PREFIX=$PREFIX HOST=$TARGET CROSS_COMPILE=${TARGET}-" + +CMD="make -j$NCPU $FLAGS" +echo ${CMD} +${CMD} LDFLAGS="-g -T../../../xomb/app/build/elf.ld" || exit +setphase "INSTALL PCIUTILS" +make install $FLAGS LDFLAGS="${LDFLAGS}" || exit +cd ..