memoryCall.c 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. /*
  2. * linux/arch/alpha/kernel/core_marvel.c
  3. *
  4. * Code common to all Marvel based systems.
  5. */
  6. #define __EXTERN_INLINE inline
  7. #include <asm/io.h>
  8. #include <asm/core_marvel.h>
  9. #undef __EXTERN_INLINE
  10. #include <linux/types.h>
  11. #include <linux/pci.h>
  12. #include <linux/sched.h>
  13. #include <linux/init.h>
  14. #include <linux/vmalloc.h>
  15. #include <linux/mc146818rtc.h>
  16. #include <linux/rtc.h>
  17. #include <linux/module.h>
  18. #include <linux/bootmem.h>
  19. #include <asm/ptrace.h>
  20. #include <asm/smp.h>
  21. #include <asm/gct.h>
  22. #include <asm/pgalloc.h>
  23. #include <asm/tlbflush.h>
  24. #include <asm/rtc.h>
  25. #include <asm/vga.h>
  26. #include "proto.h"
  27. #include "pci_impl.h"
  28. /*
  29. * Debug helpers
  30. */
  31. #define DEBUG_CONFIG 0
  32. #if DEBUG_CONFIG
  33. # define DBG_CFG(args) printk args
  34. #else
  35. # define DBG_CFG(args)
  36. #endif
  37. /*
  38. * Private data
  39. */
  40. static struct io7 *io7_head = NULL;
  41. /*
  42. * Helper functions
  43. */
  44. static unsigned long __attribute__ ((unused))
  45. read_ev7_csr(int pe, unsigned long offset)
  46. {
  47. ev7_csr *ev7csr = EV7_CSR_KERN(pe, offset);
  48. unsigned long q;
  49. mb();
  50. q = ev7csr->csr;
  51. mb();
  52. return q;
  53. }
  54. static void __attribute__ ((unused))
  55. write_ev7_csr(int pe, unsigned long offset, unsigned long q)
  56. {
  57. ev7_csr *ev7csr = EV7_CSR_KERN(pe, offset);
  58. mb();
  59. ev7csr->csr = q;
  60. mb();
  61. }
  62. static char * __init
  63. mk_resource_name(int pe, int port, char *str)
  64. {
  65. char tmp[80];
  66. char *name;
  67. sprintf(tmp, "PCI %s PE %d PORT %d", str, pe, port);
  68. name = alloc_bootmem(strlen(tmp) + 1);
  69. strcpy(name, tmp);
  70. return name;
  71. }
  72. inline struct io7 *
  73. marvel_next_io7(struct io7 *prev)
  74. {
  75. return (prev ? prev->next : io7_head);
  76. }
  77. struct io7 *
  78. marvel_find_io7(int pe)
  79. {
  80. struct io7 *io7;
  81. for (io7 = io7_head; io7 && io7->pe != pe; io7 = io7->next)
  82. continue;
  83. return io7;
  84. }
  85. static struct io7 * __init
  86. alloc_io7(unsigned int pe)
  87. {
  88. struct io7 *io7;
  89. struct io7 *insp;
  90. int h;
  91. if (marvel_find_io7(pe)) {
  92. printk(KERN_WARNING "IO7 at PE %d already allocated!\n", pe);
  93. return NULL;
  94. }