sgi support

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2011-05-13 16:36:05 +02:00
parent 11d86592b7
commit 8906c3dd40
31 changed files with 1453 additions and 120 deletions

244
include/grub/arc/arc.h Normal file
View file

@ -0,0 +1,244 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2011 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_ARC_HEADER
#define GRUB_ARC_HEADER 1
#include <grub/types.h>
#include <grub/symbol.h>
struct grub_arc_memory_descriptor
{
grub_uint32_t type;
grub_uint32_t start_page;
grub_uint32_t num_pages;
};
enum grub_arc_memory_type
{
GRUB_ARC_MEMORY_EXCEPTION_BLOCK,
GRUB_ARC_MEMORY_SYSTEM_PARAMETER_BLOCK,
#ifdef GRUB_CPU_WORDS_BIGENDIAN
GRUB_ARC_MEMORY_FREE_CONTIGUOUS,
#endif
GRUB_ARC_MEMORY_FREE,
GRUB_ARC_MEMORY_BADRAM,
GRUB_ARC_MEMORY_LOADED, GRUB_ARC_MEMORY_FW_TEMPORARY,
GRUB_ARC_MEMORY_FW_PERMANENT,
#ifndef GRUB_CPU_WORDS_BIGENDIAN
GRUB_ARC_MEMORY_FREE_CONTIGUOUS,
#endif
} grub_arc_memory_type_t;
struct grub_arc_timeinfo
{
grub_uint16_t y;
grub_uint16_t m;
grub_uint16_t d;
grub_uint16_t h;
grub_uint16_t min;
grub_uint16_t s;
grub_uint16_t ms;
};
struct grub_arc_display_status
{
grub_uint16_t x;
grub_uint16_t y;
grub_uint16_t w;
grub_uint16_t h;
grub_uint8_t fgcolor;
grub_uint8_t bgcolor;
grub_uint8_t high_intensity;
grub_uint8_t underscored;
grub_uint8_t reverse_video;
};
struct grub_arc_component
{
unsigned class;
unsigned type;
unsigned flags;
grub_uint16_t version;
grub_uint16_t rev;
grub_uint32_t key;
grub_uint32_t affinity;
grub_uint32_t configdatasize;
grub_uint32_t idlen;
const char *idstr;
};
enum
{
#ifdef GRUB_CPU_WORDS_BIGENDIAN
GRUB_ARC_COMPONENT_TYPE_ARC = 1,
#else
GRUB_ARC_COMPONENT_TYPE_ARC,
#endif
GRUB_ARC_COMPONENT_TYPE_CPU,
GRUB_ARC_COMPONENT_TYPE_FPU,
GRUB_ARC_COMPONENT_TYPE_PRI_I_CACHE,
GRUB_ARC_COMPONENT_TYPE_PRI_D_CACHE,
GRUB_ARC_COMPONENT_TYPE_SEC_I_CACHE,
GRUB_ARC_COMPONENT_TYPE_SEC_D_CACHE,
GRUB_ARC_COMPONENT_TYPE_SEC_CACHE,
GRUB_ARC_COMPONENT_TYPE_EISA,
GRUB_ARC_COMPONENT_TYPE_TCA,
GRUB_ARC_COMPONENT_TYPE_SCSI,
GRUB_ARC_COMPONENT_TYPE_DTIA,
GRUB_ARC_COMPONENT_TYPE_MULTIFUNC,
GRUB_ARC_COMPONENT_TYPE_DISK_CONTROLLER,
GRUB_ARC_COMPONENT_TYPE_TAPE_CONTROLLER,
GRUB_ARC_COMPONENT_TYPE_CDROM_CONTROLLER,
GRUB_ARC_COMPONENT_TYPE_WORM_CONTROLLER,
GRUB_ARC_COMPONENT_TYPE_SERIAL_CONTROLLER,
GRUB_ARC_COMPONENT_TYPE_NET_CONTROLLER,
GRUB_ARC_COMPONENT_TYPE_DISPLAY_CONTROLLER,
GRUB_ARC_COMPONENT_TYPE_PARALLEL_CONTROLLER,
GRUB_ARC_COMPONENT_TYPE_POINTER_CONTROLLER,
GRUB_ARC_COMPONENT_TYPE_KBD_CONTROLLER,
GRUB_ARC_COMPONENT_TYPE_AUDIO_CONTROLLER,
GRUB_ARC_COMPONENT_TYPE_OTHER_CONTROLLER,
GRUB_ARC_COMPONENT_TYPE_DISK,
GRUB_ARC_COMPONENT_TYPE_FLOPPY,
GRUB_ARC_COMPONENT_TYPE_TAPE,
GRUB_ARC_COMPONENT_TYPE_MODEM,
GRUB_ARC_COMPONENT_TYPE_MONITOR,
GRUB_ARC_COMPONENT_TYPE_PRINTER,
GRUB_ARC_COMPONENT_TYPE_POINTER,
GRUB_ARC_COMPONENT_TYPE_KBD,
GRUB_ARC_COMPONENT_TYPE_TERMINAL,
GRUB_ARC_COMPONENT_TYPE_OTHER_PERIPHERAL,
GRUB_ARC_COMPONENT_TYPE_LINE,
GRUB_ARC_COMPONENT_TYPE_NET,
GRUB_ARC_COMPONENT_TYPE_MEMORY_UNIT,
};
struct grub_arc_fileinfo
{
grub_uint64_t start;
grub_uint64_t end;
grub_uint64_t current;
grub_uint32_t type;
grub_uint32_t fnamelength;
grub_uint8_t attr;
char filename[32];
};
struct grub_arc_firmware_vector
{
/* 0x00. */
void *load;
void *invoke;
void *execute;
void *halt;
/* 0x10. */
void (*powerdown) (void);
void (*restart) (void);
void (*reboot) (void);
void (*exit) (void);
/* 0x20. */
void *reserved1;
const struct grub_arc_component * (*getpeer) (const struct grub_arc_component *comp);
const struct grub_arc_component * (*getchild) (const struct grub_arc_component *comp);
void *getparent;
/* 0x30. */
void *getconfigurationdata;
void *addchild;
void *deletecomponent;
void *getcomponent;
/* 0x40. */
void *saveconfiguration;
void *getsystemid;
struct grub_arc_memory_descriptor *(*getmemorydescriptor) (struct grub_arc_memory_descriptor *current);
void *reserved2;
/* 0x50. */
struct grub_arc_timeinfo *(*gettime) (void);
void *getrelativetime;
void *getdirectoryentry;
int (*open) (const char *path, int mode, unsigned *fileno);
/* 0x60. */
int (*close) (unsigned fileno);
int (*read) (unsigned fileno, void *buf, unsigned long n,
unsigned long *count);
int (*get_read_status) (unsigned fileno);
int (*write) (unsigned fileno, void *buf, unsigned long n,
unsigned long *count);
/* 0x70. */
int (*seek) (unsigned fileno, grub_uint64_t *pos, int mode);
void *mount;
void *getenvironmentvariable;
void *setenvironmentvariable;
/* 0x80. */
int (*getfileinformation) (unsigned fileno, struct grub_arc_fileinfo *info);
void *setfileinformation;
void *flushallcaches;
void *testunicodecharacter;
/* 0x90. */
struct grub_arc_display_status * (*getdisplaystatus) (unsigned fileno);
};
struct grub_arc_adapter
{
grub_uint32_t adapter_type;
grub_uint32_t adapter_vector_length;
void *adapter_vector;
};
struct grub_arc_system_parameter_block
{
grub_uint32_t signature;
grub_uint32_t length;
grub_uint16_t version;
grub_uint16_t revision;
void *restartblock;
void *debugblock;
void *gevector;
void *utlbmissvector;
grub_uint32_t firmware_vector_length;
struct grub_arc_firmware_vector *firmwarevector;
grub_uint32_t private_vector_length;
void *private_vector;
grub_uint32_t adapter_count;
struct grub_arc_adapter adapters[0];
};
#define GRUB_ARC_SYSTEM_PARAMETER_BLOCK ((struct grub_arc_system_parameter_block *) 0xa0001000)
#define GRUB_ARC_FIRMWARE_VECTOR (GRUB_ARC_SYSTEM_PARAMETER_BLOCK->firmwarevector)
#define GRUB_ARC_STDIN 0
#define GRUB_ARC_STDOUT 1
int EXPORT_FUNC (grub_arc_iterate_devs) (int (*hook) (const char *name, const struct grub_arc_component *comp), int alt_names);
#define FOR_ARC_CHILDREN(comp, parent) for (comp = GRUB_ARC_FIRMWARE_VECTOR->getchild (parent); comp; comp = GRUB_ARC_FIRMWARE_VECTOR->getpeer (comp))
extern void grub_arcdisk_init (void);
extern void grub_arcdisk_fini (void);
#endif

