writeibm.S 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. /*------------------------------------------------------------------------------+ */
  2. /* */
  3. /* This source code has been made available to you by IBM on an AS-IS */
  4. /* basis. Anyone receiving this source is licensed under IBM */
  5. /* copyrights to use it in any way he or she deems fit, including */
  6. /* copying it, modifying it, compiling it, and redistributing it either */
  7. /* with or without modifications. No license under IBM patents or */
  8. /* patent applications is to be implied by the copyright license. */
  9. /* */
  10. /* Any user of this software should understand that IBM cannot provide */
  11. /* technical support for this software and will not be responsible for */
  12. /* any consequences resulting from the use of this software. */
  13. /* */
  14. /* Any person who transfers this source code or any derivative work */
  15. /* must include the IBM copyright notice, this paragraph, and the */
  16. /* preceding two paragraphs in the transferred software. */
  17. /* */
  18. /* COPYRIGHT I B M CORPORATION 1995 */
  19. /* LICENSED MATERIAL - PROGRAM PROPERTY OF I B M */
  20. /*------------------------------------------------------------------------------- */
  21. /*----------------------------------------------------------------------------- */
  22. /* Function: ext_bus_cntlr_init */
  23. /* Description: Initializes the External Bus Controller for the external */
  24. /* peripherals. IMPORTANT: For pass1 this code must run from */
  25. /* cache since you can not reliably change a peripheral banks */
  26. /* timing register (pbxap) while running code from that bank. */
  27. /* For ex., since we are running from ROM on bank 0, we can NOT */
  28. /* execute the code that modifies bank 0 timings from ROM, so */
  29. /* we run it from cache. */
  30. /* Bank 0 - Flash and SRAM */
  31. /* Bank 1 - NVRAM/RTC */
  32. /* Bank 2 - Keyboard/Mouse controller */
  33. /* Bank 3 - IR controller */
  34. /* Bank 4 - not used */
  35. /* Bank 5 - not used */
  36. /* Bank 6 - not used */
  37. /* Bank 7 - FPGA registers */
  38. /*----------------------------------------------------------------------------- */
  39. #include <ppc4xx.h>
  40. #include <ppc_asm.tmpl>
  41. #include <ppc_defs.h>
  42. #include <asm/cache.h>
  43. #include <asm/mmu.h>
  44. .globl write_without_sync
  45. write_without_sync:
  46. /*
  47. * Write one values to host via pci busmastering
  48. * ptr = 0xc0000000 -> 0x01000000 (PCI)
  49. * *ptr = 0x01234567;
  50. */
  51. addi r31,0,0
  52. lis r31,0xc000
  53. start1:
  54. lis r0,0x0123
  55. ori r0,r0,0x4567
  56. stw r0,0(r31)
  57. /*
  58. * Read one value back
  59. * ptr = (volatile unsigned long *)addr;
  60. * val = *ptr;
  61. */
  62. lwz r0,0(r31)
  63. /*
  64. * One pci config write
  65. * ibmPciConfigWrite(0x2e, 2, 0x1234);
  66. */
  67. /* subsystem id */
  68. li r4,0x002C
  69. oris r4,r4,0x8000
  70. lis r3,0xEEC0
  71. stwbrx r4,0,r3
  72. li r5,0x1234
  73. ori r3,r3,0x4
  74. stwbrx r5,0,r3
  75. b start1
  76. blr /* never reached !!!! */
  77. .globl write_with_sync
  78. write_with_sync:
  79. /*
  80. * Write one values to host via pci busmastering
  81. * ptr = 0xc0000000 -> 0x01000000 (PCI)
  82. * *ptr = 0x01234567;
  83. */
  84. addi r31,0,0
  85. lis r31,0xc000
  86. start2:
  87. lis r0,0x0123
  88. ori r0,r0,0x4567
  89. stw r0,0(r31)
  90. /*
  91. * Read one value back
  92. * ptr = (volatile unsigned long *)addr;
  93. * val = *ptr;
  94. */
  95. lwz r0,0(r31)
  96. /*
  97. * One pci config write
  98. * ibmPciConfigWrite(0x2e, 2, 0x1234);
  99. */
  100. /* subsystem id */
  101. li r4,0x002C
  102. oris r4,r4,0x8000
  103. lis r3,0xEEC0
  104. stwbrx r4,0,r3
  105. sync
  106. li r5,0x1234
  107. ori r3,r3,0x4
  108. stwbrx r5,0,r3
  109. sync
  110. b start2
  111. blr /* never reached !!!! */
  112. .globl write_with_less_sync
  113. write_with_less_sync:
  114. /*
  115. * Write one values to host via pci busmastering
  116. * ptr = 0xc0000000 -> 0x01000000 (PCI)
  117. * *ptr = 0x01234567;
  118. */
  119. addi r31,0,0
  120. lis r31,0xc000
  121. start2b:
  122. lis r0,0x0123
  123. ori r0,r0,0x4567
  124. stw r0,0(r31)
  125. /*
  126. * Read one value back
  127. * ptr = (volatile unsigned long *)addr;
  128. * val = *ptr;
  129. */
  130. lwz r0,0(r31)
  131. /*
  132. * One pci config write
  133. * ibmPciConfigWrite(0x2e, 2, 0x1234);
  134. */
  135. /* subsystem id */
  136. li r4,0x002C
  137. oris r4,r4,0x8000
  138. lis r3,0xEEC0
  139. stwbrx r4,0,r3
  140. sync
  141. li r5,0x1234
  142. ori r3,r3,0x4
  143. stwbrx r5,0,r3
  144. /* sync */
  145. b start2b
  146. blr /* never reached !!!! */
  147. .globl write_with_more_sync
  148. write_with_more_sync:
  149. /*
  150. * Write one values to host via pci busmastering
  151. * ptr = 0xc0000000 -> 0x01000000 (PCI)
  152. * *ptr = 0x01234567;
  153. */
  154. addi r31,0,0
  155. lis r31,0xc000
  156. start3:
  157. lis r0,0x0123
  158. ori r0,r0,0x4567
  159. stw r0,0(r31)
  160. sync
  161. /*
  162. * Read one value back
  163. * ptr = (volatile unsigned long *)addr;
  164. * val = *ptr;
  165. */
  166. lwz r0,0(r31)
  167. sync
  168. /*
  169. * One pci config write
  170. * ibmPciConfigWrite(0x2e, 2, 0x1234);
  171. */
  172. /* subsystem id (PCIC0_SBSYSVID)*/
  173. li r4,0x002C
  174. oris r4,r4,0x8000
  175. lis r3,0xEEC0
  176. stwbrx r4,0,r3
  177. sync
  178. li r5,0x1234
  179. ori r3,r3,0x4
  180. stwbrx r5,0,r3
  181. sync
  182. b start3
  183. blr /* never reached !!!! */