various fixes. MIPSsim support

This commit is contained in:
phcoder 2009-10-11 18:18:18 +02:00
parent 50739170db
commit 1540a08402
15 changed files with 385 additions and 15 deletions

View file

@ -98,8 +98,8 @@ struct grub_ata_device
/* IO addresses on which the registers for this device can be
found. */
int ioaddress;
int ioaddress2;
grub_port_t ioaddress;
grub_port_t ioaddress2;
/* Two devices can be connected to a single cable. Use this field
to select device 0 (commonly known as "master") or device 1

View file

@ -16,11 +16,10 @@
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
void *EXPORT_FUNC (memset) (void *s, int c, int n) __attribute__ ((weak));
void EXPORT_FUNC (__ashldi3) (void) __attribute__ ((weak));
void EXPORT_FUNC (__ashrdi3) (void) __attribute__ ((weak));
void EXPORT_FUNC (__lshrdi3) (void) __attribute__ ((weak));
void EXPORT_FUNC (__trampoline_setup) (void) __attribute__ ((weak));
void EXPORT_FUNC (__ucmpdi2) (void) __attribute__ ((weak));
void EXPORT_FUNC (__bswapsi2) (void) __attribute__ ((weak));
void EXPORT_FUNC (__bswapdi2) (void) __attribute__ ((weak));
void *EXPORT_FUNC (memset) (void *s, int c, int n);
void EXPORT_FUNC (__ashldi3) (void);
void EXPORT_FUNC (__ashrdi3) (void);
void EXPORT_FUNC (__lshrdi3) (void);
void EXPORT_FUNC (__ucmpdi2) (void);
void EXPORT_FUNC (__bswapsi2) (void);
void EXPORT_FUNC (__bswapdi2) (void);

70
include/grub/mips/pci.h Normal file
View file

@ -0,0 +1,70 @@
/*
* 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_CPU_PCI_H
#define GRUB_CPU_PCI_H 1
#include <grub/types.h>
#include <grub/cpu/io.h>
#define GRUB_PCI_ADDR_REG 0x14000cf8
#define GRUB_PCI_DATA_REG 0x14000cfc
static inline grub_uint32_t
grub_pci_read (grub_pci_address_t addr)
{
grub_outl (addr, GRUB_PCI_ADDR_REG);
return grub_inl (GRUB_PCI_DATA_REG);
}
static inline grub_uint16_t
grub_pci_read_word (grub_pci_address_t addr)
{
grub_outl (addr & ~3, GRUB_PCI_ADDR_REG);
return grub_inw (GRUB_PCI_DATA_REG + (addr & 3));
}
static inline grub_uint8_t
grub_pci_read_byte (grub_pci_address_t addr)
{
grub_outl (addr & ~3, GRUB_PCI_ADDR_REG);
return grub_inb (GRUB_PCI_DATA_REG + (addr & 3));
}
static inline void
grub_pci_write (grub_pci_address_t addr, grub_uint32_t data)
{
grub_outl (addr, GRUB_PCI_ADDR_REG);
grub_outl (data, GRUB_PCI_DATA_REG);
}
static inline void
grub_pci_write_word (grub_pci_address_t addr, grub_uint16_t data)
{
grub_outl (addr & ~3, GRUB_PCI_ADDR_REG);
grub_outw (data, GRUB_PCI_DATA_REG + (addr & 3));
}
static inline void
grub_pci_write_byte (grub_pci_address_t addr, grub_uint8_t data)
{
grub_outl (addr & ~3, GRUB_PCI_ADDR_REG);
grub_outb (data, GRUB_PCI_DATA_REG + (addr & 3));
}
#endif /* GRUB_CPU_PCI_H */

View file

@ -0,0 +1,35 @@
/*
* 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);
void EXPORT_FUNC (grub_halt) (void);
/* The prefix which points to the directory where GRUB modules and its
configuration file are located. */
extern char grub_prefix[];
#endif
#endif /* ! GRUB_KERNEL_MACHINE_HEADER */

View file

@ -0,0 +1,24 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 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 GRUB_MACHINE_MACHINE_HEADER
#define GRUB_MACHINE_MACHINE_HEADER 1
#define GRUB_MACHINE_MIPS_QEMU_MIPSSIM 1
#endif /* ! GRUB_MACHINE_MACHINE_HEADER */

View file

@ -0,0 +1,54 @@
/*
* 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_MACHINE_MEMORY_STACK_HIGH 0x80f00000
#define GRUB_MACHINE_MEMORY_USABLE 0x81000000
#define GRUB_MACHINE_MEMORY_AVAILABLE 1
#ifndef ASM_FILE
grub_err_t EXPORT_FUNC (grub_machine_mmap_iterate)
(int NESTED_FUNC_ATTR (*hook) (grub_uint64_t, grub_uint64_t, grub_uint32_t));
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)),
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

@ -0,0 +1,35 @@
/*
* 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_MACHINE_TIME_HEADER
#define KERNEL_MACHINE_TIME_HEADER 1
#include <grub/symbol.h>
#define GRUB_TICKS_PER_SECOND 1000
/* Return the real time in ticks. */
grub_uint32_t EXPORT_FUNC (grub_get_rtc) (void);
static inline void
grub_cpu_idle(void)
{
/* asm volatile ("wait");*/
}
#endif /* ! KERNEL_MACHINE_TIME_HEADER */

View file

@ -19,6 +19,6 @@
#ifndef GRUB_MACHINE_MACHINE_HEADER
#define GRUB_MACHINE_MACHINE_HEADER 1
#define GRUB_MACHINE_MIPS_QEMU 1
#define GRUB_MACHINE_MIPS_QEMU_R4K 1
#endif /* ! GRUB_MACHINE_MACHINE_HEADER */