writeibm.S 5.2 KB

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