blob: f822f83418e40723327f87dd9a70d14e0cda06df [file] [log] [blame]
Paul Mundt0c7b1df2006-09-27 15:08:07 +09001/*
2 * arch/sh/mm/pmb.c
3 *
4 * Privileged Space Mapping Buffer (PMB) Support.
5 *
Matt Fleming3d467672010-01-18 19:33:10 +09006 * Copyright (C) 2005 - 2010 Paul Mundt
7 * Copyright (C) 2010 Matt Fleming
Paul Mundt0c7b1df2006-09-27 15:08:07 +09008 *
9 * This file is subject to the terms and conditions of the GNU General Public
10 * License. See the file "COPYING" in the main directory of this archive
11 * for more details.
12 */
13#include <linux/init.h>
14#include <linux/kernel.h>
Francesco VIRLINZIa83c0b72009-03-11 10:39:02 +000015#include <linux/sysdev.h>
16#include <linux/cpu.h>
Paul Mundt0c7b1df2006-09-27 15:08:07 +090017#include <linux/module.h>
18#include <linux/slab.h>
19#include <linux/bitops.h>
20#include <linux/debugfs.h>
21#include <linux/fs.h>
22#include <linux/seq_file.h>
23#include <linux/err.h>
24#include <asm/system.h>
25#include <asm/uaccess.h>
Paul Mundtd7cdc9e2006-09-27 15:16:42 +090026#include <asm/pgtable.h>
Paul Mundt0c7b1df2006-09-27 15:08:07 +090027#include <asm/mmu.h>
28#include <asm/io.h>
Stuart Menefyeddeeb32007-11-26 21:32:40 +090029#include <asm/mmu_context.h>
Paul Mundt0c7b1df2006-09-27 15:08:07 +090030
31#define NR_PMB_ENTRIES 16
32
Matt Flemingfc2bdef2009-10-06 21:22:22 +000033static void __pmb_unmap(struct pmb_entry *);
34
Matt Flemingedd7de82009-10-06 21:22:29 +000035static struct pmb_entry pmb_entry_list[NR_PMB_ENTRIES];
Paul Mundt0c7b1df2006-09-27 15:08:07 +090036static unsigned long pmb_map;
37
Paul Mundt0c7b1df2006-09-27 15:08:07 +090038static inline unsigned long mk_pmb_entry(unsigned int entry)
39{
40 return (entry & PMB_E_MASK) << PMB_E_SHIFT;
41}
42
43static inline unsigned long mk_pmb_addr(unsigned int entry)
44{
45 return mk_pmb_entry(entry) | PMB_ADDR;
46}
47
48static inline unsigned long mk_pmb_data(unsigned int entry)
49{
50 return mk_pmb_entry(entry) | PMB_DATA;
51}
52
Matt Fleming067784f2009-10-06 21:22:23 +000053static int pmb_alloc_entry(void)
54{
55 unsigned int pos;
56
57repeat:
58 pos = find_first_zero_bit(&pmb_map, NR_PMB_ENTRIES);
59
60 if (unlikely(pos > NR_PMB_ENTRIES))
61 return -ENOSPC;
62
63 if (test_and_set_bit(pos, &pmb_map))
64 goto repeat;
65
66 return pos;
67}
68
Matt Fleming8386aeb2009-10-06 21:22:28 +000069static struct pmb_entry *pmb_alloc(unsigned long vpn, unsigned long ppn,
Matt Fleming20b50142009-10-06 21:22:33 +000070 unsigned long flags, int entry)
Paul Mundt0c7b1df2006-09-27 15:08:07 +090071{
72 struct pmb_entry *pmbe;
Matt Fleming067784f2009-10-06 21:22:23 +000073 int pos;
74
Matt Fleming20b50142009-10-06 21:22:33 +000075 if (entry == PMB_NO_ENTRY) {
76 pos = pmb_alloc_entry();
77 if (pos < 0)
78 return ERR_PTR(pos);
79 } else {
Paul Mundt55cef912010-02-16 17:14:04 +090080 if (test_and_set_bit(entry, &pmb_map))
Matt Fleming20b50142009-10-06 21:22:33 +000081 return ERR_PTR(-ENOSPC);
82 pos = entry;
83 }
Paul Mundt0c7b1df2006-09-27 15:08:07 +090084
Matt Flemingedd7de82009-10-06 21:22:29 +000085 pmbe = &pmb_entry_list[pos];
Paul Mundt0c7b1df2006-09-27 15:08:07 +090086 if (!pmbe)
87 return ERR_PTR(-ENOMEM);
88
89 pmbe->vpn = vpn;
90 pmbe->ppn = ppn;
91 pmbe->flags = flags;
Matt Fleming067784f2009-10-06 21:22:23 +000092 pmbe->entry = pos;
Paul Mundt0c7b1df2006-09-27 15:08:07 +090093
94 return pmbe;
95}
96
Matt Fleming8386aeb2009-10-06 21:22:28 +000097static void pmb_free(struct pmb_entry *pmbe)
Paul Mundt0c7b1df2006-09-27 15:08:07 +090098{
Matt Flemingedd7de82009-10-06 21:22:29 +000099 int pos = pmbe->entry;
Paul Mundt38c425f2007-05-11 11:26:10 +0900100
Matt Flemingedd7de82009-10-06 21:22:29 +0000101 pmbe->vpn = 0;
102 pmbe->ppn = 0;
103 pmbe->flags = 0;
104 pmbe->entry = 0;
105
106 clear_bit(pos, &pmb_map);
Paul Mundt0c7b1df2006-09-27 15:08:07 +0900107}
108
109/*
110 * Must be in P2 for __set_pmb_entry()
111 */
Matt Fleming8386aeb2009-10-06 21:22:28 +0000112static void __set_pmb_entry(unsigned long vpn, unsigned long ppn,
113 unsigned long flags, int pos)
Paul Mundt0c7b1df2006-09-27 15:08:07 +0900114{
Paul Mundt9d56dd32010-01-26 12:58:40 +0900115 __raw_writel(vpn | PMB_V, mk_pmb_addr(pos));
Paul Mundt0c7b1df2006-09-27 15:08:07 +0900116
Paul Mundte7bd34a2007-07-31 17:07:28 +0900117#ifdef CONFIG_CACHE_WRITETHROUGH
Paul Mundt0c7b1df2006-09-27 15:08:07 +0900118 /*
119 * When we are in 32-bit address extended mode, CCR.CB becomes
120 * invalid, so care must be taken to manually adjust cacheable
121 * translations.
122 */
123 if (likely(flags & PMB_C))
124 flags |= PMB_WT;
125#endif
126
Paul Mundt9d56dd32010-01-26 12:58:40 +0900127 __raw_writel(ppn | flags | PMB_V, mk_pmb_data(pos));
Paul Mundt0c7b1df2006-09-27 15:08:07 +0900128}
129
Paul Mundt2dc2f8e2010-01-21 16:05:25 +0900130static void set_pmb_entry(struct pmb_entry *pmbe)
Paul Mundt0c7b1df2006-09-27 15:08:07 +0900131{
Stuart Menefycbaa1182007-11-30 17:06:36 +0900132 jump_to_uncached();
Matt Fleming067784f2009-10-06 21:22:23 +0000133 __set_pmb_entry(pmbe->vpn, pmbe->ppn, pmbe->flags, pmbe->entry);
Stuart Menefycbaa1182007-11-30 17:06:36 +0900134 back_to_cached();
Paul Mundt0c7b1df2006-09-27 15:08:07 +0900135}
136
Paul Mundt2dc2f8e2010-01-21 16:05:25 +0900137static void clear_pmb_entry(struct pmb_entry *pmbe)
Paul Mundt0c7b1df2006-09-27 15:08:07 +0900138{
139 unsigned int entry = pmbe->entry;
140 unsigned long addr;
141
Matt Fleming31051212009-10-06 21:22:30 +0000142 if (unlikely(entry >= NR_PMB_ENTRIES))
Paul Mundt0c7b1df2006-09-27 15:08:07 +0900143 return;
144
Stuart Menefycbaa1182007-11-30 17:06:36 +0900145 jump_to_uncached();
Paul Mundt0c7b1df2006-09-27 15:08:07 +0900146
147 /* Clear V-bit */
148 addr = mk_pmb_addr(entry);
Paul Mundt9d56dd32010-01-26 12:58:40 +0900149 __raw_writel(__raw_readl(addr) & ~PMB_V, addr);
Paul Mundt0c7b1df2006-09-27 15:08:07 +0900150
151 addr = mk_pmb_data(entry);
Paul Mundt9d56dd32010-01-26 12:58:40 +0900152 __raw_writel(__raw_readl(addr) & ~PMB_V, addr);
Paul Mundt0c7b1df2006-09-27 15:08:07 +0900153
Stuart Menefycbaa1182007-11-30 17:06:36 +0900154 back_to_cached();
Paul Mundt0c7b1df2006-09-27 15:08:07 +0900155}
156
Paul Mundtd7cdc9e2006-09-27 15:16:42 +0900157
158static struct {
159 unsigned long size;
160 int flag;
161} pmb_sizes[] = {
162 { .size = 0x20000000, .flag = PMB_SZ_512M, },
163 { .size = 0x08000000, .flag = PMB_SZ_128M, },
164 { .size = 0x04000000, .flag = PMB_SZ_64M, },
165 { .size = 0x01000000, .flag = PMB_SZ_16M, },
166};
167
168long pmb_remap(unsigned long vaddr, unsigned long phys,
169 unsigned long size, unsigned long flags)
170{
Matt Flemingfc2bdef2009-10-06 21:22:22 +0000171 struct pmb_entry *pmbp, *pmbe;
Paul Mundtd7cdc9e2006-09-27 15:16:42 +0900172 unsigned long wanted;
173 int pmb_flags, i;
Matt Flemingfc2bdef2009-10-06 21:22:22 +0000174 long err;
Paul Mundtd7cdc9e2006-09-27 15:16:42 +0900175
176 /* Convert typical pgprot value to the PMB equivalent */
177 if (flags & _PAGE_CACHABLE) {
178 if (flags & _PAGE_WT)
179 pmb_flags = PMB_WT;
180 else
181 pmb_flags = PMB_C;
182 } else
183 pmb_flags = PMB_WT | PMB_UB;
184
185 pmbp = NULL;
186 wanted = size;
187
188again:
189 for (i = 0; i < ARRAY_SIZE(pmb_sizes); i++) {
Paul Mundtd7cdc9e2006-09-27 15:16:42 +0900190 if (size < pmb_sizes[i].size)
191 continue;
192
Matt Fleming20b50142009-10-06 21:22:33 +0000193 pmbe = pmb_alloc(vaddr, phys, pmb_flags | pmb_sizes[i].flag,
194 PMB_NO_ENTRY);
Matt Flemingfc2bdef2009-10-06 21:22:22 +0000195 if (IS_ERR(pmbe)) {
196 err = PTR_ERR(pmbe);
197 goto out;
198 }
Paul Mundtd7cdc9e2006-09-27 15:16:42 +0900199
Matt Fleming067784f2009-10-06 21:22:23 +0000200 set_pmb_entry(pmbe);
Paul Mundtd7cdc9e2006-09-27 15:16:42 +0900201
202 phys += pmb_sizes[i].size;
203 vaddr += pmb_sizes[i].size;
204 size -= pmb_sizes[i].size;
205
206 /*
207 * Link adjacent entries that span multiple PMB entries
208 * for easier tear-down.
209 */
210 if (likely(pmbp))
211 pmbp->link = pmbe;
212
213 pmbp = pmbe;
Matt Fleminga2767cf2009-10-06 21:22:34 +0000214
215 /*
216 * Instead of trying smaller sizes on every iteration
217 * (even if we succeed in allocating space), try using
218 * pmb_sizes[i].size again.
219 */
220 i--;
Paul Mundtd7cdc9e2006-09-27 15:16:42 +0900221 }
222
223 if (size >= 0x1000000)
224 goto again;
225
226 return wanted - size;
Matt Flemingfc2bdef2009-10-06 21:22:22 +0000227
228out:
229 if (pmbp)
230 __pmb_unmap(pmbp);
231
232 return err;
Paul Mundtd7cdc9e2006-09-27 15:16:42 +0900233}
234
235void pmb_unmap(unsigned long addr)
236{
Matt Flemingedd7de82009-10-06 21:22:29 +0000237 struct pmb_entry *pmbe = NULL;
238 int i;
Paul Mundtd7cdc9e2006-09-27 15:16:42 +0900239
Matt Flemingedd7de82009-10-06 21:22:29 +0000240 for (i = 0; i < ARRAY_SIZE(pmb_entry_list); i++) {
241 if (test_bit(i, &pmb_map)) {
242 pmbe = &pmb_entry_list[i];
243 if (pmbe->vpn == addr)
244 break;
245 }
246 }
Paul Mundtd7cdc9e2006-09-27 15:16:42 +0900247
248 if (unlikely(!pmbe))
249 return;
250
Matt Flemingfc2bdef2009-10-06 21:22:22 +0000251 __pmb_unmap(pmbe);
252}
253
254static void __pmb_unmap(struct pmb_entry *pmbe)
255{
Matt Flemingedd7de82009-10-06 21:22:29 +0000256 BUG_ON(!test_bit(pmbe->entry, &pmb_map));
Paul Mundtd7cdc9e2006-09-27 15:16:42 +0900257
258 do {
259 struct pmb_entry *pmblink = pmbe;
260
Matt Fleming067784f2009-10-06 21:22:23 +0000261 /*
262 * We may be called before this pmb_entry has been
263 * entered into the PMB table via set_pmb_entry(), but
264 * that's OK because we've allocated a unique slot for
265 * this entry in pmb_alloc() (even if we haven't filled
266 * it yet).
267 *
268 * Therefore, calling clear_pmb_entry() is safe as no
269 * other mapping can be using that slot.
270 */
271 clear_pmb_entry(pmbe);
Matt Flemingfc2bdef2009-10-06 21:22:22 +0000272
Paul Mundtd7cdc9e2006-09-27 15:16:42 +0900273 pmbe = pmblink->link;
274
275 pmb_free(pmblink);
276 } while (pmbe);
277}
278
Paul Mundtefd54ea2010-02-16 18:39:30 +0900279static inline void
280pmb_log_mapping(unsigned long data_val, unsigned long vpn, unsigned long ppn)
Matt Fleming3d467672010-01-18 19:33:10 +0900281{
Paul Mundtefd54ea2010-02-16 18:39:30 +0900282 unsigned int size;
283 const char *sz_str;
284
285 size = data_val & PMB_SZ_MASK;
286
287 sz_str = (size == PMB_SZ_16M) ? " 16MB":
288 (size == PMB_SZ_64M) ? " 64MB":
289 (size == PMB_SZ_128M) ? "128MB":
290 "512MB";
291
292 pr_info("\t0x%08lx -> 0x%08lx [ %s %scached ]\n",
293 vpn >> PAGE_SHIFT, ppn >> PAGE_SHIFT, sz_str,
294 (data_val & PMB_C) ? "" : "un");
Matt Fleming3d467672010-01-18 19:33:10 +0900295}
296
Paul Mundtefd54ea2010-02-16 18:39:30 +0900297static inline unsigned int pmb_ppn_in_range(unsigned long ppn)
298{
299 return ppn >= __pa(memory_start) && ppn < __pa(memory_end);
300}
301
302static int pmb_synchronize_mappings(void)
Matt Fleming20b50142009-10-06 21:22:33 +0000303{
Matt Fleming3d467672010-01-18 19:33:10 +0900304 unsigned int applied = 0;
305 int i;
306
Paul Mundtefd54ea2010-02-16 18:39:30 +0900307 pr_info("PMB: boot mappings:\n");
Matt Fleming3d467672010-01-18 19:33:10 +0900308
309 /*
Paul Mundtefd54ea2010-02-16 18:39:30 +0900310 * Run through the initial boot mappings, log the established
311 * ones, and blow away anything that falls outside of the valid
312 * PPN range. Specifically, we only care about existing mappings
313 * that impact the cached/uncached sections.
Matt Fleming3d467672010-01-18 19:33:10 +0900314 *
Paul Mundtefd54ea2010-02-16 18:39:30 +0900315 * Note that touching these can be a bit of a minefield; the boot
316 * loader can establish multi-page mappings with the same caching
317 * attributes, so we need to ensure that we aren't modifying a
318 * mapping that we're presently executing from, or may execute
319 * from in the case of straddling page boundaries.
Matt Fleming3d467672010-01-18 19:33:10 +0900320 *
Paul Mundtefd54ea2010-02-16 18:39:30 +0900321 * In the future we will have to tidy up after the boot loader by
322 * jumping between the cached and uncached mappings and tearing
323 * down alternating mappings while executing from the other.
Matt Fleming3d467672010-01-18 19:33:10 +0900324 */
325 for (i = 0; i < PMB_ENTRY_MAX; i++) {
326 unsigned long addr, data;
327 unsigned long addr_val, data_val;
Paul Mundtefd54ea2010-02-16 18:39:30 +0900328 unsigned long ppn, vpn, flags;
329 struct pmb_entry *pmbe;
Matt Fleming3d467672010-01-18 19:33:10 +0900330
331 addr = mk_pmb_addr(i);
332 data = mk_pmb_data(i);
333
334 addr_val = __raw_readl(addr);
335 data_val = __raw_readl(data);
336
337 /*
338 * Skip over any bogus entries
339 */
340 if (!(data_val & PMB_V) || !(addr_val & PMB_V))
341 continue;
342
343 ppn = data_val & PMB_PFN_MASK;
344 vpn = addr_val & PMB_PFN_MASK;
345
346 /*
347 * Only preserve in-range mappings.
348 */
Paul Mundtefd54ea2010-02-16 18:39:30 +0900349 if (!pmb_ppn_in_range(ppn)) {
Matt Fleming3d467672010-01-18 19:33:10 +0900350 /*
351 * Invalidate anything out of bounds.
352 */
353 __raw_writel(addr_val & ~PMB_V, addr);
354 __raw_writel(data_val & ~PMB_V, data);
Paul Mundtefd54ea2010-02-16 18:39:30 +0900355 continue;
Matt Fleming3d467672010-01-18 19:33:10 +0900356 }
Paul Mundtefd54ea2010-02-16 18:39:30 +0900357
358 /*
359 * Update the caching attributes if necessary
360 */
361 if (data_val & PMB_C) {
362#if defined(CONFIG_CACHE_WRITETHROUGH)
363 data_val |= PMB_WT;
364#elif defined(CONFIG_CACHE_WRITEBACK)
365 data_val &= ~PMB_WT;
366#else
367 data_val &= ~(PMB_C | PMB_WT);
368#endif
369 __raw_writel(data_val, data);
370 }
371
372 flags = data_val & (PMB_SZ_MASK | PMB_CACHE_MASK);
373
374 pmbe = pmb_alloc(vpn, ppn, flags, i);
375 if (IS_ERR(pmbe)) {
376 WARN_ON_ONCE(1);
377 continue;
378 }
379
380 pmb_log_mapping(data_val, vpn, ppn);
381
382 applied++;
Matt Fleming3d467672010-01-18 19:33:10 +0900383 }
384
385 return (applied == 0);
386}
Matt Fleming3d467672010-01-18 19:33:10 +0900387
Paul Mundt2dc2f8e2010-01-21 16:05:25 +0900388int pmb_init(void)
Matt Fleming3d467672010-01-18 19:33:10 +0900389{
Paul Mundtefd54ea2010-02-16 18:39:30 +0900390 int ret;
Matt Fleming20b50142009-10-06 21:22:33 +0000391
Matt Fleming3d467672010-01-18 19:33:10 +0900392 jump_to_uncached();
393
394 /*
Matt Fleming3d467672010-01-18 19:33:10 +0900395 * Sync our software copy of the PMB mappings with those in
396 * hardware. The mappings in the hardware PMB were either set up
397 * by the bootloader or very early on by the kernel.
398 */
Paul Mundtefd54ea2010-02-16 18:39:30 +0900399 ret = pmb_synchronize_mappings();
400 if (unlikely(ret == 0)) {
401 back_to_cached();
402 return 0;
Matt Fleming20b50142009-10-06 21:22:33 +0000403 }
404
Paul Mundt9d56dd32010-01-26 12:58:40 +0900405 __raw_writel(0, PMB_IRMCR);
Paul Mundta0ab3662010-01-13 18:31:48 +0900406
Paul Mundta0ab3662010-01-13 18:31:48 +0900407 /* Flush out the TLB */
Paul Mundtefd54ea2010-02-16 18:39:30 +0900408 __raw_writel(__raw_readl(MMUCR) | MMUCR_TI, MMUCR);
Paul Mundta0ab3662010-01-13 18:31:48 +0900409
Matt Fleming20b50142009-10-06 21:22:33 +0000410 back_to_cached();
411
412 return 0;
413}
Paul Mundt0c7b1df2006-09-27 15:08:07 +0900414
Paul Mundt2efa53b2010-01-20 16:40:48 +0900415bool __in_29bit_mode(void)
416{
417 return (__raw_readl(PMB_PASCR) & PASCR_SE) == 0;
418}
419
Paul Mundt0c7b1df2006-09-27 15:08:07 +0900420static int pmb_seq_show(struct seq_file *file, void *iter)
421{
422 int i;
423
424 seq_printf(file, "V: Valid, C: Cacheable, WT: Write-Through\n"
425 "CB: Copy-Back, B: Buffered, UB: Unbuffered\n");
426 seq_printf(file, "ety vpn ppn size flags\n");
427
428 for (i = 0; i < NR_PMB_ENTRIES; i++) {
429 unsigned long addr, data;
430 unsigned int size;
431 char *sz_str = NULL;
432
Paul Mundt9d56dd32010-01-26 12:58:40 +0900433 addr = __raw_readl(mk_pmb_addr(i));
434 data = __raw_readl(mk_pmb_data(i));
Paul Mundt0c7b1df2006-09-27 15:08:07 +0900435
436 size = data & PMB_SZ_MASK;
437 sz_str = (size == PMB_SZ_16M) ? " 16MB":
438 (size == PMB_SZ_64M) ? " 64MB":
439 (size == PMB_SZ_128M) ? "128MB":
440 "512MB";
441
442 /* 02: V 0x88 0x08 128MB C CB B */
443 seq_printf(file, "%02d: %c 0x%02lx 0x%02lx %s %c %s %s\n",
444 i, ((addr & PMB_V) && (data & PMB_V)) ? 'V' : ' ',
445 (addr >> 24) & 0xff, (data >> 24) & 0xff,
446 sz_str, (data & PMB_C) ? 'C' : ' ',
447 (data & PMB_WT) ? "WT" : "CB",
448 (data & PMB_UB) ? "UB" : " B");
449 }
450
451 return 0;
452}
453
454static int pmb_debugfs_open(struct inode *inode, struct file *file)
455{
456 return single_open(file, pmb_seq_show, NULL);
457}
458
Arjan van de Ven5dfe4c92007-02-12 00:55:31 -0800459static const struct file_operations pmb_debugfs_fops = {
Paul Mundt0c7b1df2006-09-27 15:08:07 +0900460 .owner = THIS_MODULE,
461 .open = pmb_debugfs_open,
462 .read = seq_read,
463 .llseek = seq_lseek,
Li Zefan45dabf12008-06-24 13:30:23 +0800464 .release = single_release,
Paul Mundt0c7b1df2006-09-27 15:08:07 +0900465};
466
467static int __init pmb_debugfs_init(void)
468{
469 struct dentry *dentry;
470
471 dentry = debugfs_create_file("pmb", S_IFREG | S_IRUGO,
Paul Mundtb9e393c2008-03-07 17:19:58 +0900472 sh_debugfs_root, NULL, &pmb_debugfs_fops);
Zhaolei25627c72008-10-17 19:25:09 +0800473 if (!dentry)
474 return -ENOMEM;
Paul Mundt0c7b1df2006-09-27 15:08:07 +0900475 if (IS_ERR(dentry))
476 return PTR_ERR(dentry);
477
478 return 0;
479}
Paul Mundt0c7b1df2006-09-27 15:08:07 +0900480postcore_initcall(pmb_debugfs_init);
Francesco VIRLINZIa83c0b72009-03-11 10:39:02 +0000481
482#ifdef CONFIG_PM
483static int pmb_sysdev_suspend(struct sys_device *dev, pm_message_t state)
484{
485 static pm_message_t prev_state;
Matt Flemingedd7de82009-10-06 21:22:29 +0000486 int i;
Francesco VIRLINZIa83c0b72009-03-11 10:39:02 +0000487
488 /* Restore the PMB after a resume from hibernation */
489 if (state.event == PM_EVENT_ON &&
490 prev_state.event == PM_EVENT_FREEZE) {
491 struct pmb_entry *pmbe;
Matt Flemingedd7de82009-10-06 21:22:29 +0000492 for (i = 0; i < ARRAY_SIZE(pmb_entry_list); i++) {
493 if (test_bit(i, &pmb_map)) {
494 pmbe = &pmb_entry_list[i];
495 set_pmb_entry(pmbe);
496 }
497 }
Francesco VIRLINZIa83c0b72009-03-11 10:39:02 +0000498 }
499 prev_state = state;
500 return 0;
501}
502
503static int pmb_sysdev_resume(struct sys_device *dev)
504{
505 return pmb_sysdev_suspend(dev, PMSG_ON);
506}
507
508static struct sysdev_driver pmb_sysdev_driver = {
509 .suspend = pmb_sysdev_suspend,
510 .resume = pmb_sysdev_resume,
511};
512
513static int __init pmb_sysdev_init(void)
514{
515 return sysdev_driver_register(&cpu_sysdev_class, &pmb_sysdev_driver);
516}
Francesco VIRLINZIa83c0b72009-03-11 10:39:02 +0000517subsys_initcall(pmb_sysdev_init);
518#endif