2N/A/* -*-Asm-*- */
2N/A/*
2N/A * GRUB -- GRand Unified Bootloader
2N/A * Copyright (C) 2009 Free Software Foundation, Inc.
2N/A *
2N/A * GRUB is free software: you can redistribute it and/or modify
2N/A * it under the terms of the GNU General Public License as published by
2N/A * the Free Software Foundation, either version 3 of the License, or
2N/A * (at your option) any later version.
2N/A *
2N/A * GRUB is distributed in the hope that it will be useful,
2N/A * but WITHOUT ANY WARRANTY; without even the implied warranty of
2N/A * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2N/A * GNU General Public License for more details.
2N/A *
2N/A * You should have received a copy of the GNU General Public License
2N/A * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
2N/A */
2N/A
2N/A#include <grub/machine/boot.h>
2N/A#include <grub/offsets.h>
2N/A
2N/A .text
2N/A .align 4
2N/A .globl _start
2N/A_start:
2N/A /* First stage boot block jumps to us here. */
2N/Apic_base:
2N/A call after_info_block
2N/A mov %o7, PIC_REG
2N/A
2N/Aprom_write_name: .asciz "write"
2N/Aprom_seek_name: .asciz "seek"
2N/Aprom_read_name: .asciz "read"
2N/Aprom_close_name: .asciz "close"
2N/A
2N/Anotification_string: .asciz "Loading kernel"
2N/A#define NOTIFICATION_STRING_LEN 14
2N/A
2N/Anotification_step: .asciz "."
2N/A#define NOTIFICATION_STEP_LEN 1
2N/A
2N/Anotification_done: .asciz "\r\n"
2N/A#define NOTIFICATION_DONE_LEN 2
2N/A
2N/A .align 4
2N/A
2N/A /* %o2: message string
2N/A * %o3: message length
2N/A */
2N/Aconsole_write:
2N/A GET_ABS(prom_write_name, %o0)
2N/A mov STDOUT_NODE_REG, %o1
2N/A /* fallthru */
2N/A
2N/A /* %o0: OF call name
2N/A * %o1: input arg 1
2N/A * %o2: input arg 2
2N/A * %o3: input arg 3
2N/A */
2N/Aprom_call_3_1:
2N/A mov 3, %g1
2N/A mov 1, %o5
2N/A /* fallthru */
2N/A
2N/A /* %o0: OF call name
2N/A * %g1: num inputs
2N/A * %o5: num outputs
2N/A * %o1-%o4: inputs
2N/A */
2N/Aprom_call:
2N/A stx %o0, [%l1 + 0x00]
2N/A stx %g1, [%l1 + 0x08]
2N/A stx %o5, [%l1 + 0x10]
2N/A stx %o1, [%l1 + 0x18]
2N/A stx %o2, [%l1 + 0x20]
2N/A stx %o3, [%l1 + 0x28]
2N/A stx %o4, [%l1 + 0x30]
2N/A jmpl CIF_REG, %g0
2N/A mov %l1, %o0
2N/A
2N/A
2N/Aafter_info_block:
2N/A sethi %hi(SCRATCH_PAD_DISKBOOT), %l1 /* OF argument slots */
2N/A
2N/A GET_ABS(notification_string, %o2)
2N/A call console_write
2N/A mov NOTIFICATION_STRING_LEN, %o3
2N/A
2N/A GET_ABS(firstlist - GRUB_BOOT_SPARC64_IEEE1275_LIST_SIZE, %l2)
2N/A set GRUB_BOOT_SPARC64_IEEE1275_IMAGE_ADDRESS, %l3
2N/Abootloop:
2N/A lduw [%l2 + 0x08], %o0
2N/A brz %o0, bootit
2N/A lduw [%l2 + 0x00], %o3
2N/A sllx %o3, 32, %o3
2N/A lduw [%l2 + 0x04], %o4
2N/A or %o3, %o4, %o3
2N/A GET_ABS(prom_seek_name, %o0)
2N/A mov BOOTDEV_REG, %o1
2N/A clr %o2
2N/A call prom_call_3_1
2N/A sllx %o3, 9, %o3
2N/A
2N/A GET_ABS(prom_read_name, %o0)
2N/A mov BOOTDEV_REG, %o1
2N/A lduw [%l2 + 0x08], %o3
2N/A sllx %o3, 9, %o3
2N/A mov %l3, %o2
2N/A call prom_call_3_1
2N/A add %l3, %o3, %l3
2N/A
2N/A GET_ABS(notification_step, %o2)
2N/A call console_write
2N/A mov NOTIFICATION_STEP_LEN, %o3
2N/A
2N/A ba bootloop
2N/A sub %l2, GRUB_BOOT_SPARC64_IEEE1275_LIST_SIZE, %l2
2N/A
2N/Abootit:
2N/A GET_ABS(prom_close_name, %o0)
2N/A mov 1, %g1
2N/A mov 0, %o5
2N/A call prom_call
2N/A mov BOOTDEV_REG, %o1
2N/A
2N/A GET_ABS(notification_done, %o2)
2N/A call console_write
2N/A mov NOTIFICATION_DONE_LEN, %o3
2N/A sethi %hi(GRUB_BOOT_SPARC64_IEEE1275_IMAGE_ADDRESS), %o2
2N/A jmpl %o2 + %lo(GRUB_BOOT_SPARC64_IEEE1275_IMAGE_ADDRESS), %o7
2N/A mov CIF_REG, %o4
2N/A1: ba,a 1b
2N/A
2N/Alastlist:
2N/A .word 0
2N/A .word 0
2N/A
2N/A . = _start + (0x200 - GRUB_BOOT_SPARC64_IEEE1275_LIST_SIZE)
2N/Ablocklist_default_start:
2N/A .word 0
2N/A .word 2
2N/Ablocklist_default_len:
2N/A .word 0
2N/Afirstlist: