busdma_machdep.c (202175) | busdma_machdep.c (203080) |
---|---|
1/*- 2 * Copyright (c) 2006 Oleksandr Tymoshenko 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 --- 13 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 * From i386/busdma_machdep.c,v 1.26 2002/04/19 22:58:09 alfred 27 */ 28 29#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2006 Oleksandr Tymoshenko 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 --- 13 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 * From i386/busdma_machdep.c,v 1.26 2002/04/19 22:58:09 alfred 27 */ 28 29#include <sys/cdefs.h> |
30__FBSDID("$FreeBSD: head/sys/mips/mips/busdma_machdep.c 202175 2010-01-12 21:36:08Z imp $"); | 30__FBSDID("$FreeBSD: head/sys/mips/mips/busdma_machdep.c 203080 2010-01-27 17:15:17Z kan $"); |
31 32/* 33 * MIPS bus dma support routines 34 */ 35 36#include <sys/param.h> 37#include <sys/systm.h> 38#include <sys/malloc.h> --- 1022 unchanged lines hidden (view full) --- 1061 mips_dcache_inv_range((vm_offset_t)buf, len); 1062 /* 1063 * Restore them 1064 */ 1065 if (size_cl) 1066 memcpy ((void*)buf_cl, tmp_cl, size_cl); 1067 if (size_clend) 1068 memcpy ((void*)buf_clend, tmp_clend, size_clend); | 31 32/* 33 * MIPS bus dma support routines 34 */ 35 36#include <sys/param.h> 37#include <sys/systm.h> 38#include <sys/malloc.h> --- 1022 unchanged lines hidden (view full) --- 1061 mips_dcache_inv_range((vm_offset_t)buf, len); 1062 /* 1063 * Restore them 1064 */ 1065 if (size_cl) 1066 memcpy ((void*)buf_cl, tmp_cl, size_cl); 1067 if (size_clend) 1068 memcpy ((void*)buf_clend, tmp_clend, size_clend); |
1069 /* 1070 * Copies above have brought corresponding memory 1071 * cache lines back into dirty state. Write them back 1072 * out and invalidate affected cache lines again if 1073 * necessary. 1074 */ 1075 if (size_cl) 1076 mips_dcache_wbinv_range((vm_offset_t)buf_cl, size_cl); 1077 if (size_clend && (size_cl == 0 || 1078 buf_clend - buf_cl > mips_pdcache_linesize)) 1079 mips_dcache_wbinv_range((vm_offset_t)buf_clend, 1080 size_clend); |
|
1069 break; 1070 1071 case BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE: | 1081 break; 1082 1083 case BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE: |
1072 mips_dcache_wbinv_range((vm_offset_t)buf, len); | 1084 mips_dcache_wbinv_range((vm_offset_t)buf_cl, len); |
1073 break; 1074 1075 case BUS_DMASYNC_PREREAD: 1076 /* 1077 * Save buffers that might be modified by invalidation 1078 */ 1079 if (size_cl) 1080 memcpy (tmp_cl, (void *)buf_cl, size_cl); 1081 if (size_clend) 1082 memcpy (tmp_clend, (void *)buf_clend, size_clend); 1083 mips_dcache_inv_range((vm_offset_t)buf, len); 1084 /* 1085 * Restore them 1086 */ 1087 if (size_cl) 1088 memcpy ((void *)buf_cl, tmp_cl, size_cl); 1089 if (size_clend) 1090 memcpy ((void *)buf_clend, tmp_clend, size_clend); | 1085 break; 1086 1087 case BUS_DMASYNC_PREREAD: 1088 /* 1089 * Save buffers that might be modified by invalidation 1090 */ 1091 if (size_cl) 1092 memcpy (tmp_cl, (void *)buf_cl, size_cl); 1093 if (size_clend) 1094 memcpy (tmp_clend, (void *)buf_clend, size_clend); 1095 mips_dcache_inv_range((vm_offset_t)buf, len); 1096 /* 1097 * Restore them 1098 */ 1099 if (size_cl) 1100 memcpy ((void *)buf_cl, tmp_cl, size_cl); 1101 if (size_clend) 1102 memcpy ((void *)buf_clend, tmp_clend, size_clend); |
1103 /* 1104 * Copies above have brought corresponding memory 1105 * cache lines back into dirty state. Write them back 1106 * out and invalidate affected cache lines again if 1107 * necessary. 1108 */ 1109 if (size_cl) 1110 mips_dcache_wbinv_range((vm_offset_t)buf_cl, size_cl); 1111 if (size_clend && (size_cl == 0 || 1112 buf_clend - buf_cl > mips_pdcache_linesize)) 1113 mips_dcache_wbinv_range((vm_offset_t)buf_clend, 1114 size_clend); |
|
1091 break; 1092 1093 case BUS_DMASYNC_PREWRITE: 1094 mips_dcache_wb_range((vm_offset_t)buf, len); 1095 break; 1096 } 1097} 1098 --- 347 unchanged lines hidden --- | 1115 break; 1116 1117 case BUS_DMASYNC_PREWRITE: 1118 mips_dcache_wb_range((vm_offset_t)buf, len); 1119 break; 1120 } 1121} 1122 --- 347 unchanged lines hidden --- |