iplfba.S
上传用户:lgb322
上传日期:2013-02-24
资源大小:30529k
文件大小:5k
源码类别:

嵌入式Linux

开发平台:

Unix_Linux

  1. #
  2. #  Ipl block for fba devices
  3. #    Copyright (C) 1998 IBM Corporation
  4. #    Author(s): Martin Schwidefsky
  5. #
  6. #  startup for ipl at address 0
  7. #  start with restart
  8. # The first 24 byes are loaded by ipl to addresses 0-23 (a PSW and two CCWs).
  9. # The CCWs on 8-23 are used as a continuation of the implicit ipl channel
  10. # program. The fba ipl loader only uses the CCW on 8-15 to load the first 512
  11. # byte block to location 0-511 (the reading starts again at block 0, byte 0).
  12. # The second CCW is used to store the location of the load list.
  13.         .org   0
  14.         .long  0x00080000,0x80000000+_start    # The first 24 byte are loaded
  15.         .long  0x02000000,0x20000200           # by ipl to addresses 0-23.
  16.         .long  0x00000001,0x00000001           # (PSW, one CCW & loadlist info).
  17.         .globl _start
  18. _start:
  19. basr  %r13,0
  20. .LPG0:
  21. l     %r1,0xb8                         # load ipl subchannel number
  22.         lhi   %r2,0x200                        # location for the loadlist
  23.         lm    %r3,%r4,0x10                     # blocknr and length of loadlist
  24.         bras  %r14,.Lloader                    # load loadlist
  25.         lhi   %r11,0x400
  26.         lhi   %r12,0x200                       # load address of loadlist
  27.         l     %r3,0(%r12)                      # get first block number
  28.         l     %r4,4(%r12)                      # get first block count
  29.         la    %r12,8(%r12)
  30.         j     .Llistloop
  31.         .org  0x50
  32. .Llistloop:
  33.         lr    %r2,%r11                         # load address
  34.         lr    %r5,%r4                          # block count
  35.         mhi   %r5,512
  36.         la    %r11,0(%r5,%r11)                 # update load address
  37.         bras  %r14,.Lloader                    # load chunk of the image
  38.         l     %r3,0(%r12)                      # get next block number
  39.         icm   %r4,15,4(%r12)                   # get next block count
  40.         la    %r12,8(%r12)
  41.         jnz   .Llistloop
  42. #
  43. # everything loaded, go for it
  44. #
  45.         l     %r1,.Lstart-.LPG0(%r13)
  46. br    %r1
  47. #
  48. # subroutine for loading a sequence of block from fba
  49. # %r2: load address (24 bit address)
  50. # %r3: number of first block (unsigned long)
  51. # %r4: number of blocks to load (unsigned short)
  52. #
  53.         .org  0xC0
  54. .Lloader:
  55.         la    %r5,.Llo-.LPG0(%r13)
  56.         sth   %r4,2(%r5)                       # initialize block count
  57.         st    %r3,4(%r5)                       # initialize block number
  58.         la    %r5,.Lccws-.LPG0(%r13)
  59.         mhi   %r4,512
  60.         sth   %r4,22(%r5)                      # initialize byte count
  61. icm   %r2,8,16(%r5)
  62.         st    %r2,16(%r5)                      # initialize CCW data address
  63.         slr   %r2,%r2
  64.         la    %r3,.Lorb-.LPG0(%r13)            # r2 = address of orb into r2
  65.         la    %r4,.Ltinfo-.LPG0(%r13)          # r3 = address of tpi info block
  66.         la    %r5,.Lirb-.LPG0(%r13)            # r4 = address of irb
  67.         lctl  %c6,%c6,.Lc6-.LPG0(%r13)
  68. .Lldlp:
  69.         ssch  0(%r3)                           # read blocks
  70. .Ltpi:
  71.         tpi   0(%r4)                           # test pending interrupt
  72.         jz    .Ltpi
  73.         c     %r1,0(%r4)                       # compare subchannel number
  74.         jne   .Ltpi
  75.         tsch  0(%r5)
  76.         slr   %r0,%r0
  77.         tm    8(%r5),0x82                      # do we have a problem ?
  78.         jnz   .Ldwpsw
  79.         tm    8(%r5),0x04                      # got device end ?
  80.         jz    .Ltpi
  81. .Lexit:
  82.         br    %r14
  83.         .align 8
  84. .Ldwpsw:.long  0x000a0000,0x00000000
  85. .Lorb: .long  0x00000000,0x0000ff00,.Lccws
  86. .Ltinfo:.long  0
  87. .Lirb: .long  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  88. .Lc6:   .long  0xff000000
  89. .Lloadp:.long  0,0
  90. .Lparm: .long  0x10400
  91. .Lstart:.long  0x10000
  92.         .align 8
  93. .Lccws: .long  0x63000000+.Lde,0x60000010      # define extent
  94.         .long  0x43000000+.Llo,0x60000008      # locate
  95. # offset 1 in read CCW: data address (24 bit)
  96. # offset 6 in read CCW: number of bytes (16 bit)
  97.         .long  0x42000000,0x20000000           # read
  98. .Lde:   .long  0x40000200,0x00000000
  99.         .long  0x00000000,0x00001000
  100. # offset 2 in .Llo: block count (unsigned short)
  101. # offset 4 in .Llo: block number (unsigned long)
  102. .Llo:   .long  0x06000000,0x00000000
  103.         .org   0x200
  104.         .long  0x00000002,0x0000007f
  105.         .long  0x00000081,0x0000007f
  106.         .long  0x00000100,0x0000007f
  107.         .long  0x0000017f,0x0000007f
  108.         .long  0x000001fe,0x0000007f
  109.         .long  0x0000027d,0x0000007f
  110.         .long  0x000002fc,0x0000007f
  111.         .long  0x0000037b,0x0000007f
  112.         .long  0x000003fa,0x0000007f
  113.         .long  0x00000479,0x0000007f
  114.         .long  0x000004f8,0x0000007f
  115.         .long  0x00000577,0x0000007f
  116.         .long  0x000005f6,0x0000007f
  117.         .long  0x00000675,0x0000007f
  118.         .long  0x000006f4,0x0000007f
  119.         .long  0x00000773,0x0000003f
  120.         .long  0x00000000,0x00000000
  121.         .org   0x400