View file

@ -0,0 +1,31 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2008 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_CONSOLE_MACHINE_HEADER
#define GRUB_CONSOLE_MACHINE_HEADER 1
#include <grub/symbol.h>
/* Initialize the console system. */
void grub_console_init_early (void);
void grub_console_init_lately (void);
/* Finish the console system. */
void grub_console_fini (void);
#endif /* ! GRUB_CONSOLE_MACHINE_HEADER */

View file

@ -42,7 +42,8 @@ enum grub_disk_dev_id
GRUB_DISK_DEVICE_PXE_ID,
GRUB_DISK_DEVICE_SCSI_ID,
GRUB_DISK_DEVICE_FILE_ID,
GRUB_DISK_DEVICE_LUKS_ID
GRUB_DISK_DEVICE_LUKS_ID,
GRUB_DISK_DEVICE_ARCDISK_ID,
};
struct grub_disk;

View file

@ -0,0 +1,2 @@
#include <grub/cpu/kernel.h>

View file

@ -0,0 +1,42 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_MEMORY_MACHINE_HEADER
#define GRUB_MEMORY_MACHINE_HEADER 1
#define GRUB_MACHINE_MEMORY_STACK_HIGH 0x8bfffff0
#ifndef ASM_FILE
static inline grub_err_t
grub_machine_mmap_register (grub_uint64_t start __attribute__ ((unused)),
grub_uint64_t size __attribute__ ((unused)),
int type __attribute__ ((unused)),
int handle __attribute__ ((unused)))
{
return GRUB_ERR_NONE;
}
static inline grub_err_t
grub_machine_mmap_unregister (int handle __attribute__ ((unused)))
{
return GRUB_ERR_NONE;
}
#endif
#endif

View file

View file

@ -0,0 +1,30 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2005,2006,2007,2008,2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_KERNEL_MACHINE_HEADER
#define GRUB_KERNEL_MACHINE_HEADER 1
#include <grub/symbol.h>
#ifndef ASM_FILE
void EXPORT_FUNC (grub_halt) (void) __attribute__ ((noreturn));
#endif
#endif /* ! GRUB_KERNEL_MACHINE_HEADER */

View file

@ -19,11 +19,7 @@
#ifndef GRUB_LOONGSON_CPU_HEADER
#define GRUB_LOONGSON_CPU_HEADER 1
#ifdef ASM_FILE
#define GRUB_CPU_REGISTER_WRAP(x) x
#else
#define GRUB_CPU_REGISTER_WRAP(x) #x
#endif
#include <grub/cpu/mips.h>
#define GRUB_CPU_LOONGSON_FLASH_START 0xbfc00000
#define GRUB_CPU_LOONGSON_FLASH_TLB_REFILL 0xbfc00200
@ -68,7 +64,6 @@
#define GRUB_CPU_LOONGSON_SECONDARY_CACHE_LOG_SIZE 19
#define GRUB_CPU_LOONGSON_COP0_BADVADDR GRUB_CPU_REGISTER_WRAP($8)
#define GRUB_CPU_LOONGSON_COP0_TIMER_COUNT GRUB_CPU_REGISTER_WRAP($9)
#define GRUB_CPU_LOONGSON_COP0_CAUSE GRUB_CPU_REGISTER_WRAP($13)
#define GRUB_CPU_LOONGSON_COP0_EPC GRUB_CPU_REGISTER_WRAP($14)
#define GRUB_CPU_LOONGSON_COP0_CACHE_TAGLO GRUB_CPU_REGISTER_WRAP($28)

