diff options
author | Hans Petter Selasky <hselasky@FreeBSD.org> | 2014-05-30 13:39:58 +0000 |
---|---|---|
committer | Hans Petter Selasky <hselasky@FreeBSD.org> | 2014-05-30 13:39:58 +0000 |
commit | ccc29eb1b93fcc740edc24c861f6fb68bb39c5ef (patch) | |
tree | 23e6bc05bee34a3e9401aaec0ae2c7cef968493b /sys/boot/usb/bsd_kernel.h | |
parent | 6eda7f75c13f9a8debc2d4794c2a344ebf857d7a (diff) | |
download | src-ccc29eb1b93fcc740edc24c861f6fb68bb39c5ef.tar.gz src-ccc29eb1b93fcc740edc24c861f6fb68bb39c5ef.zip |
USB boot library improvements:
- Make the USB boot library more configurable.
- Resolve compile issues when cross building.
- Allow use of separate malloc.
- Allow use of separate endian macros.
Sponsored by: DARPA, AFRL
Notes
Notes:
svn path=/head/; revision=266882
Diffstat (limited to 'sys/boot/usb/bsd_kernel.h')
-rw-r--r-- | sys/boot/usb/bsd_kernel.h | 62 |
1 files changed, 48 insertions, 14 deletions
diff --git a/sys/boot/usb/bsd_kernel.h b/sys/boot/usb/bsd_kernel.h index 40d2bf71fd44..9acbdc35da4a 100644 --- a/sys/boot/usb/bsd_kernel.h +++ b/sys/boot/usb/bsd_kernel.h @@ -28,7 +28,8 @@ #define _BSD_KERNEL_H_ #define _KERNEL -#define __FreeBSD_version 1000000 +#undef __FreeBSD_version +#define __FreeBSD_version 1100000 #include <sys/cdefs.h> #include <sys/queue.h> @@ -92,8 +93,11 @@ SYSINIT_ENTRY(uniq##_entry, "sysuninit", (subs), \ #define BUS_SPACE_BARRIER_READ 0x01 #define BUS_SPACE_BARRIER_WRITE 0x02 #define hz 1000 +#undef PAGE_SIZE #define PAGE_SIZE 4096 +#undef MIN #define MIN(a,b) (((a) < (b)) ? (a) : (b)) +#undef MAX #define MAX(a,b) (((a) > (b)) ? (a) : (b)) #define MTX_DEF 0 #define MTX_SPIN 0 @@ -104,10 +108,15 @@ SYSINIT_ENTRY(uniq##_entry, "sysuninit", (subs), \ #define cold 0 #define BUS_PROBE_GENERIC 0 #define CALLOUT_RETURNUNLOCKED 0x1 +#undef va_list #define va_list __builtin_va_list +#undef va_size #define va_size(type) __builtin_va_size(type) +#undef va_start #define va_start(ap, last) __builtin_va_start(ap, last) +#undef va_end #define va_end(ap) __builtin_va_end(ap) +#undef va_arg #define va_arg(ap, type) __builtin_va_arg((ap), type) #define DEVICE_ATTACH(dev, ...) \ (((device_attach_t *)(device_get_method(dev, "device_attach")))(dev,## __VA_ARGS__)) @@ -150,23 +159,38 @@ struct thread; struct malloc_type; struct usb_process; +#ifndef HAVE_STANDARD_DEFS +#define _UINT8_T_DECLARED typedef unsigned char uint8_t; +#define _INT8_T_DECLARED typedef signed char int8_t; - +#define _UINT16_T_DECLARED typedef unsigned short uint16_t; +#define _INT16_T_DECLARED typedef signed short int16_t; - +#define _UINT32_T_DECLARED typedef unsigned int uint32_t; +#define _INT32_T_DECLARED typedef signed int int32_t; - +#define _UINT64_T_DECLARED typedef unsigned long long uint64_t; +#define _INT16_T_DECLARED typedef signed long long int64_t; -typedef unsigned long bus_addr_t; -typedef unsigned long bus_size_t; +typedef uint16_t uid_t; +typedef uint16_t gid_t; +typedef uint16_t mode_t; + +typedef uint8_t *caddr_t; +typedef unsigned long __uintptr_t; +typedef unsigned long uintptr_t; typedef unsigned long size_t; typedef unsigned long u_long; +#endif + +typedef unsigned long bus_addr_t; +typedef unsigned long bus_size_t; typedef void *bus_dmamap_t; typedef void *bus_dma_tag_t; @@ -174,14 +198,6 @@ typedef void *bus_dma_tag_t; typedef void *bus_space_tag_t; typedef uint8_t *bus_space_handle_t; -typedef uint16_t uid_t; -typedef uint16_t gid_t; -typedef uint16_t mode_t; - -typedef uint8_t *caddr_t; -typedef unsigned long __uintptr_t; -typedef unsigned long uintptr_t; - /* SYSINIT API */ #include <sysinit.h> @@ -414,17 +430,31 @@ size_t strlen(const char *s); /* MALLOC API */ +#ifndef HAVE_MALLOC +#undef malloc #define malloc(s,x,f) usb_malloc(s) void *usb_malloc(size_t); +#undef free #define free(p,x) usb_free(p) void usb_free(void *); +#else +#undef malloc +void *malloc(size_t); +#define malloc(s,x,f) malloc(s) + +#undef free +void free(void *); +#define free(p,x) free(p) +#endif #define strdup(p,x) usb_strdup(p) char *usb_strdup(const char *str); /* ENDIANNESS */ +#ifndef HAVE_ENDIAN_DEFS + /* Assume little endian */ #define htole64(x) ((uint64_t)(x)) @@ -439,6 +469,10 @@ char *usb_strdup(const char *str); #define be32toh(x) ((uint32_t)(x)) #define htobe32(x) ((uint32_t)(x)) +#else +#include <sys/endian.h> +#endif + /* USB */ typedef int usb_handle_request_t (device_t dev, const void *req, void **pptr, uint16_t *plen, uint16_t offset, uint8_t *pstate); |