devtime.c (1053:2c6d9e60541b) | devtime.c (1068:6330fe678283) |
---|---|
1/* 2 * Copyright (c) 2004 The Regents of The University of Michigan 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 are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 34 unchanged lines hidden (view full) --- 43#endif 44 45#define DRIVER_AUTHOR "Ali Saidi" 46#define DRIVER_DESC "Interface to time uncacachable read and writes to device registers" 47#define DRIVER_VER "0.1" 48 49static char *dataAddr = NULL; 50static int count = 0; | 1/* 2 * Copyright (c) 2004 The Regents of The University of Michigan 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 are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 34 unchanged lines hidden (view full) --- 43#endif 44 45#define DRIVER_AUTHOR "Ali Saidi" 46#define DRIVER_DESC "Interface to time uncacachable read and writes to device registers" 47#define DRIVER_VER "0.1" 48 49static char *dataAddr = NULL; 50static int count = 0; |
51#ifdef __alpha__ 52static int memTest = 0; 53#endif |
|
51 52static inline uint32_t cycleCounter(uint32_t dep); 53 54static int __init devtime_start(void) 55{ 56 uint64_t addr; 57 uint32_t t1, t2; 58 uint32_t trash; 59 int x; 60 uint32_t *times; 61 uint32_t num = 0; 62 struct net_device *dev; 63 64 printk("Devtime Driver Version %s Loaded...\n", DRIVER_VER); 65 | 54 55static inline uint32_t cycleCounter(uint32_t dep); 56 57static int __init devtime_start(void) 58{ 59 uint64_t addr; 60 uint32_t t1, t2; 61 uint32_t trash; 62 int x; 63 uint32_t *times; 64 uint32_t num = 0; 65 struct net_device *dev; 66 67 printk("Devtime Driver Version %s Loaded...\n", DRIVER_VER); 68 |
69#ifdef __alpha__ 70 if (memTest) { 71 addr = 0xfffffc0000000000; 72// addr += 16*1024*1024; 73 74 printk("Preparing memory test.\n"); 75 76 t1 = cycleCounter(trash); 77 for (x = 0; x < count; x++) { 78 trash = readl(addr); 79 t2 = cycleCounter(trash); 80 times[num++] = t2 - t1; 81 t1 = t2; 82 addr += 4096; 83 } 84 85 printk("Measurements:\n"); 86 for (x = 0; x < count; x++) { 87 printk("%d ", times[x]); 88 if (((x + 1) % 10) == 0) 89 printk("\n"); 90 } 91 printk("\nDone.\n"); 92 } else 93#endif |
|
66 if (dataAddr != 0 && count != 0) { 67 addr = simple_strtoull(dataAddr, NULL, 0); 68 69 addr = ioremap(addr, PAGE_SIZE); 70 /** 71 * Make sure that the remapping actually worked. On alpha we have 72 * linear addressing, so its not a problem. But it can fail in x86 73 * if physical memory is mapped to this address. --- 66 unchanged lines hidden (view full) --- 140 141inline uint32_t cycleCounter(uint32_t dep) 142{ 143 uint32_t res; 144 asm volatile ("rpcc %0, %1" : "=r"(res) : "r" (dep) : "memory"); 145 return res; 146} 147#else | 94 if (dataAddr != 0 && count != 0) { 95 addr = simple_strtoull(dataAddr, NULL, 0); 96 97 addr = ioremap(addr, PAGE_SIZE); 98 /** 99 * Make sure that the remapping actually worked. On alpha we have 100 * linear addressing, so its not a problem. But it can fail in x86 101 * if physical memory is mapped to this address. --- 66 unchanged lines hidden (view full) --- 168 169inline uint32_t cycleCounter(uint32_t dep) 170{ 171 uint32_t res; 172 asm volatile ("rpcc %0, %1" : "=r"(res) : "r" (dep) : "memory"); 173 return res; 174} 175#else |
148#error Architecture NOT SUPPORTE | 176#error Architecture NOT SUPPORTED |
149#endif 150 151static void __exit devtime_end(void) 152{ 153 printk("Devtime Driver Version %s Unloaded...\n", DRIVER_VER); 154} 155 156 157module_init(devtime_start); 158module_exit(devtime_end); 159 160MODULE_LICENSE("Dual BSD/GPL"); 161MODULE_AUTHOR(DRIVER_AUTHOR); 162MODULE_DESCRIPTION(DRIVER_DESC); 163module_param(dataAddr, charp, 0); 164module_param(count, int, 0); | 177#endif 178 179static void __exit devtime_end(void) 180{ 181 printk("Devtime Driver Version %s Unloaded...\n", DRIVER_VER); 182} 183 184 185module_init(devtime_start); 186module_exit(devtime_end); 187 188MODULE_LICENSE("Dual BSD/GPL"); 189MODULE_AUTHOR(DRIVER_AUTHOR); 190MODULE_DESCRIPTION(DRIVER_DESC); 191module_param(dataAddr, charp, 0); 192module_param(count, int, 0); |
193#ifdef __alpha__ 194module_param(memTest, int, 0); 195#endif |
|