grub2/include/grub/powerpc/ieee1275/partition.h
marco_g e56cdf2111 2004-03-29 Marco Gerards <metgerards@student.han.nl>
Add support for the newworld apple macintosh (PPC).  This has been
	tested on the powerbook 2000 only.  It only adds support for
	generic ieee1275 functions, console and disk support.  This should
	be easy to port to other architectures with support for Open
	Firmware.

	* configure.ac: Accept the powerpc as host_cpu.  In the case of
	the powerpc cpu set the host_vendor to ieee1275.  Make sure the i386
	specific tests are only executed while building for the i386.
	Inverse test for crosscompile.
	* genmk.rb (Utility): Allow assembler files.
	* normal/cmdline.c (pupa_tab_complete): Reset pupa_errno.
	* conf/powerpc-ieee1275.rmk: New file.
	* disk/powerpc/ieee1275/ofdisk.c: Likewise.
	* disk/powerpc/ieee1275/partition.c: Likewise.
	* include/pupa/powerpc/ieee1275/biosdisk.h: Likewise.
	* include/pupa/powerpc/ieee1275/console.h: Likewise.
	* include/pupa/powerpc/ieee1275/partition.h: Likewise.
	* include/pupa/powerpc/ieee1275/time.h: Likewise.
	* include/pupa/powerpc/ieee1275/util/biosdisk.h: Likewise.
	* include/pupa/powerpc/ieee1275/multiboot.h: Likewise.
	* include/pupa/powerpc/ieee1275/loader.h
	* include/pupa/powerpc/setjmp.h: Likewise.
	* include/pupa/powerpc/types.h: Likewise.
	* kern/powerpc/ieee1275/init.c: Likewise.
	* kern/powerpc/ieee1275/openfw.c: Likewise.
	* term/powerpc/ieee1275/ofconsole.c: Likewise.

	These files were written by Johan Rydberg
	(jrydberg@night.trouble.net) and I only modified them slightly.

	* boot/powerpc/ieee1275/cmain.c: New file.
	* boot/powerpc/ieee1275/crt0.S: Likewise.
	* boot/powerpc/ieee1275/ieee1275.c: Likewise.
	* include/pupa/powerpc/ieee1275/ieee1275.h: Likewise.
2004-03-28 21:52:02 +00:00

141 lines
3.4 KiB
C
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* PUPA -- Preliminary Universal Programming Architecture for GRUB
* Copyright (C) 1999,2000,2001,2002,2004 Free Software Foundation, Inc.
*
* PUPA 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 2 of the License, or
* (at your option) any later version.
*
* This program 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 PUPA; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef PUPA_PARTITION_HEADER
#define PUPA_PARTITION_HEADER 1
#include <pupa/symbol.h>
#include <pupa/types.h>
#include <pupa/err.h>
#define PUPA_APPLE_PART_MAGIC 0x504D
struct pupa_apple_part
{
/* The magic number to idenify this as a partition, it should have
the value `0x504D'. */
pupa_uint16_t magic;
/* Reserved. */
pupa_uint16_t reserved;
/* The size of the partition map in blocks. */
pupa_uint32_t partmap_size;
/* The first physical block of the partition. */
pupa_uint32_t first_phys_block;
/* The amount of blocks. */
pupa_uint32_t blockcnt;
/* The partition name. */
char partname[32];
/* The partition type. */
char parttype[32];
/* The first datablock of the partition. */
pupa_uint32_t datablocks_first;
/* The amount datablocks. */
pupa_uint32_t datablocks_count;
/* The status of the partition. (???) */
pupa_uint32_t status;
/* The first block on which the bootcode can be found. */
pupa_uint32_t bootcode_pos;
/* The size of the bootcode in bytes. */
pupa_uint32_t bootcode_size;
/* The load address of the bootcode. */
pupa_uint32_t bootcode_loadaddr;
/* Reserved. */
pupa_uint32_t reserved2;
/* The entrypoint of the bootcode. */
pupa_uint32_t bootcode_entrypoint;
/* Reserved. */
pupa_uint32_t reserved3;
/* A checksum of the bootcode. */
pupa_uint32_t bootcode_checksum;
/* The processor type. */
char processor[16];
/* Padding. */
pupa_uint16_t pad[187];
};
/* Partition description. */
struct pupa_partition
{
/* The start sector. */
unsigned long start;
/* The length in sector units. */
unsigned long len;
/* The offset of the partition table. */
unsigned long offset;
/* The index of this partition in the partition table. */
int index;
/* The DOS partition number. */
int dos_part;
/* The BSD partition number (a == 0). */
int bsd_part;
/* The DOS partition type. */
int dos_type;
/* The BSD partition type. */
int bsd_type;
};
typedef struct pupa_partition *pupa_partition_t;
struct pupa_disk;
pupa_partition_t EXPORT_FUNC(pupa_partition_probe) (struct pupa_disk *disk,
const char *str);
pupa_err_t EXPORT_FUNC(pupa_partition_iterate) (struct pupa_disk *disk,
int (*hook) (const pupa_partition_t partition));
char *EXPORT_FUNC(pupa_partition_get_name) (const pupa_partition_t partition);
static inline unsigned long
pupa_partition_get_start (const pupa_partition_t p)
{
return p->start;
}
static inline unsigned long
pupa_partition_get_len (const pupa_partition_t p)
{
return p->len;
}
#endif /* ! PUPA_PARTITION_HEADER */