View file

@ -1 +1,60 @@
#include <grub/machine/memory.h>
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_MEMORY_MACHINE_HEADER
#define GRUB_MEMORY_MACHINE_HEADER 1
#ifndef ASM_FILE
#include <grub/symbol.h>
#include <grub/err.h>
#include <grub/types.h>
#endif
#define GRUB_ARCH_LOWMEMVSTART 0x80000000
#define GRUB_ARCH_LOWMEMPSTART 0x00000000
#define GRUB_ARCH_LOWMEMMAXSIZE 0x10000000
#define GRUB_ARCH_HIGHMEMPSTART 0x10000000
#ifndef ASM_FILE
typedef grub_addr_t grub_phys_addr_t;
static inline grub_phys_addr_t
grub_vtop (void *a)
{
return ((grub_phys_addr_t) a) & 0x1fffffff;
}
static inline void *
grub_map_memory (grub_phys_addr_t a, grub_size_t size __attribute__ ((unused)))
{
return (void *) (a | 0x80000000);
}
static inline void
grub_unmap_memory (void *a __attribute__ ((unused)),
grub_size_t size __attribute__ ((unused)))
{
}
grub_uint64_t grub_mmap_get_lower (void);
grub_uint64_t grub_mmap_get_upper (void);
#endif
#endif

30
include/grub/mips/mips.h Normal file
View file

@ -0,0 +1,30 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2010 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_REGISTORS_CPU_HEADER
#define GRUB_REGISTORS_CPU_HEADER 1
#ifdef ASM_FILE
#define GRUB_CPU_REGISTER_WRAP(x) x
#else
#define GRUB_CPU_REGISTER_WRAP(x) #x
#endif
#define GRUB_CPU_MIPS_COP0_TIMER_COUNT GRUB_CPU_REGISTER_WRAP($9)
#endif

View file

@ -1,6 +1,37 @@
#ifdef GRUB_MACHINE_EMU
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2003,2004,2005,2007 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef KERNEL_CPU_TIME_HEADER
#define KERNEL_CPU_TIME_HEADER 1
#ifndef GRUB_UTIL
#define GRUB_TICKS_PER_SECOND (grub_arch_cpuclock / 2)
/* Return the real time in ticks. */
grub_uint64_t EXPORT_FUNC (grub_get_rtc) (void);
extern grub_uint32_t EXPORT_VAR (grub_arch_cpuclock);
#endif
static inline void
grub_cpu_idle(void)
{
}
#endif

View file

@ -1,31 +1 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2005,2006,2007,2008,2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_KERNEL_MACHINE_HEADER
#define GRUB_KERNEL_MACHINE_HEADER 1
#include <grub/symbol.h>
#ifndef ASM_FILE
void EXPORT_FUNC (grub_reboot) (void) __attribute__ ((noreturn));
void EXPORT_FUNC (grub_halt) (void) __attribute__ ((noreturn));
#endif
#endif /* ! GRUB_KERNEL_MACHINE_HEADER */
#include <grub/cpu/kernel.h>

View file

