~ubuntu-branches/ubuntu/trusty/grub2/trusty-updates

« back to all changes in this revision

Viewing changes to grub-core/boot/sparc64/ieee1275/diskboot.S

  • Committer: Bazaar Package Importer
  • Author(s): Colin Watson
  • Date: 2011-02-08 11:39:26 UTC
  • mfrom: (17.6.26 experimental)
  • mto: (17.6.27 experimental)
  • mto: This revision was merged to the branch mainline in revision 104.
  • Revision ID: james.westby@ubuntu.com-20110208113926-clfs90haboyk9zip
Tags: 1.99~rc1-2
* Merge 1.98+20100804-13 and 1.98+20100804-14, updating translations:
  - Kazakh (Baurzhan Muftakhidinov / Timur Birsh).
* mkconfig_skip_dmcrypt.patch: Refer to GRUB_PRELOAD_MODULES rather than
  suggesting people write a /etc/grub.d/01_modules script (thanks, Jordan
  Uggla).
* Handle empty dir passed to grub_find_root_device_from_mountinfo; fixes
  grub-mkrelpath on btrfs subvolumes (LP: #712029).
* Add rootflags=subvol=<name> if / is on a btrfs subvolume (LP: #712029).
* Upload to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*-Asm-*- */
 
2
/*
 
3
 *  GRUB  --  GRand Unified Bootloader
 
4
 *  Copyright (C) 2009  Free Software Foundation, Inc.
 
5
 *
 
6
 *  GRUB is free software: you can redistribute it and/or modify
 
7
 *  it under the terms of the GNU General Public License as published by
 
8
 *  the Free Software Foundation, either version 3 of the License, or
 
9
 *  (at your option) any later version.
 
10
 *
 
11
 *  GRUB is distributed in the hope that it will be useful,
 
12
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
 *  GNU General Public License for more details.
 
15
 *
 
16
 *  You should have received a copy of the GNU General Public License
 
17
 *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
 
18
 */
 
19
 
 
20
#include <grub/boot.h>
 
21
#include <grub/machine/boot.h>
 
22
#include <grub/offsets.h>
 
23
 
 
24
        .text
 
25
        .align  4
 
26
        .globl  _start
 
27
_start:
 
28
        /* First stage boot block jumps to us here.  */
 
29
pic_base:
 
30
        call    after_info_block
 
31
         mov    %o7, PIC_REG
 
32
 
 
33
prom_write_name:                .asciz "write"
 
34
prom_seek_name:                 .asciz "seek"
 
35
prom_read_name:                 .asciz "read"
 
36
prom_close_name:                .asciz "close"
 
37
 
 
38
notification_string:            .asciz "Loading kernel"
 
39
#define NOTIFICATION_STRING_LEN 14
 
40
 
 
41
notification_step:              .asciz "."
 
42
#define NOTIFICATION_STEP_LEN   1
 
43
 
 
44
notification_done:              .asciz "\r\n"
 
45
#define NOTIFICATION_DONE_LEN   2
 
46
 
 
47
        .align  4
 
48
 
 
49
        /* %o2: message string
 
50
         * %o3: message length
 
51
         */
 
52
console_write:
 
53
        GET_ABS(prom_write_name, %o0)
 
54
        mov     STDOUT_NODE_REG, %o1
 
55
        /* fallthru */
 
56
 
 
57
        /* %o0: OF call name
 
58
         * %o1: input arg 1
 
59
         * %o2: input arg 2
 
60
         * %o3: input arg 3
 
61
         */
 
62
prom_call_3_1:
 
63
        mov     3, %g1
 
64
        mov     1, %o5
 
65
        /* fallthru */
 
66
 
 
67
        /* %o0: OF call name
 
68
         * %g1: num inputs
 
69
         * %o5: num outputs
 
70
         * %o1-%o4: inputs
 
71
         */
 
72
prom_call:
 
73
        stx     %o0, [%l1 + 0x00]
 
74
        stx     %g1, [%l1 + 0x08]
 
75
        stx     %o5, [%l1 + 0x10]
 
76
        stx     %o1, [%l1 + 0x18]
 
77
        stx     %o2, [%l1 + 0x20]
 
78
        stx     %o3, [%l1 + 0x28]
 
79
        stx     %o4, [%l1 + 0x30]
 
80
        jmpl    CIF_REG, %g0
 
81
         mov    %l1, %o0
 
82
 
 
83
 
 
84
after_info_block:
 
85
        sethi   %hi(SCRATCH_PAD_DISKBOOT), %l1  /* OF argument slots */
 
86
 
 
87
        GET_ABS(notification_string, %o2)
 
88
        call    console_write
 
89
         mov    NOTIFICATION_STRING_LEN, %o3
 
90
 
 
91
        GET_ABS(firstlist - GRUB_BOOT_SPARC64_IEEE1275_LIST_SIZE, %l2)
 
92
        set     GRUB_BOOT_SPARC64_IEEE1275_IMAGE_ADDRESS, %l3
 
93
bootloop:
 
94
        lduw    [%l2 + 0x08], %o0
 
95
        brz     %o0, bootit
 
96
         lduw   [%l2 + 0x00], %o3
 
97
        sllx    %o3, 32, %o3
 
98
        lduw    [%l2 + 0x04], %o4
 
99
        or      %o3, %o4, %o3
 
100
        GET_ABS(prom_seek_name, %o0)
 
101
        mov     BOOTDEV_REG, %o1
 
102
        clr     %o2
 
103
        call    prom_call_3_1
 
104
         sllx   %o3, 9, %o3
 
105
 
 
106
        GET_ABS(prom_read_name, %o0)
 
107
        mov     BOOTDEV_REG, %o1
 
108
        lduw    [%l2 + 0x08], %o3
 
109
        sllx    %o3, 9, %o3
 
110
        mov     %l3, %o2
 
111
        call    prom_call_3_1
 
112
         add    %l3, %o3, %l3
 
113
 
 
114
        GET_ABS(notification_step, %o2)
 
115
        call    console_write
 
116
         mov    NOTIFICATION_STEP_LEN, %o3
 
117
 
 
118
        ba      bootloop
 
119
         sub    %l2, GRUB_BOOT_SPARC64_IEEE1275_LIST_SIZE, %l2
 
120
 
 
121
bootit:
 
122
        GET_ABS(prom_close_name, %o0)
 
123
        mov     1, %g1
 
124
        mov     0, %o5
 
125
        call    prom_call
 
126
         mov    BOOTDEV_REG, %o1
 
127
 
 
128
        GET_ABS(notification_done, %o2)
 
129
        call    console_write
 
130
         mov    NOTIFICATION_DONE_LEN, %o3
 
131
        sethi   %hi(GRUB_BOOT_SPARC64_IEEE1275_IMAGE_ADDRESS), %o2
 
132
        jmpl    %o2 + %lo(GRUB_BOOT_SPARC64_IEEE1275_IMAGE_ADDRESS), %o7
 
133
         mov    CIF_REG, %o4
 
134
1:      ba,a    1b
 
135
 
 
136
lastlist:
 
137
        .word   0
 
138
        .word   0
 
139
 
 
140
        . = _start + (0x200 - GRUB_BOOT_SPARC64_IEEE1275_LIST_SIZE)
 
141
blocklist_default_start:
 
142
        .word   0
 
143
        .word   2
 
144
blocklist_default_len:
 
145
        .word   0
 
146
firstlist: