mv.c (d2bd3ab995038214fa00f73d4a88cd891d0afe34) | mv.c (1713e81b9cdf06d2a9a365a7ded13a54fad84798) |
---|---|
1/* | 1/* |
2 * Copyright (c) 2004-2005 HighPoint Technologies, Inc. | 2 * Copyright (c) 2003-2004 HighPoint Technologies, Inc. |
3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright --- 11 unchanged lines hidden (view full) --- 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * 26 * $FreeBSD$ 27 */ 28#include <sys/param.h> 29#include <sys/systm.h> | 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright --- 11 unchanged lines hidden (view full) --- 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * 26 * $FreeBSD$ 27 */ 28#include <sys/param.h> 29#include <sys/systm.h> |
30 31#include <sys/time.h> | |
32#include <sys/kernel.h> | 30#include <sys/kernel.h> |
33#include <sys/bus.h> 34#include <machine/resource.h> | |
35 | 31 |
36#if __FreeBSD_version >= 500043 37#include <machine/pci_cfgreg.h> 38#endif | 32#include <vm/vm.h> 33#include <vm/pmap.h> 34#include <vm/vm_extern.h> |
39 | 35 |
40#if (__FreeBSD_version < 500043) 41#include <sys/bus_private.h> 42#endif 43 44#if (__FreeBSD_version < 500000) 45#include <machine/clock.h> 46#endif 47 48#ifndef __KERNEL__ 49#define __KERNEL__ 50#endif 51 | |
52#include <dev/hptmv/global.h> 53#include <dev/hptmv/hptintf.h> 54#include <dev/hptmv/mvOs.h> 55#include <dev/hptmv/osbsd.h> 56 | 36#include <dev/hptmv/global.h> 37#include <dev/hptmv/hptintf.h> 38#include <dev/hptmv/mvOs.h> 39#include <dev/hptmv/osbsd.h> 40 |
57 | |
58void HPTLIBAPI 59MV_REG_WRITE_BYTE(MV_BUS_ADDR_T base, MV_U32 offset, MV_U8 val) | 41void HPTLIBAPI 42MV_REG_WRITE_BYTE(MV_BUS_ADDR_T base, MV_U32 offset, MV_U8 val) |
60{ 61 writeb((void *)((ULONG_PTR)base + offset), val); | 43{ 44 mv_reg_write_byte(base, offset, val); |
62} 63 64void HPTLIBAPI 65MV_REG_WRITE_WORD(MV_BUS_ADDR_T base, MV_U32 offset, MV_U16 val) | 45} 46 47void HPTLIBAPI 48MV_REG_WRITE_WORD(MV_BUS_ADDR_T base, MV_U32 offset, MV_U16 val) |
66{ 67 writew((void *)((ULONG_PTR)base + offset), val); | 49{ 50 mv_reg_write_word(base, offset, val); |
68} 69 70void HPTLIBAPI 71MV_REG_WRITE_DWORD(MV_BUS_ADDR_T base, MV_U32 offset, MV_U32 val) 72{ | 51} 52 53void HPTLIBAPI 54MV_REG_WRITE_DWORD(MV_BUS_ADDR_T base, MV_U32 offset, MV_U32 val) 55{ |
73 writel((void *)((ULONG_PTR)base + offset), val); | 56 mv_reg_write_dword(base, offset, val); |
74} 75 | 57} 58 |
76MV_U8 HPTLIBAPI 77MV_REG_READ_BYTE(MV_BUS_ADDR_T base, MV_U32 offset) | 59MV_U8 60HPTLIBAPI MV_REG_READ_BYTE(MV_BUS_ADDR_T base, MV_U32 offset) |
78{ | 61{ |
79 return readb((void *)((ULONG_PTR)base + offset)); | 62 return (mv_reg_read_byte(base, offset)); |
80} 81 | 63} 64 |
82MV_U16 HPTLIBAPI 83MV_REG_READ_WORD(MV_BUS_ADDR_T base, MV_U32 offset) | 65MV_U16 66HPTLIBAPI MV_REG_READ_WORD(MV_BUS_ADDR_T base, MV_U32 offset) |
84{ | 67{ |
85 return readw((void *)((ULONG_PTR)base + offset)); | 68 return (mv_reg_read_word(base, offset)); |
86} 87 | 69} 70 |
88MV_U32 HPTLIBAPI 89MV_REG_READ_DWORD(MV_BUS_ADDR_T base, MV_U32 offset) | 71MV_U32 72HPTLIBAPI MV_REG_READ_DWORD(MV_BUS_ADDR_T base, MV_U32 offset) |
90{ | 73{ |
91 return readl((void *)((ULONG_PTR)base + offset)); | 74 return (mv_reg_read_dword(base, offset)); |
92} 93 94int HPTLIBAPI 95os_memcmp(const void *cs, const void *ct, unsigned len) 96{ 97 return memcmp(cs, ct, len); 98} 99 100void HPTLIBAPI 101os_memcpy(void *to, const void *from, unsigned len) 102{ 103 memcpy(to, from, len); 104} 105 | 75} 76 77int HPTLIBAPI 78os_memcmp(const void *cs, const void *ct, unsigned len) 79{ 80 return memcmp(cs, ct, len); 81} 82 83void HPTLIBAPI 84os_memcpy(void *to, const void *from, unsigned len) 85{ 86 memcpy(to, from, len); 87} 88 |
106void HPTLIBAPI 107os_memset(void *s, char c, unsigned len) | 89void 90HPTLIBAPI os_memset(void *s, char c, unsigned len) |
108{ 109 memset(s, c, len); 110} 111 | 91{ 92 memset(s, c, len); 93} 94 |
112unsigned HPTLIBAPI 113os_strlen(const char *s) | 95unsigned 96HPTLIBAPI os_strlen(const char *s) |
114{ 115 return strlen(s); 116} 117 | 97{ 98 return strlen(s); 99} 100 |
118void HPTLIBAPI 119mvMicroSecondsDelay(MV_U32 msecs) | 101void HPTLIBAPI mvMicroSecondsDelay(MV_U32 msecs) |
120{ 121 DELAY(msecs); 122} 123 | 102{ 103 DELAY(msecs); 104} 105 |
124ULONG_PTR HPTLIBAPI 125fOsPhysicalAddress(void *addr) | 106/* 107 * XXX 108 * 109 * The binary raid.obj requires this function! 110 */ 111ULONG_PTR HPTLIBAPI fOsPhysicalAddress(void *addr) |
126{ 127 return (ULONG_PTR)(vtophys(addr)); 128} | 112{ 113 return (ULONG_PTR)(vtophys(addr)); 114} |