@ -19,43 +19,16 @@
#ifndef GRUB_MEMORY_MACHINE_HEADER
#define GRUB_MEMORY_MACHINE_HEADER 1
#define GRUB_MACHINE_MEMORY_STACK_HIGH 0x801ffff0
#ifndef ASM_FILE
#include <grub/symbol.h>
#include <grub/err.h>
#include <grub/types.h>
#endif
#define GRUB_MACHINE_MEMORY_STACK_HIGH 0x801ffff0
#define GRUB_ARCH_LOWMEMVSTART 0x80000000
#define GRUB_ARCH_LOWMEMPSTART 0x00000000
#define GRUB_ARCH_LOWMEMMAXSIZE 0x10000000
#define GRUB_ARCH_HIGHMEMPSTART 0x10000000
#ifndef ASM_FILE
typedef grub_addr_t grub_phys_addr_t;
static inline grub_phys_addr_t
grub_vtop (void *a)
{
return ((grub_phys_addr_t) a) & 0x1fffffff;
}
static inline void *
grub_map_memory (grub_phys_addr_t a, grub_size_t size __attribute__ ((unused)))
{
return (void *) (a | 0x80000000);
}
static inline void
grub_unmap_memory (void *a __attribute__ ((unused)),
grub_size_t size __attribute__ ((unused)))
{
}
grub_err_t EXPORT_FUNC (grub_machine_mmap_iterate)
(int NESTED_FUNC_ATTR (*hook) (grub_uint64_t, grub_uint64_t, grub_uint32_t));
static inline grub_err_t
grub_machine_mmap_register (grub_uint64_t start __attribute__ ((unused)),
grub_uint64_t size __attribute__ ((unused)),
@ -70,9 +43,6 @@ grub_machine_mmap_unregister (int handle __attribute__ ((unused)))
return GRUB_ERR_NONE;
}
grub_uint64_t grub_mmap_get_lower (void);
grub_uint64_t grub_mmap_get_upper (void);
extern grub_uint32_t EXPORT_VAR (grub_arch_memsize);
extern grub_uint32_t EXPORT_VAR (grub_arch_highmemsize);

View file

@ -20,18 +20,8 @@
#define KERNEL_MACHINE_TIME_HEADER 1
#include <grub/symbol.h>
#define GRUB_TICKS_PER_SECOND (grub_arch_cpuclock / 2)
/* Return the real time in ticks. */
grub_uint64_t EXPORT_FUNC (grub_get_rtc) (void);
#include <grub/cpu/time.h>
extern grub_uint32_t EXPORT_VAR (grub_arch_busclock);
extern grub_uint32_t EXPORT_VAR (grub_arch_cpuclock);
static inline void
grub_cpu_idle(void)
{
}
#endif /* ! KERNEL_MACHINE_TIME_HEADER */

View file

@ -111,6 +111,17 @@
#define GRUB_KERNEL_MIPS_YEELOONG_PREFIX 0x0c
#define GRUB_KERNEL_MIPS_YEELOONG_PREFIX_END 0x54
#define GRUB_KERNEL_MIPS_ARC_LINK_ADDR 0x8a000000
#define GRUB_KERNEL_MIPS_ARC_LINK_ALIGN 32
#define GRUB_KERNEL_MIPS_ARC_COMPRESSED_SIZE 0x8
#define GRUB_KERNEL_MIPS_ARC_UNCOMPRESSED_SIZE 0xc
#define GRUB_KERNEL_MIPS_ARC_TOTAL_MODULE_SIZE 0x08
#define GRUB_KERNEL_MIPS_ARC_PREFIX 0x0c
#define GRUB_KERNEL_MIPS_ARC_PREFIX_END 0x54
/* The offset of GRUB_PREFIX. */
#define GRUB_KERNEL_I386_EFI_PREFIX 0x8
@ -145,6 +156,7 @@
#define GRUB_KERNEL_POWERPC_IEEE1275_MOD_ALIGN 0x1000
#define GRUB_KERNEL_MIPS_YEELOONG_MOD_ALIGN 0x1
#define GRUB_KERNEL_MIPS_ARC_MOD_ALIGN 0x1
/* Minimal gap between _end and the start of the modules. It's a hack
for PowerMac to prevent "CLAIM failed" error. The real fix is to