diff options
-rw-r--r-- | sys/dev/pci/drm/drmP.h | 40 | ||||
-rw-r--r-- | sys/dev/pci/drm/drm_irq.c | 43 | ||||
-rw-r--r-- | sys/dev/pci/drm/drm_linux.c | 81 | ||||
-rw-r--r-- | sys/dev/pci/drm/drm_linux.h | 90 | ||||
-rw-r--r-- | sys/dev/pci/drm/drm_modes.c | 4 | ||||
-rw-r--r-- | sys/dev/pci/drm/i915/i915_gem.c | 7 | ||||
-rw-r--r-- | sys/dev/pci/drm/i915/intel_bios.c | 52 | ||||
-rw-r--r-- | sys/dev/pci/drm/i915/intel_sdvo.c | 13 | ||||
-rw-r--r-- | sys/dev/pci/drm/radeon/r600.c | 12 | ||||
-rw-r--r-- | sys/dev/pci/drm/radeon/radeon_device.c | 5 | ||||
-rw-r--r-- | sys/dev/pci/drm/radeon/radeon_kms.c | 10 | ||||
-rw-r--r-- | sys/dev/pci/drm/ttm/ttm_bo_util.c | 3 | ||||
-rw-r--r-- | sys/dev/pci/drm/ttm/ttm_memory.c | 4 |
13 files changed, 180 insertions, 184 deletions
diff --git a/sys/dev/pci/drm/drmP.h b/sys/dev/pci/drm/drmP.h index 58bc89ad1a4..be8bd447e30 100644 --- a/sys/dev/pci/drm/drmP.h +++ b/sys/dev/pci/drm/drmP.h @@ -1,4 +1,4 @@ -/* $OpenBSD: drmP.h,v 1.184 2015/04/06 10:56:37 jsg Exp $ */ +/* $OpenBSD: drmP.h,v 1.185 2015/04/06 12:25:10 jsg Exp $ */ /* drmP.h -- Private header for Direct Rendering Manager -*- linux-c -*- * Created: Mon Jan 4 10:05:05 1999 by faith@precisioninsight.com */ @@ -884,44 +884,6 @@ struct drm_attach_args { extern int drm_debug_flag; -enum dmi_field { - DMI_NONE, - DMI_BIOS_VENDOR, - DMI_BIOS_VERSION, - DMI_BIOS_DATE, - DMI_SYS_VENDOR, - DMI_PRODUCT_NAME, - DMI_PRODUCT_VERSION, - DMI_PRODUCT_SERIAL, - DMI_PRODUCT_UUID, - DMI_BOARD_VENDOR, - DMI_BOARD_NAME, - DMI_BOARD_VERSION, - DMI_BOARD_SERIAL, - DMI_BOARD_ASSET_TAG, - DMI_CHASSIS_VENDOR, - DMI_CHASSIS_TYPE, - DMI_CHASSIS_VERSION, - DMI_CHASSIS_SERIAL, - DMI_CHASSIS_ASSET_TAG, - DMI_STRING_MAX, -}; - -struct dmi_strmatch { - unsigned char slot; - char substr[79]; -}; - -struct dmi_system_id { - int (*callback)(const struct dmi_system_id *); - const char *ident; - struct dmi_strmatch matches[4]; -}; -#define DMI_MATCH(a, b) {(a), (b)} -#define DMI_EXACT_MATCH(a, b) {(a), (b)} -int dmi_check_system(const struct dmi_system_id *); - - /* Device setup support (drm_drv.c) */ int drm_pciprobe(struct pci_attach_args *, const struct drm_pcidev * ); struct device *drm_attach_pci(struct drm_driver_info *, diff --git a/sys/dev/pci/drm/drm_irq.c b/sys/dev/pci/drm/drm_irq.c index a8b00e3b45c..516245ca7c9 100644 --- a/sys/dev/pci/drm/drm_irq.c +++ b/sys/dev/pci/drm/drm_irq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: drm_irq.c,v 1.60 2015/04/05 12:53:41 kettenis Exp $ */ +/* $OpenBSD: drm_irq.c,v 1.61 2015/04/06 12:25:10 jsg Exp $ */ /** * \file drm_irq.c * IRQ support @@ -54,9 +54,6 @@ */ #define DRM_REDUNDANT_VBLIRQ_THRESH_NS 1000000 -int64_t timeval_to_ns(const struct timeval *); -struct timeval ns_to_timeval(const int64_t); - #ifdef DRM_VBLANK_DEBUG #define DPRINTF(x...) do { printf(x); } while(/* CONSTCOND */ 0) #else @@ -111,44 +108,6 @@ static void clear_vblank_timestamps(struct drm_device *dev, int crtc) DRM_VBLANKTIME_RBSIZE * sizeof(struct timeval)); } -#define NSEC_PER_USEC 1000L -#define NSEC_PER_SEC 1000000000L - -int64_t -timeval_to_ns(const struct timeval *tv) -{ - return ((int64_t)tv->tv_sec * NSEC_PER_SEC) + - tv->tv_usec * NSEC_PER_USEC; -} - -struct timeval -ns_to_timeval(const int64_t nsec) -{ - struct timeval tv; - int32_t rem; - - if (nsec == 0) { - tv.tv_sec = 0; - tv.tv_usec = 0; - return (tv); - } - - tv.tv_sec = nsec / NSEC_PER_SEC; - rem = nsec % NSEC_PER_SEC; - if (rem < 0) { - tv.tv_sec--; - rem += NSEC_PER_SEC; - } - tv.tv_usec = rem / 1000; - return (tv); -} - -static inline int64_t -abs64(int64_t x) -{ - return (x < 0 ? -x : x); -} - /* * Disable vblank irq's on crtc, make sure that last vblank count * of hardware and corresponding consistent software vblank counter diff --git a/sys/dev/pci/drm/drm_linux.c b/sys/dev/pci/drm/drm_linux.c index b269bc718b0..8810360c58c 100644 --- a/sys/dev/pci/drm/drm_linux.c +++ b/sys/dev/pci/drm/drm_linux.c @@ -1,4 +1,4 @@ -/* $OpenBSD: drm_linux.c,v 1.1 2015/04/05 11:53:53 kettenis Exp $ */ +/* $OpenBSD: drm_linux.c,v 1.2 2015/04/06 12:25:10 jsg Exp $ */ /* * Copyright (c) 2013 Jonathan Gray <jsg@openbsd.org> * @@ -38,3 +38,82 @@ ns_to_timespec(const int64_t nsec) ts.tv_nsec = rem; return (ts); } + +int64_t +timeval_to_ns(const struct timeval *tv) +{ + return ((int64_t)tv->tv_sec * NSEC_PER_SEC) + + tv->tv_usec * NSEC_PER_USEC; +} + +struct timeval +ns_to_timeval(const int64_t nsec) +{ + struct timeval tv; + int32_t rem; + + if (nsec == 0) { + tv.tv_sec = 0; + tv.tv_usec = 0; + return (tv); + } + + tv.tv_sec = nsec / NSEC_PER_SEC; + rem = nsec % NSEC_PER_SEC; + if (rem < 0) { + tv.tv_sec--; + rem += NSEC_PER_SEC; + } + tv.tv_usec = rem / 1000; + return (tv); +} + +extern char *hw_vendor, *hw_prod; + +static bool +dmi_found(const struct dmi_system_id *dsi) +{ + int i, slot; + + for (i = 0; i < nitems(dsi->matches); i++) { + slot = dsi->matches[i].slot; + switch (slot) { + case DMI_NONE: + break; + case DMI_SYS_VENDOR: + case DMI_BOARD_VENDOR: + if (hw_vendor != NULL && + !strcmp(hw_vendor, dsi->matches[i].substr)) + break; + else + return false; + case DMI_PRODUCT_NAME: + case DMI_BOARD_NAME: + if (hw_prod != NULL && + !strcmp(hw_prod, dsi->matches[i].substr)) + break; + else + return false; + default: + return false; + } + } + + return true; +} + +int +dmi_check_system(const struct dmi_system_id *sysid) +{ + const struct dmi_system_id *dsi; + int num = 0; + + for (dsi = sysid; dsi->matches[0].slot != 0 ; dsi++) { + if (dmi_found(dsi)) { + num++; + if (dsi->callback && dsi->callback(dsi)) + break; + } + } + return (num); +} diff --git a/sys/dev/pci/drm/drm_linux.h b/sys/dev/pci/drm/drm_linux.h index 4523be481d5..a28a897d1d2 100644 --- a/sys/dev/pci/drm/drm_linux.h +++ b/sys/dev/pci/drm/drm_linux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: drm_linux.h,v 1.11 2015/04/06 08:14:00 kettenis Exp $ */ +/* $OpenBSD: drm_linux.h,v 1.12 2015/04/06 12:25:10 jsg Exp $ */ /* * Copyright (c) 2013, 2014 Mark Kettenis * @@ -113,9 +113,13 @@ spin_unlock_irqrestore(struct mutex *mtxp, __unused unsigned long flags) #define wake_up_all(x) wakeup(x) #define wake_up_all_locked(x) wakeup(x) +#define NSEC_PER_USEC 1000L #define NSEC_PER_SEC 1000000000L +#define KHZ2PICOS(a) (1000000000UL/(a)) extern struct timespec ns_to_timespec(const int64_t); +extern int64_t timeval_to_ns(const struct timeval *); +extern struct timeval ns_to_timeval(const int64_t); static inline int64_t timespec_to_ns(const struct timespec *ts) @@ -144,6 +148,12 @@ timespec_valid(const struct timespec *ts) return (1); } +static inline int64_t +abs64(int64_t x) +{ + return (x < 0 ? -x : x); +} + static inline unsigned long __copy_to_user(void *to, const void *from, unsigned len) { @@ -175,6 +185,84 @@ copy_from_user(void *to, const void *from, unsigned len) #define get_user(x, ptr) -copyin(ptr, &(x), sizeof(x)) #define put_user(x, ptr) -copyout(&(x), ptr, sizeof(x)) +static __inline uint16_t +hweight16(uint32_t x) +{ + x = (x & 0x5555) + ((x & 0xaaaa) >> 1); + x = (x & 0x3333) + ((x & 0xcccc) >> 2); + x = (x + (x >> 4)) & 0x0f0f; + x = (x + (x >> 8)) & 0x00ff; + return (x); +} + +static inline uint32_t +hweight32(uint32_t x) +{ + x = (x & 0x55555555) + ((x & 0xaaaaaaaa) >> 1); + x = (x & 0x33333333) + ((x & 0xcccccccc) >> 2); + x = (x + (x >> 4)) & 0x0f0f0f0f; + x = (x + (x >> 8)); + x = (x + (x >> 16)) & 0x000000ff; + return x; +} + +#define console_lock() +#define console_unlock() + +#ifndef PCI_MEM_START +#define PCI_MEM_START 0 +#endif + +#ifndef PCI_MEM_END +#define PCI_MEM_END 0xffffffff +#endif + +enum dmi_field { + DMI_NONE, + DMI_BIOS_VENDOR, + DMI_BIOS_VERSION, + DMI_BIOS_DATE, + DMI_SYS_VENDOR, + DMI_PRODUCT_NAME, + DMI_PRODUCT_VERSION, + DMI_PRODUCT_SERIAL, + DMI_PRODUCT_UUID, + DMI_BOARD_VENDOR, + DMI_BOARD_NAME, + DMI_BOARD_VERSION, + DMI_BOARD_SERIAL, + DMI_BOARD_ASSET_TAG, + DMI_CHASSIS_VENDOR, + DMI_CHASSIS_TYPE, + DMI_CHASSIS_VERSION, + DMI_CHASSIS_SERIAL, + DMI_CHASSIS_ASSET_TAG, + DMI_STRING_MAX, +}; + +struct dmi_strmatch { + unsigned char slot; + char substr[79]; +}; + +struct dmi_system_id { + int (*callback)(const struct dmi_system_id *); + const char *ident; + struct dmi_strmatch matches[4]; +}; +#define DMI_MATCH(a, b) {(a), (b)} +#define DMI_EXACT_MATCH(a, b) {(a), (b)} +int dmi_check_system(const struct dmi_system_id *); + +#define memcpy_toio(d, s, n) memcpy(d, s, n) + +#define page_to_phys(page) (VM_PAGE_TO_PHYS(page) +#define page_to_pfn(pp) (VM_PAGE_TO_PHYS(pp) / PAGE_SIZE) +#define offset_in_page(off) ((off) & PAGE_MASK) + +#define round_up(x, y) ((((x) + ((y) - 1)) / (y)) * (y)) +#define round_down(x, y) (((x) / (y)) * (y)) + #if defined(__i386__) || defined(__amd64__) static inline void diff --git a/sys/dev/pci/drm/drm_modes.c b/sys/dev/pci/drm/drm_modes.c index abf243ca3b9..9890564688a 100644 --- a/sys/dev/pci/drm/drm_modes.c +++ b/sys/dev/pci/drm/drm_modes.c @@ -1,4 +1,4 @@ -/* $OpenBSD: drm_modes.c,v 1.4 2015/02/11 07:01:36 jsg Exp $ */ +/* $OpenBSD: drm_modes.c,v 1.5 2015/04/06 12:25:10 jsg Exp $ */ /* * Copyright © 1997-2003 by The XFree86 Project, Inc. * Copyright © 2007 Dave Airlie @@ -34,8 +34,6 @@ #include "drmP.h" #include "drm_crtc.h" -#define KHZ2PICOS(a) (1000000000UL/(a)) - void drm_mode_validate_clocks(struct drm_device *, struct list_head *, int *, int *, int); long simple_strtol(const char *, char **, int); diff --git a/sys/dev/pci/drm/i915/i915_gem.c b/sys/dev/pci/drm/i915/i915_gem.c index 89478a3a8d0..2aa75694069 100644 --- a/sys/dev/pci/drm/i915/i915_gem.c +++ b/sys/dev/pci/drm/i915/i915_gem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: i915_gem.c,v 1.87 2015/04/06 10:56:37 jsg Exp $ */ +/* $OpenBSD: i915_gem.c,v 1.88 2015/04/06 12:25:10 jsg Exp $ */ /* * Copyright (c) 2008-2009 Owain G. Ainsworth <oga@openbsd.org> * @@ -290,8 +290,6 @@ static int i915_gem_object_needs_bit17_swizzle(struct drm_i915_gem_object *obj) obj->tiling_mode != I915_TILING_NONE; } -#define offset_in_page(off) ((off) & PAGE_MASK) - static void * kmap(struct vm_page *pg) { @@ -405,9 +403,6 @@ shmem_pread_fast(struct vm_page *page, int shmem_page_offset, int page_length, return ret ? -EFAULT : 0; } -#define round_up(x, y) ((((x) + ((y) - 1)) / (y)) * (y)) -#define round_down(x, y) (((x) / (y)) * (y)) - static void shmem_clflush_swizzled_range(char *addr, unsigned long length, bool swizzled) diff --git a/sys/dev/pci/drm/i915/intel_bios.c b/sys/dev/pci/drm/i915/intel_bios.c index 25cb83fb366..1326fd1c15b 100644 --- a/sys/dev/pci/drm/i915/intel_bios.c +++ b/sys/dev/pci/drm/i915/intel_bios.c @@ -1,4 +1,4 @@ -/* $OpenBSD: intel_bios.c,v 1.9 2015/02/12 04:56:03 kettenis Exp $ */ +/* $OpenBSD: intel_bios.c,v 1.10 2015/04/06 12:25:10 jsg Exp $ */ /* * Copyright © 2006 Intel Corporation * @@ -679,56 +679,6 @@ static const struct dmi_system_id intel_no_opregion_vbt[] = { { } }; -extern char *hw_vendor, *hw_prod; - -static bool -dmi_found(const struct dmi_system_id *dsi) -{ - int i, slot; - - for (i = 0; i < nitems(dsi->matches); i++) { - slot = dsi->matches[i].slot; - switch (slot) { - case DMI_NONE: - break; - case DMI_SYS_VENDOR: - case DMI_BOARD_VENDOR: - if (hw_vendor != NULL && - !strcmp(hw_vendor, dsi->matches[i].substr)) - break; - else - return false; - case DMI_PRODUCT_NAME: - case DMI_BOARD_NAME: - if (hw_prod != NULL && - !strcmp(hw_prod, dsi->matches[i].substr)) - break; - else - return false; - default: - return false; - } - } - - return true; -} - -int -dmi_check_system(const struct dmi_system_id *sysid) -{ - const struct dmi_system_id *dsi; - int num = 0; - - for (dsi = sysid; dsi->matches[0].slot != 0 ; dsi++) { - if (dmi_found(dsi)) { - num++; - if (dsi->callback && dsi->callback(dsi)) - break; - } - } - return (num); -} - #define VGA_BIOS_ADDR 0xc0000 #define VGA_BIOS_LEN 0x10000 diff --git a/sys/dev/pci/drm/i915/intel_sdvo.c b/sys/dev/pci/drm/i915/intel_sdvo.c index 2aa25674bfc..f6e51c16d14 100644 --- a/sys/dev/pci/drm/i915/intel_sdvo.c +++ b/sys/dev/pci/drm/i915/intel_sdvo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: intel_sdvo.c,v 1.16 2014/03/24 17:06:49 kettenis Exp $ */ +/* $OpenBSD: intel_sdvo.c,v 1.17 2015/04/06 12:25:10 jsg Exp $ */ /* * Copyright 2006 Dave Airlie <airlied@linux.ie> * Copyright © 2006-2007 Intel Corporation @@ -34,17 +34,6 @@ #include "i915_drv.h" #include "intel_sdvo_regs.h" -static __inline uint16_t -hweight16(uint32_t x) -{ - - x = (x & 0x5555) + ((x & 0xaaaa) >> 1); - x = (x & 0x3333) + ((x & 0xcccc) >> 2); - x = (x + (x >> 4)) & 0x0f0f; - x = (x + (x >> 8)) & 0x00ff; - return (x); -} - #define SDVO_TMDS_MASK (SDVO_OUTPUT_TMDS0 | SDVO_OUTPUT_TMDS1) #define SDVO_RGB_MASK (SDVO_OUTPUT_RGB0 | SDVO_OUTPUT_RGB1) #define SDVO_LVDS_MASK (SDVO_OUTPUT_LVDS0 | SDVO_OUTPUT_LVDS1) diff --git a/sys/dev/pci/drm/radeon/r600.c b/sys/dev/pci/drm/radeon/r600.c index 12e3f28be4a..d1a66165634 100644 --- a/sys/dev/pci/drm/radeon/r600.c +++ b/sys/dev/pci/drm/radeon/r600.c @@ -1,4 +1,4 @@ -/* $OpenBSD: r600.c,v 1.17 2015/04/06 07:38:49 jsg Exp $ */ +/* $OpenBSD: r600.c,v 1.18 2015/04/06 12:25:10 jsg Exp $ */ /* * Copyright 2008 Advanced Micro Devices, Inc. * Copyright 2008 Red Hat Inc. @@ -1501,16 +1501,6 @@ u32 r6xx_remap_render_backend(struct radeon_device *rdev, return data; } -static inline uint32_t hweight32(uint32_t x) -{ - x = (x & 0x55555555) + ((x & 0xaaaaaaaa) >> 1); - x = (x & 0x33333333) + ((x & 0xcccccccc) >> 2); - x = (x + (x >> 4)) & 0x0f0f0f0f; - x = (x + (x >> 8)); - x = (x + (x >> 16)) & 0x000000ff; - return x; -} - int r600_count_pipe_bits(uint32_t val) { return hweight32(val); diff --git a/sys/dev/pci/drm/radeon/radeon_device.c b/sys/dev/pci/drm/radeon/radeon_device.c index 4359453bc6c..a88b0bfdf42 100644 --- a/sys/dev/pci/drm/radeon/radeon_device.c +++ b/sys/dev/pci/drm/radeon/radeon_device.c @@ -1,4 +1,4 @@ -/* $OpenBSD: radeon_device.c,v 1.11 2015/04/06 07:38:49 jsg Exp $ */ +/* $OpenBSD: radeon_device.c,v 1.12 2015/04/06 12:25:10 jsg Exp $ */ /* * Copyright 2008 Advanced Micro Devices, Inc. * Copyright 2008 Red Hat Inc. @@ -1186,9 +1186,6 @@ void radeon_device_fini(struct radeon_device *rdev) #endif } -#define console_lock() -#define console_unlock() - /* * Suspend & resume. */ diff --git a/sys/dev/pci/drm/radeon/radeon_kms.c b/sys/dev/pci/drm/radeon/radeon_kms.c index 0dd1814eb15..dc520895b07 100644 --- a/sys/dev/pci/drm/radeon/radeon_kms.c +++ b/sys/dev/pci/drm/radeon/radeon_kms.c @@ -1,4 +1,4 @@ -/* $OpenBSD: radeon_kms.c,v 1.36 2015/04/06 07:38:49 jsg Exp $ */ +/* $OpenBSD: radeon_kms.c,v 1.37 2015/04/06 12:25:10 jsg Exp $ */ /* * Copyright 2008 Advanced Micro Devices, Inc. * Copyright 2008 Red Hat Inc. @@ -33,14 +33,6 @@ #include "radeon_asic.h" #include <dev/pci/drm/drm_pciids.h> -#ifndef PCI_MEM_START -#define PCI_MEM_START 0 -#endif - -#ifndef PCI_MEM_END -#define PCI_MEM_END 0xffffffff -#endif - /* can't include radeon_drv.h due to duplicated defines in radeon_reg.h */ #include "vga.h" diff --git a/sys/dev/pci/drm/ttm/ttm_bo_util.c b/sys/dev/pci/drm/ttm/ttm_bo_util.c index a77885d6a60..c8cba1187c7 100644 --- a/sys/dev/pci/drm/ttm/ttm_bo_util.c +++ b/sys/dev/pci/drm/ttm/ttm_bo_util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ttm_bo_util.c,v 1.9 2015/02/12 08:48:32 jsg Exp $ */ +/* $OpenBSD: ttm_bo_util.c,v 1.10 2015/04/06 12:25:10 jsg Exp $ */ /************************************************************************** * * Copyright (c) 2007-2009 VMware, Inc., Palo Alto, CA., USA @@ -307,7 +307,6 @@ static int ttm_copy_ttm_io_page(struct ttm_tt *ttm, void *dst, if (!src) return -ENOMEM; -#define memcpy_toio(d, s, n) memcpy(d, s, n) memcpy_toio(dst, src, PAGE_SIZE); if (pgprot_val(prot) != pgprot_val(PAGE_KERNEL)) diff --git a/sys/dev/pci/drm/ttm/ttm_memory.c b/sys/dev/pci/drm/ttm/ttm_memory.c index e978e58306e..026d1a7a2bc 100644 --- a/sys/dev/pci/drm/ttm/ttm_memory.c +++ b/sys/dev/pci/drm/ttm/ttm_memory.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ttm_memory.c,v 1.8 2015/02/11 07:01:37 jsg Exp $ */ +/* $OpenBSD: ttm_memory.c,v 1.9 2015/04/06 12:25:10 jsg Exp $ */ /************************************************************************** * * Copyright (c) 2006-2009 VMware, Inc., Palo Alto, CA., USA @@ -516,8 +516,6 @@ int ttm_mem_global_alloc(struct ttm_mem_global *glob, uint64_t memory, } EXPORT_SYMBOL(ttm_mem_global_alloc); -#define page_to_pfn(pp) (VM_PAGE_TO_PHYS(pp) / PAGE_SIZE) - int ttm_mem_global_alloc_page(struct ttm_mem_global *glob, struct vm_page *page, bool no_wait, bool interruptible) |