cmf.c 32 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316
  1. /*
  2. * linux/drivers/s390/cio/cmf.c
  3. *
  4. * Linux on zSeries Channel Measurement Facility support
  5. *
  6. * Copyright 2000,2006 IBM Corporation
  7. *
  8. * Authors: Arnd Bergmann <arndb@de.ibm.com>
  9. * Cornelia Huck <cornelia.huck@de.ibm.com>
  10. *
  11. * original idea from Natarajan Krishnaswami <nkrishna@us.ibm.com>
  12. *
  13. * This program is free software; you can redistribute it and/or modify
  14. * it under the terms of the GNU General Public License as published by
  15. * the Free Software Foundation; either version 2, or (at your option)
  16. * any later version.
  17. *
  18. * This program is distributed in the hope that it will be useful,
  19. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  21. * GNU General Public License for more details.
  22. *
  23. * You should have received a copy of the GNU General Public License
  24. * along with this program; if not, write to the Free Software
  25. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  26. */
  27. #include <linux/bootmem.h>
  28. #include <linux/device.h>
  29. #include <linux/init.h>
  30. #include <linux/list.h>
  31. #include <linux/module.h>
  32. #include <linux/moduleparam.h>
  33. #include <linux/slab.h>
  34. #include <linux/timex.h> /* get_clock() */
  35. #include <asm/ccwdev.h>
  36. #include <asm/cio.h>
  37. #include <asm/cmb.h>
  38. #include <asm/div64.h>
  39. #include "cio.h"
  40. #include "css.h"
  41. #include "device.h"
  42. #include "ioasm.h"
  43. #include "chsc.h"
  44. /* parameter to enable cmf during boot, possible uses are:
  45. * "s390cmf" -- enable cmf and allocate 2 MB of ram so measuring can be
  46. * used on any subchannel
  47. * "s390cmf=<num>" -- enable cmf and allocate enough memory to measure
  48. * <num> subchannel, where <num> is an integer
  49. * between 1 and 65535, default is 1024
  50. */
  51. #define ARGSTRING "s390cmf"
  52. /* indices for READCMB */
  53. enum cmb_index {
  54. /* basic and exended format: */
  55. cmb_ssch_rsch_count,
  56. cmb_sample_count,
  57. cmb_device_connect_time,
  58. cmb_function_pending_time,
  59. cmb_device_disconnect_time,
  60. cmb_control_unit_queuing_time,
  61. cmb_device_active_only_time,
  62. /* extended format only: */
  63. cmb_device_busy_time,
  64. cmb_initial_command_response_time,
  65. };
  66. /**
  67. * enum cmb_format - types of supported measurement block formats
  68. *
  69. * @CMF_BASIC: traditional channel measurement blocks supported
  70. * by all machines that we run on
  71. * @CMF_EXTENDED: improved format that was introduced with the z990
  72. * machine
  73. * @CMF_AUTODETECT: default: use extended format when running on a z990
  74. * or later machine, otherwise fall back to basic format
  75. **/
  76. enum cmb_format {
  77. CMF_BASIC,
  78. CMF_EXTENDED,
  79. CMF_AUTODETECT = -1,
  80. };
  81. /**
  82. * format - actual format for all measurement blocks
  83. *
  84. * The format module parameter can be set to a value of 0 (zero)
  85. * or 1, indicating basic or extended format as described for
  86. * enum cmb_format.
  87. */
  88. static int format = CMF_AUTODETECT;
  89. module_param(format, bool, 0444);
  90. /**
  91. * struct cmb_operations - functions to use depending on cmb_format
  92. *
  93. * Most of these functions operate on a struct ccw_device. There is only
  94. * one instance of struct cmb_operations because the format of the measurement
  95. * data is guaranteed to be the same for every ccw_device.
  96. *
  97. * @alloc: allocate memory for a channel measurement block,
  98. * either with the help of a special pool or with kmalloc
  99. * @free: free memory allocated with @alloc
  100. * @set: enable or disable measurement
  101. * @readall: read a measurement block in a common format
  102. * @reset: clear the data in the associated measurement block and
  103. * reset its time stamp
  104. * @align: align an allocated block so that the hardware can use it
  105. */
  106. struct cmb_operations {
  107. int (*alloc) (struct ccw_device*);
  108. void(*free) (struct ccw_device*);
  109. int (*set) (struct ccw_device*, u32);
  110. u64 (*read) (struct ccw_device*, int);
  111. int (*readall)(struct ccw_device*, struct cmbdata *);
  112. void (*reset) (struct ccw_device*);
  113. void * (*align) (void *);
  114. struct attribute_group *attr_group;
  115. };
  116. static struct cmb_operations *cmbops;
  117. struct cmb_data {
  118. void *hw_block; /* Pointer to block updated by hardware */
  119. void *last_block; /* Last changed block copied from hardware block */
  120. int size; /* Size of hw_block and last_block */
  121. unsigned long long last_update; /* when last_block was updated */
  122. };
  123. /* our user interface is designed in terms of nanoseconds,
  124. * while the hardware measures total times in its own
  125. * unit.*/
  126. static inline u64 time_to_nsec(u32 value)
  127. {
  128. return ((u64)value) * 128000ull;
  129. }
  130. /*
  131. * Users are usually interested in average times,
  132. * not accumulated time.
  133. * This also helps us with atomicity problems
  134. * when reading sinlge values.
  135. */
  136. static inline u64 time_to_avg_nsec(u32 value, u32 count)
  137. {
  138. u64 ret;
  139. /* no samples yet, avoid division by 0 */
  140. if (count == 0)
  141. return 0;
  142. /* value comes in units of 128 µsec */
  143. ret = time_to_nsec(value);
  144. do_div(ret, count);
  145. return ret;
  146. }
  147. /* activate or deactivate the channel monitor. When area is NULL,
  148. * the monitor is deactivated. The channel monitor needs to
  149. * be active in order to measure subchannels, which also need
  150. * to be enabled. */
  151. static inline void
  152. cmf_activate(void *area, unsigned int onoff)
  153. {
  154. register void * __gpr2 asm("2");
  155. register long __gpr1 asm("1");
  156. __gpr2 = area;
  157. __gpr1 = onoff ? 2 : 0;
  158. /* activate channel measurement */
  159. asm("schm" : : "d" (__gpr2), "d" (__gpr1) );
  160. }
  161. static int
  162. set_schib(struct ccw_device *cdev, u32 mme, int mbfc, unsigned long address)
  163. {
  164. int ret;
  165. int retry;
  166. struct subchannel *sch;
  167. struct schib *schib;
  168. sch = to_subchannel(cdev->dev.parent);
  169. schib = &sch->schib;
  170. /* msch can silently fail, so do it again if necessary */
  171. for (retry = 0; retry < 3; retry++) {
  172. /* prepare schib */
  173. stsch(sch->schid, schib);
  174. schib->pmcw.mme = mme;
  175. schib->pmcw.mbfc = mbfc;
  176. /* address can be either a block address or a block index */
  177. if (mbfc)
  178. schib->mba = address;
  179. else
  180. schib->pmcw.mbi = address;
  181. /* try to submit it */
  182. switch(ret = msch_err(sch->schid, schib)) {
  183. case 0:
  184. break;
  185. case 1:
  186. case 2: /* in I/O or status pending */
  187. ret = -EBUSY;
  188. break;
  189. case 3: /* subchannel is no longer valid */
  190. ret = -ENODEV;
  191. break;
  192. default: /* msch caught an exception */
  193. ret = -EINVAL;
  194. break;
  195. }
  196. stsch(sch->schid, schib); /* restore the schib */
  197. if (ret)
  198. break;
  199. /* check if it worked */
  200. if (schib->pmcw.mme == mme &&
  201. schib->pmcw.mbfc == mbfc &&
  202. (mbfc ? (schib->mba == address)
  203. : (schib->pmcw.mbi == address)))
  204. return 0;
  205. ret = -EINVAL;
  206. }
  207. return ret;
  208. }
  209. struct set_schib_struct {
  210. u32 mme;
  211. int mbfc;
  212. unsigned long address;
  213. wait_queue_head_t wait;
  214. int ret;
  215. struct kref kref;
  216. };
  217. static void cmf_set_schib_release(struct kref *kref)
  218. {
  219. struct set_schib_struct *set_data;
  220. set_data = container_of(kref, struct set_schib_struct, kref);
  221. kfree(set_data);
  222. }
  223. #define CMF_PENDING 1
  224. static int set_schib_wait(struct ccw_device *cdev, u32 mme,
  225. int mbfc, unsigned long address)
  226. {
  227. struct set_schib_struct *set_data;
  228. int ret;
  229. spin_lock_irq(cdev->ccwlock);
  230. if (!cdev->private->cmb) {
  231. ret = -ENODEV;
  232. goto out;
  233. }
  234. set_data = kzalloc(sizeof(struct set_schib_struct), GFP_ATOMIC);
  235. if (!set_data) {
  236. ret = -ENOMEM;
  237. goto out;
  238. }
  239. init_waitqueue_head(&set_data->wait);
  240. kref_init(&set_data->kref);
  241. set_data->mme = mme;
  242. set_data->mbfc = mbfc;
  243. set_data->address = address;
  244. ret = set_schib(cdev, mme, mbfc, address);
  245. if (ret != -EBUSY)
  246. goto out_put;
  247. if (cdev->private->state != DEV_STATE_ONLINE) {
  248. /* if the device is not online, don't even try again */
  249. ret = -EBUSY;
  250. goto out_put;
  251. }
  252. cdev->private->state = DEV_STATE_CMFCHANGE;
  253. set_data->ret = CMF_PENDING;
  254. cdev->private->cmb_wait = set_data;
  255. spin_unlock_irq(cdev->ccwlock);
  256. if (wait_event_interruptible(set_data->wait,
  257. set_data->ret != CMF_PENDING)) {
  258. spin_lock_irq(cdev->ccwlock);
  259. if (set_data->ret == CMF_PENDING) {
  260. set_data->ret = -ERESTARTSYS;
  261. if (cdev->private->state == DEV_STATE_CMFCHANGE)
  262. cdev->private->state = DEV_STATE_ONLINE;
  263. }
  264. spin_unlock_irq(cdev->ccwlock);
  265. }
  266. spin_lock_irq(cdev->ccwlock);
  267. cdev->private->cmb_wait = NULL;
  268. ret = set_data->ret;
  269. out_put:
  270. kref_put(&set_data->kref, cmf_set_schib_release);
  271. out:
  272. spin_unlock_irq(cdev->ccwlock);
  273. return ret;
  274. }
  275. void retry_set_schib(struct ccw_device *cdev)
  276. {
  277. struct set_schib_struct *set_data;
  278. set_data = cdev->private->cmb_wait;
  279. if (!set_data) {
  280. WARN_ON(1);
  281. return;
  282. }
  283. kref_get(&set_data->kref);
  284. set_data->ret = set_schib(cdev, set_data->mme, set_data->mbfc,
  285. set_data->address);
  286. wake_up(&set_data->wait);
  287. kref_put(&set_data->kref, cmf_set_schib_release);
  288. }
  289. static int cmf_copy_block(struct ccw_device *cdev)
  290. {
  291. struct subchannel *sch;
  292. void *reference_buf;
  293. void *hw_block;
  294. struct cmb_data *cmb_data;
  295. sch = to_subchannel(cdev->dev.parent);
  296. if (stsch(sch->schid, &sch->schib))
  297. return -ENODEV;
  298. if (sch->schib.scsw.fctl & SCSW_FCTL_START_FUNC) {
  299. /* Don't copy if a start function is in progress. */
  300. if ((!sch->schib.scsw.actl & SCSW_ACTL_SUSPENDED) &&
  301. (sch->schib.scsw.actl &
  302. (SCSW_ACTL_DEVACT | SCSW_ACTL_SCHACT)) &&
  303. (!sch->schib.scsw.stctl & SCSW_STCTL_SEC_STATUS))
  304. return -EBUSY;
  305. }
  306. cmb_data = cdev->private->cmb;
  307. hw_block = cmbops->align(cmb_data->hw_block);
  308. if (!memcmp(cmb_data->last_block, hw_block, cmb_data->size))
  309. /* No need to copy. */
  310. return 0;
  311. reference_buf = kzalloc(cmb_data->size, GFP_ATOMIC);
  312. if (!reference_buf)
  313. return -ENOMEM;
  314. /* Ensure consistency of block copied from hardware. */
  315. do {
  316. memcpy(cmb_data->last_block, hw_block, cmb_data->size);
  317. memcpy(reference_buf, hw_block, cmb_data->size);
  318. } while (memcmp(cmb_data->last_block, reference_buf, cmb_data->size));
  319. cmb_data->last_update = get_clock();
  320. kfree(reference_buf);
  321. return 0;
  322. }
  323. struct copy_block_struct {
  324. wait_queue_head_t wait;
  325. int ret;
  326. struct kref kref;
  327. };
  328. static void cmf_copy_block_release(struct kref *kref)
  329. {
  330. struct copy_block_struct *copy_block;
  331. copy_block = container_of(kref, struct copy_block_struct, kref);
  332. kfree(copy_block);
  333. }
  334. static int cmf_cmb_copy_wait(struct ccw_device *cdev)
  335. {
  336. struct copy_block_struct *copy_block;
  337. int ret;
  338. unsigned long flags;
  339. spin_lock_irqsave(cdev->ccwlock, flags);
  340. if (!cdev->private->cmb) {
  341. ret = -ENODEV;
  342. goto out;
  343. }
  344. copy_block = kzalloc(sizeof(struct copy_block_struct), GFP_ATOMIC);
  345. if (!copy_block) {
  346. ret = -ENOMEM;
  347. goto out;
  348. }
  349. init_waitqueue_head(&copy_block->wait);
  350. kref_init(&copy_block->kref);
  351. ret = cmf_copy_block(cdev);
  352. if (ret != -EBUSY)
  353. goto out_put;
  354. if (cdev->private->state != DEV_STATE_ONLINE) {
  355. ret = -EBUSY;
  356. goto out_put;
  357. }
  358. cdev->private->state = DEV_STATE_CMFUPDATE;
  359. copy_block->ret = CMF_PENDING;
  360. cdev->private->cmb_wait = copy_block;
  361. spin_unlock_irqrestore(cdev->ccwlock, flags);
  362. if (wait_event_interruptible(copy_block->wait,
  363. copy_block->ret != CMF_PENDING)) {
  364. spin_lock_irqsave(cdev->ccwlock, flags);
  365. if (copy_block->ret == CMF_PENDING) {
  366. copy_block->ret = -ERESTARTSYS;
  367. if (cdev->private->state == DEV_STATE_CMFUPDATE)
  368. cdev->private->state = DEV_STATE_ONLINE;
  369. }
  370. spin_unlock_irqrestore(cdev->ccwlock, flags);
  371. }
  372. spin_lock_irqsave(cdev->ccwlock, flags);
  373. cdev->private->cmb_wait = NULL;
  374. ret = copy_block->ret;
  375. out_put:
  376. kref_put(&copy_block->kref, cmf_copy_block_release);
  377. out:
  378. spin_unlock_irqrestore(cdev->ccwlock, flags);
  379. return ret;
  380. }
  381. void cmf_retry_copy_block(struct ccw_device *cdev)
  382. {
  383. struct copy_block_struct *copy_block;
  384. copy_block = cdev->private->cmb_wait;
  385. if (!copy_block) {
  386. WARN_ON(1);
  387. return;
  388. }
  389. kref_get(&copy_block->kref);
  390. copy_block->ret = cmf_copy_block(cdev);
  391. wake_up(&copy_block->wait);
  392. kref_put(&copy_block->kref, cmf_copy_block_release);
  393. }
  394. static void cmf_generic_reset(struct ccw_device *cdev)
  395. {
  396. struct cmb_data *cmb_data;
  397. spin_lock_irq(cdev->ccwlock);
  398. cmb_data = cdev->private->cmb;
  399. if (cmb_data) {
  400. memset(cmb_data->last_block, 0, cmb_data->size);
  401. /*
  402. * Need to reset hw block as well to make the hardware start
  403. * from 0 again.
  404. */
  405. memset(cmbops->align(cmb_data->hw_block), 0, cmb_data->size);
  406. cmb_data->last_update = 0;
  407. }
  408. cdev->private->cmb_start_time = get_clock();
  409. spin_unlock_irq(cdev->ccwlock);
  410. }
  411. /**
  412. * struct cmb_area - container for global cmb data
  413. *
  414. * @mem: pointer to CMBs (only in basic measurement mode)
  415. * @list: contains a linked list of all subchannels
  416. * @lock: protect concurrent access to @mem and @list
  417. */
  418. struct cmb_area {
  419. struct cmb *mem;
  420. struct list_head list;
  421. int num_channels;
  422. spinlock_t lock;
  423. };
  424. static struct cmb_area cmb_area = {
  425. .lock = SPIN_LOCK_UNLOCKED,
  426. .list = LIST_HEAD_INIT(cmb_area.list),
  427. .num_channels = 1024,
  428. };
  429. /* ****** old style CMB handling ********/
  430. /** int maxchannels
  431. *
  432. * Basic channel measurement blocks are allocated in one contiguous
  433. * block of memory, which can not be moved as long as any channel
  434. * is active. Therefore, a maximum number of subchannels needs to
  435. * be defined somewhere. This is a module parameter, defaulting to
  436. * a resonable value of 1024, or 32 kb of memory.
  437. * Current kernels don't allow kmalloc with more than 128kb, so the
  438. * maximum is 4096
  439. */
  440. module_param_named(maxchannels, cmb_area.num_channels, uint, 0444);
  441. /**
  442. * struct cmb - basic channel measurement block
  443. *
  444. * cmb as used by the hardware the fields are described in z/Architecture
  445. * Principles of Operation, chapter 17.
  446. * The area to be a contiguous array and may not be reallocated or freed.
  447. * Only one cmb area can be present in the system.
  448. */
  449. struct cmb {
  450. u16 ssch_rsch_count;
  451. u16 sample_count;
  452. u32 device_connect_time;
  453. u32 function_pending_time;
  454. u32 device_disconnect_time;
  455. u32 control_unit_queuing_time;
  456. u32 device_active_only_time;
  457. u32 reserved[2];
  458. };
  459. /* insert a single device into the cmb_area list
  460. * called with cmb_area.lock held from alloc_cmb
  461. */
  462. static inline int alloc_cmb_single (struct ccw_device *cdev,
  463. struct cmb_data *cmb_data)
  464. {
  465. struct cmb *cmb;
  466. struct ccw_device_private *node;
  467. int ret;
  468. spin_lock_irq(cdev->ccwlock);
  469. if (!list_empty(&cdev->private->cmb_list)) {
  470. ret = -EBUSY;
  471. goto out;
  472. }
  473. /* find first unused cmb in cmb_area.mem.
  474. * this is a little tricky: cmb_area.list
  475. * remains sorted by ->cmb->hw_data pointers */
  476. cmb = cmb_area.mem;
  477. list_for_each_entry(node, &cmb_area.list, cmb_list) {
  478. struct cmb_data *data;
  479. data = node->cmb;
  480. if ((struct cmb*)data->hw_block > cmb)
  481. break;
  482. cmb++;
  483. }
  484. if (cmb - cmb_area.mem >= cmb_area.num_channels) {
  485. ret = -ENOMEM;
  486. goto out;
  487. }
  488. /* insert new cmb */
  489. list_add_tail(&cdev->private->cmb_list, &node->cmb_list);
  490. cmb_data->hw_block = cmb;
  491. cdev->private->cmb = cmb_data;
  492. ret = 0;
  493. out:
  494. spin_unlock_irq(cdev->ccwlock);
  495. return ret;
  496. }
  497. static int
  498. alloc_cmb (struct ccw_device *cdev)
  499. {
  500. int ret;
  501. struct cmb *mem;
  502. ssize_t size;
  503. struct cmb_data *cmb_data;
  504. /* Allocate private cmb_data. */
  505. cmb_data = kzalloc(sizeof(struct cmb_data), GFP_KERNEL);
  506. if (!cmb_data)
  507. return -ENOMEM;
  508. cmb_data->last_block = kzalloc(sizeof(struct cmb), GFP_KERNEL);
  509. if (!cmb_data->last_block) {
  510. kfree(cmb_data);
  511. return -ENOMEM;
  512. }
  513. cmb_data->size = sizeof(struct cmb);
  514. spin_lock(&cmb_area.lock);
  515. if (!cmb_area.mem) {
  516. /* there is no user yet, so we need a new area */
  517. size = sizeof(struct cmb) * cmb_area.num_channels;
  518. WARN_ON(!list_empty(&cmb_area.list));
  519. spin_unlock(&cmb_area.lock);
  520. mem = (void*)__get_free_pages(GFP_KERNEL | GFP_DMA,
  521. get_order(size));
  522. spin_lock(&cmb_area.lock);
  523. if (cmb_area.mem) {
  524. /* ok, another thread was faster */
  525. free_pages((unsigned long)mem, get_order(size));
  526. } else if (!mem) {
  527. /* no luck */
  528. ret = -ENOMEM;
  529. goto out;
  530. } else {
  531. /* everything ok */
  532. memset(mem, 0, size);
  533. cmb_area.mem = mem;
  534. cmf_activate(cmb_area.mem, 1);
  535. }
  536. }
  537. /* do the actual allocation */
  538. ret = alloc_cmb_single(cdev, cmb_data);
  539. out:
  540. spin_unlock(&cmb_area.lock);
  541. if (ret) {
  542. kfree(cmb_data->last_block);
  543. kfree(cmb_data);
  544. }
  545. return ret;
  546. }
  547. static void free_cmb(struct ccw_device *cdev)
  548. {
  549. struct ccw_device_private *priv;
  550. struct cmb_data *cmb_data;
  551. spin_lock(&cmb_area.lock);
  552. spin_lock_irq(cdev->ccwlock);
  553. priv = cdev->private;
  554. if (list_empty(&priv->cmb_list)) {
  555. /* already freed */
  556. goto out;
  557. }
  558. cmb_data = priv->cmb;
  559. priv->cmb = NULL;
  560. if (cmb_data)
  561. kfree(cmb_data->last_block);
  562. kfree(cmb_data);
  563. list_del_init(&priv->cmb_list);
  564. if (list_empty(&cmb_area.list)) {
  565. ssize_t size;
  566. size = sizeof(struct cmb) * cmb_area.num_channels;
  567. cmf_activate(NULL, 0);
  568. free_pages((unsigned long)cmb_area.mem, get_order(size));
  569. cmb_area.mem = NULL;
  570. }
  571. out:
  572. spin_unlock_irq(cdev->ccwlock);
  573. spin_unlock(&cmb_area.lock);
  574. }
  575. static int set_cmb(struct ccw_device *cdev, u32 mme)
  576. {
  577. u16 offset;
  578. struct cmb_data *cmb_data;
  579. unsigned long flags;
  580. spin_lock_irqsave(cdev->ccwlock, flags);
  581. if (!cdev->private->cmb) {
  582. spin_unlock_irqrestore(cdev->ccwlock, flags);
  583. return -EINVAL;
  584. }
  585. cmb_data = cdev->private->cmb;
  586. offset = mme ? (struct cmb *)cmb_data->hw_block - cmb_area.mem : 0;
  587. spin_unlock_irqrestore(cdev->ccwlock, flags);
  588. return set_schib_wait(cdev, mme, 0, offset);
  589. }
  590. static u64 read_cmb (struct ccw_device *cdev, int index)
  591. {
  592. struct cmb *cmb;
  593. u32 val;
  594. int ret;
  595. unsigned long flags;
  596. ret = cmf_cmb_copy_wait(cdev);
  597. if (ret < 0)
  598. return 0;
  599. spin_lock_irqsave(cdev->ccwlock, flags);
  600. if (!cdev->private->cmb) {
  601. ret = 0;
  602. goto out;
  603. }
  604. cmb = ((struct cmb_data *)cdev->private->cmb)->last_block;
  605. switch (index) {
  606. case cmb_ssch_rsch_count:
  607. ret = cmb->ssch_rsch_count;
  608. goto out;
  609. case cmb_sample_count:
  610. ret = cmb->sample_count;
  611. goto out;
  612. case cmb_device_connect_time:
  613. val = cmb->device_connect_time;
  614. break;
  615. case cmb_function_pending_time:
  616. val = cmb->function_pending_time;
  617. break;
  618. case cmb_device_disconnect_time:
  619. val = cmb->device_disconnect_time;
  620. break;
  621. case cmb_control_unit_queuing_time:
  622. val = cmb->control_unit_queuing_time;
  623. break;
  624. case cmb_device_active_only_time:
  625. val = cmb->device_active_only_time;
  626. break;
  627. default:
  628. ret = 0;
  629. goto out;
  630. }
  631. ret = time_to_avg_nsec(val, cmb->sample_count);
  632. out:
  633. spin_unlock_irqrestore(cdev->ccwlock, flags);
  634. return ret;
  635. }
  636. static int readall_cmb (struct ccw_device *cdev, struct cmbdata *data)
  637. {
  638. struct cmb *cmb;
  639. struct cmb_data *cmb_data;
  640. u64 time;
  641. unsigned long flags;
  642. int ret;
  643. ret = cmf_cmb_copy_wait(cdev);
  644. if (ret < 0)
  645. return ret;
  646. spin_lock_irqsave(cdev->ccwlock, flags);
  647. cmb_data = cdev->private->cmb;
  648. if (!cmb_data) {
  649. ret = -ENODEV;
  650. goto out;
  651. }
  652. if (cmb_data->last_update == 0) {
  653. ret = -EAGAIN;
  654. goto out;
  655. }
  656. cmb = cmb_data->last_block;
  657. time = cmb_data->last_update - cdev->private->cmb_start_time;
  658. memset(data, 0, sizeof(struct cmbdata));
  659. /* we only know values before device_busy_time */
  660. data->size = offsetof(struct cmbdata, device_busy_time);
  661. /* convert to nanoseconds */
  662. data->elapsed_time = (time * 1000) >> 12;
  663. /* copy data to new structure */
  664. data->ssch_rsch_count = cmb->ssch_rsch_count;
  665. data->sample_count = cmb->sample_count;
  666. /* time fields are converted to nanoseconds while copying */
  667. data->device_connect_time = time_to_nsec(cmb->device_connect_time);
  668. data->function_pending_time = time_to_nsec(cmb->function_pending_time);
  669. data->device_disconnect_time =
  670. time_to_nsec(cmb->device_disconnect_time);
  671. data->control_unit_queuing_time
  672. = time_to_nsec(cmb->control_unit_queuing_time);
  673. data->device_active_only_time
  674. = time_to_nsec(cmb->device_active_only_time);
  675. ret = 0;
  676. out:
  677. spin_unlock_irqrestore(cdev->ccwlock, flags);
  678. return ret;
  679. }
  680. static void reset_cmb(struct ccw_device *cdev)
  681. {
  682. cmf_generic_reset(cdev);
  683. }
  684. static void * align_cmb(void *area)
  685. {
  686. return area;
  687. }
  688. static struct attribute_group cmf_attr_group;
  689. static struct cmb_operations cmbops_basic = {
  690. .alloc = alloc_cmb,
  691. .free = free_cmb,
  692. .set = set_cmb,
  693. .read = read_cmb,
  694. .readall = readall_cmb,
  695. .reset = reset_cmb,
  696. .align = align_cmb,
  697. .attr_group = &cmf_attr_group,
  698. };
  699. /* ******** extended cmb handling ********/
  700. /**
  701. * struct cmbe - extended channel measurement block
  702. *
  703. * cmb as used by the hardware, may be in any 64 bit physical location,
  704. * the fields are described in z/Architecture Principles of Operation,
  705. * third edition, chapter 17.
  706. */
  707. struct cmbe {
  708. u32 ssch_rsch_count;
  709. u32 sample_count;
  710. u32 device_connect_time;
  711. u32 function_pending_time;
  712. u32 device_disconnect_time;
  713. u32 control_unit_queuing_time;
  714. u32 device_active_only_time;
  715. u32 device_busy_time;
  716. u32 initial_command_response_time;
  717. u32 reserved[7];
  718. };
  719. /* kmalloc only guarantees 8 byte alignment, but we need cmbe
  720. * pointers to be naturally aligned. Make sure to allocate
  721. * enough space for two cmbes */
  722. static inline struct cmbe* cmbe_align(struct cmbe *c)
  723. {
  724. unsigned long addr;
  725. addr = ((unsigned long)c + sizeof (struct cmbe) - sizeof(long)) &
  726. ~(sizeof (struct cmbe) - sizeof(long));
  727. return (struct cmbe*)addr;
  728. }
  729. static int alloc_cmbe (struct ccw_device *cdev)
  730. {
  731. struct cmbe *cmbe;
  732. struct cmb_data *cmb_data;
  733. int ret;
  734. cmbe = kzalloc (sizeof (*cmbe) * 2, GFP_KERNEL);
  735. if (!cmbe)
  736. return -ENOMEM;
  737. cmb_data = kzalloc(sizeof(struct cmb_data), GFP_KERNEL);
  738. if (!cmb_data) {
  739. ret = -ENOMEM;
  740. goto out_free;
  741. }
  742. cmb_data->last_block = kzalloc(sizeof(struct cmbe), GFP_KERNEL);
  743. if (!cmb_data->last_block) {
  744. ret = -ENOMEM;
  745. goto out_free;
  746. }
  747. cmb_data->size = sizeof(struct cmbe);
  748. spin_lock_irq(cdev->ccwlock);
  749. if (cdev->private->cmb) {
  750. spin_unlock_irq(cdev->ccwlock);
  751. ret = -EBUSY;
  752. goto out_free;
  753. }
  754. cmb_data->hw_block = cmbe;
  755. cdev->private->cmb = cmb_data;
  756. spin_unlock_irq(cdev->ccwlock);
  757. /* activate global measurement if this is the first channel */
  758. spin_lock(&cmb_area.lock);
  759. if (list_empty(&cmb_area.list))
  760. cmf_activate(NULL, 1);
  761. list_add_tail(&cdev->private->cmb_list, &cmb_area.list);
  762. spin_unlock(&cmb_area.lock);
  763. return 0;
  764. out_free:
  765. if (cmb_data)
  766. kfree(cmb_data->last_block);
  767. kfree(cmb_data);
  768. kfree(cmbe);
  769. return ret;
  770. }
  771. static void free_cmbe (struct ccw_device *cdev)
  772. {
  773. struct cmb_data *cmb_data;
  774. spin_lock_irq(cdev->ccwlock);
  775. cmb_data = cdev->private->cmb;
  776. cdev->private->cmb = NULL;
  777. if (cmb_data)
  778. kfree(cmb_data->last_block);
  779. kfree(cmb_data);
  780. spin_unlock_irq(cdev->ccwlock);
  781. /* deactivate global measurement if this is the last channel */
  782. spin_lock(&cmb_area.lock);
  783. list_del_init(&cdev->private->cmb_list);
  784. if (list_empty(&cmb_area.list))
  785. cmf_activate(NULL, 0);
  786. spin_unlock(&cmb_area.lock);
  787. }
  788. static int set_cmbe(struct ccw_device *cdev, u32 mme)
  789. {
  790. unsigned long mba;
  791. struct cmb_data *cmb_data;
  792. unsigned long flags;
  793. spin_lock_irqsave(cdev->ccwlock, flags);
  794. if (!cdev->private->cmb) {
  795. spin_unlock_irqrestore(cdev->ccwlock, flags);
  796. return -EINVAL;
  797. }
  798. cmb_data = cdev->private->cmb;
  799. mba = mme ? (unsigned long) cmbe_align(cmb_data->hw_block) : 0;
  800. spin_unlock_irqrestore(cdev->ccwlock, flags);
  801. return set_schib_wait(cdev, mme, 1, mba);
  802. }
  803. static u64 read_cmbe (struct ccw_device *cdev, int index)
  804. {
  805. struct cmbe *cmb;
  806. struct cmb_data *cmb_data;
  807. u32 val;
  808. int ret;
  809. unsigned long flags;
  810. ret = cmf_cmb_copy_wait(cdev);
  811. if (ret < 0)
  812. return 0;
  813. spin_lock_irqsave(cdev->ccwlock, flags);
  814. cmb_data = cdev->private->cmb;
  815. if (!cmb_data) {
  816. ret = 0;
  817. goto out;
  818. }
  819. cmb = cmb_data->last_block;
  820. switch (index) {
  821. case cmb_ssch_rsch_count:
  822. ret = cmb->ssch_rsch_count;
  823. goto out;
  824. case cmb_sample_count:
  825. ret = cmb->sample_count;
  826. goto out;
  827. case cmb_device_connect_time:
  828. val = cmb->device_connect_time;
  829. break;
  830. case cmb_function_pending_time:
  831. val = cmb->function_pending_time;
  832. break;
  833. case cmb_device_disconnect_time:
  834. val = cmb->device_disconnect_time;
  835. break;
  836. case cmb_control_unit_queuing_time:
  837. val = cmb->control_unit_queuing_time;
  838. break;
  839. case cmb_device_active_only_time:
  840. val = cmb->device_active_only_time;
  841. break;
  842. case cmb_device_busy_time:
  843. val = cmb->device_busy_time;
  844. break;
  845. case cmb_initial_command_response_time:
  846. val = cmb->initial_command_response_time;
  847. break;
  848. default:
  849. ret = 0;
  850. goto out;
  851. }
  852. ret = time_to_avg_nsec(val, cmb->sample_count);
  853. out:
  854. spin_unlock_irqrestore(cdev->ccwlock, flags);
  855. return ret;
  856. }
  857. static int readall_cmbe (struct ccw_device *cdev, struct cmbdata *data)
  858. {
  859. struct cmbe *cmb;
  860. struct cmb_data *cmb_data;
  861. u64 time;
  862. unsigned long flags;
  863. int ret;
  864. ret = cmf_cmb_copy_wait(cdev);
  865. if (ret < 0)
  866. return ret;
  867. spin_lock_irqsave(cdev->ccwlock, flags);
  868. cmb_data = cdev->private->cmb;
  869. if (!cmb_data) {
  870. ret = -ENODEV;
  871. goto out;
  872. }
  873. if (cmb_data->last_update == 0) {
  874. ret = -EAGAIN;
  875. goto out;
  876. }
  877. time = cmb_data->last_update - cdev->private->cmb_start_time;
  878. memset (data, 0, sizeof(struct cmbdata));
  879. /* we only know values before device_busy_time */
  880. data->size = offsetof(struct cmbdata, device_busy_time);
  881. /* conver to nanoseconds */
  882. data->elapsed_time = (time * 1000) >> 12;
  883. cmb = cmb_data->last_block;
  884. /* copy data to new structure */
  885. data->ssch_rsch_count = cmb->ssch_rsch_count;
  886. data->sample_count = cmb->sample_count;
  887. /* time fields are converted to nanoseconds while copying */
  888. data->device_connect_time = time_to_nsec(cmb->device_connect_time);
  889. data->function_pending_time = time_to_nsec(cmb->function_pending_time);
  890. data->device_disconnect_time =
  891. time_to_nsec(cmb->device_disconnect_time);
  892. data->control_unit_queuing_time
  893. = time_to_nsec(cmb->control_unit_queuing_time);
  894. data->device_active_only_time
  895. = time_to_nsec(cmb->device_active_only_time);
  896. data->device_busy_time = time_to_nsec(cmb->device_busy_time);
  897. data->initial_command_response_time
  898. = time_to_nsec(cmb->initial_command_response_time);
  899. ret = 0;
  900. out:
  901. spin_unlock_irqrestore(cdev->ccwlock, flags);
  902. return ret;
  903. }
  904. static void reset_cmbe(struct ccw_device *cdev)
  905. {
  906. cmf_generic_reset(cdev);
  907. }
  908. static void * align_cmbe(void *area)
  909. {
  910. return cmbe_align(area);
  911. }
  912. static struct attribute_group cmf_attr_group_ext;
  913. static struct cmb_operations cmbops_extended = {
  914. .alloc = alloc_cmbe,
  915. .free = free_cmbe,
  916. .set = set_cmbe,
  917. .read = read_cmbe,
  918. .readall = readall_cmbe,
  919. .reset = reset_cmbe,
  920. .align = align_cmbe,
  921. .attr_group = &cmf_attr_group_ext,
  922. };
  923. static ssize_t
  924. cmb_show_attr(struct device *dev, char *buf, enum cmb_index idx)
  925. {
  926. return sprintf(buf, "%lld\n",
  927. (unsigned long long) cmf_read(to_ccwdev(dev), idx));
  928. }
  929. static ssize_t
  930. cmb_show_avg_sample_interval(struct device *dev, struct device_attribute *attr, char *buf)
  931. {
  932. struct ccw_device *cdev;
  933. long interval;
  934. unsigned long count;
  935. struct cmb_data *cmb_data;
  936. cdev = to_ccwdev(dev);
  937. count = cmf_read(cdev, cmb_sample_count);
  938. spin_lock_irq(cdev->ccwlock);
  939. cmb_data = cdev->private->cmb;
  940. if (count) {
  941. interval = cmb_data->last_update -
  942. cdev->private->cmb_start_time;
  943. interval = (interval * 1000) >> 12;
  944. interval /= count;
  945. } else
  946. interval = -1;
  947. spin_unlock_irq(cdev->ccwlock);
  948. return sprintf(buf, "%ld\n", interval);
  949. }
  950. static ssize_t
  951. cmb_show_avg_utilization(struct device *dev, struct device_attribute *attr, char *buf)
  952. {
  953. struct cmbdata data;
  954. u64 utilization;
  955. unsigned long t, u;
  956. int ret;
  957. ret = cmf_readall(to_ccwdev(dev), &data);
  958. if (ret == -EAGAIN || ret == -ENODEV)
  959. /* No data (yet/currently) available to use for calculation. */
  960. return sprintf(buf, "n/a\n");
  961. else if (ret)
  962. return ret;
  963. utilization = data.device_connect_time +
  964. data.function_pending_time +
  965. data.device_disconnect_time;
  966. /* shift to avoid long long division */
  967. while (-1ul < (data.elapsed_time | utilization)) {
  968. utilization >>= 8;
  969. data.elapsed_time >>= 8;
  970. }
  971. /* calculate value in 0.1 percent units */
  972. t = (unsigned long) data.elapsed_time / 1000;
  973. u = (unsigned long) utilization / t;
  974. return sprintf(buf, "%02ld.%01ld%%\n", u/ 10, u - (u/ 10) * 10);
  975. }
  976. #define cmf_attr(name) \
  977. static ssize_t show_ ## name (struct device * dev, struct device_attribute *attr, char * buf) \
  978. { return cmb_show_attr((dev), buf, cmb_ ## name); } \
  979. static DEVICE_ATTR(name, 0444, show_ ## name, NULL);
  980. #define cmf_attr_avg(name) \
  981. static ssize_t show_avg_ ## name (struct device * dev, struct device_attribute *attr, char * buf) \
  982. { return cmb_show_attr((dev), buf, cmb_ ## name); } \
  983. static DEVICE_ATTR(avg_ ## name, 0444, show_avg_ ## name, NULL);
  984. cmf_attr(ssch_rsch_count);
  985. cmf_attr(sample_count);
  986. cmf_attr_avg(device_connect_time);
  987. cmf_attr_avg(function_pending_time);
  988. cmf_attr_avg(device_disconnect_time);
  989. cmf_attr_avg(control_unit_queuing_time);
  990. cmf_attr_avg(device_active_only_time);
  991. cmf_attr_avg(device_busy_time);
  992. cmf_attr_avg(initial_command_response_time);
  993. static DEVICE_ATTR(avg_sample_interval, 0444, cmb_show_avg_sample_interval, NULL);
  994. static DEVICE_ATTR(avg_utilization, 0444, cmb_show_avg_utilization, NULL);
  995. static struct attribute *cmf_attributes[] = {
  996. &dev_attr_avg_sample_interval.attr,
  997. &dev_attr_avg_utilization.attr,
  998. &dev_attr_ssch_rsch_count.attr,
  999. &dev_attr_sample_count.attr,
  1000. &dev_attr_avg_device_connect_time.attr,
  1001. &dev_attr_avg_function_pending_time.attr,
  1002. &dev_attr_avg_device_disconnect_time.attr,
  1003. &dev_attr_avg_control_unit_queuing_time.attr,
  1004. &dev_attr_avg_device_active_only_time.attr,
  1005. NULL,
  1006. };
  1007. static struct attribute_group cmf_attr_group = {
  1008. .name = "cmf",
  1009. .attrs = cmf_attributes,
  1010. };
  1011. static struct attribute *cmf_attributes_ext[] = {
  1012. &dev_attr_avg_sample_interval.attr,
  1013. &dev_attr_avg_utilization.attr,
  1014. &dev_attr_ssch_rsch_count.attr,
  1015. &dev_attr_sample_count.attr,
  1016. &dev_attr_avg_device_connect_time.attr,
  1017. &dev_attr_avg_function_pending_time.attr,
  1018. &dev_attr_avg_device_disconnect_time.attr,
  1019. &dev_attr_avg_control_unit_queuing_time.attr,
  1020. &dev_attr_avg_device_active_only_time.attr,
  1021. &dev_attr_avg_device_busy_time.attr,
  1022. &dev_attr_avg_initial_command_response_time.attr,
  1023. NULL,
  1024. };
  1025. static struct attribute_group cmf_attr_group_ext = {
  1026. .name = "cmf",
  1027. .attrs = cmf_attributes_ext,
  1028. };
  1029. static ssize_t cmb_enable_show(struct device *dev, struct device_attribute *attr, char *buf)
  1030. {
  1031. return sprintf(buf, "%d\n", to_ccwdev(dev)->private->cmb ? 1 : 0);
  1032. }
  1033. static ssize_t cmb_enable_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t c)
  1034. {
  1035. struct ccw_device *cdev;
  1036. int ret;
  1037. cdev = to_ccwdev(dev);
  1038. switch (buf[0]) {
  1039. case '0':
  1040. ret = disable_cmf(cdev);
  1041. if (ret)
  1042. printk(KERN_INFO "disable_cmf failed (%d)\n", ret);
  1043. break;
  1044. case '1':
  1045. ret = enable_cmf(cdev);
  1046. if (ret && ret != -EBUSY)
  1047. printk(KERN_INFO "enable_cmf failed (%d)\n", ret);
  1048. break;
  1049. }
  1050. return c;
  1051. }
  1052. DEVICE_ATTR(cmb_enable, 0644, cmb_enable_show, cmb_enable_store);
  1053. /* enable_cmf/disable_cmf: module interface for cmf (de)activation */
  1054. int
  1055. enable_cmf(struct ccw_device *cdev)
  1056. {
  1057. int ret;
  1058. ret = cmbops->alloc(cdev);
  1059. cmbops->reset(cdev);
  1060. if (ret)
  1061. return ret;
  1062. ret = cmbops->set(cdev, 2);
  1063. if (ret) {
  1064. cmbops->free(cdev);
  1065. return ret;
  1066. }
  1067. ret = sysfs_create_group(&cdev->dev.kobj, cmbops->attr_group);
  1068. if (!ret)
  1069. return 0;
  1070. cmbops->set(cdev, 0); //FIXME: this can fail
  1071. cmbops->free(cdev);
  1072. return ret;
  1073. }
  1074. int
  1075. disable_cmf(struct ccw_device *cdev)
  1076. {
  1077. int ret;
  1078. ret = cmbops->set(cdev, 0);
  1079. if (ret)
  1080. return ret;
  1081. cmbops->free(cdev);
  1082. sysfs_remove_group(&cdev->dev.kobj, cmbops->attr_group);
  1083. return ret;
  1084. }
  1085. u64
  1086. cmf_read(struct ccw_device *cdev, int index)
  1087. {
  1088. return cmbops->read(cdev, index);
  1089. }
  1090. int
  1091. cmf_readall(struct ccw_device *cdev, struct cmbdata *data)
  1092. {
  1093. return cmbops->readall(cdev, data);
  1094. }
  1095. /* Reenable cmf when a disconnected device becomes available again. */
  1096. int cmf_reenable(struct ccw_device *cdev)
  1097. {
  1098. cmbops->reset(cdev);
  1099. return cmbops->set(cdev, 2);
  1100. }
  1101. static int __init
  1102. init_cmf(void)
  1103. {
  1104. char *format_string;
  1105. char *detect_string = "parameter";
  1106. /* We cannot really autoprobe this. If the user did not give a parameter,
  1107. see if we are running on z990 or up, otherwise fall back to basic mode. */
  1108. if (format == CMF_AUTODETECT) {
  1109. if (!css_characteristics_avail ||
  1110. !css_general_characteristics.ext_mb) {
  1111. format = CMF_BASIC;
  1112. } else {
  1113. format = CMF_EXTENDED;
  1114. }
  1115. detect_string = "autodetected";
  1116. } else {
  1117. detect_string = "parameter";
  1118. }
  1119. switch (format) {
  1120. case CMF_BASIC:
  1121. format_string = "basic";
  1122. cmbops = &cmbops_basic;
  1123. if (cmb_area.num_channels > 4096 || cmb_area.num_channels < 1) {
  1124. printk(KERN_ERR "Basic channel measurement facility"
  1125. " can only use 1 to 4096 devices\n"
  1126. KERN_ERR "when the cmf driver is built"
  1127. " as a loadable module\n");
  1128. return 1;
  1129. }
  1130. break;
  1131. case CMF_EXTENDED:
  1132. format_string = "extended";
  1133. cmbops = &cmbops_extended;
  1134. break;
  1135. default:
  1136. printk(KERN_ERR "Invalid format %d for channel "
  1137. "measurement facility\n", format);
  1138. return 1;
  1139. }
  1140. printk(KERN_INFO "Channel measurement facility using %s format (%s)\n",
  1141. format_string, detect_string);
  1142. return 0;
  1143. }
  1144. module_init(init_cmf);
  1145. MODULE_AUTHOR("Arnd Bergmann <arndb@de.ibm.com>");
  1146. MODULE_LICENSE("GPL");
  1147. MODULE_DESCRIPTION("channel measurement facility base driver\n"
  1148. "Copyright 2003 IBM Corporation\n");
  1149. EXPORT_SYMBOL_GPL(enable_cmf);
  1150. EXPORT_SYMBOL_GPL(disable_cmf);
  1151. EXPORT_SYMBOL_GPL(cmf_read);
  1152. EXPORT_SYMBOL_GPL(cmf_readall);