Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fd699c76 authored by Andres Salomon's avatar Andres Salomon Committed by H. Peter Anvin
Browse files

x86, olpc: Add support for calling into OpenFirmware



Add support for saving OFW's cif, and later calling into it to run OFW
commands.  OFW remains resident in memory, living within virtual range
0xff800000 - 0xffc00000.  A single page directory entry points to the
pgdir that OFW actually uses, so rather than saving the entire page
table, we grab and install that one entry permanently in the kernel's
page table.

This is currently only used by the OLPC XO.  Note that this particular
calling convention breaks PAE and PAT, and so cannot be used on newer
x86 hardware.

Signed-off-by: default avatarAndres Salomon <dilinger@queued.net>
LKML-Reference: <20100618174653.7755a39a@dev.queued.net>
Signed-off-by: default avatarH. Peter Anvin <hpa@linux.intel.com>
parent 7e27d6e7
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ Offset Proto Name Meaning
080/010	ALL	hd0_info	hd0 disk parameter, OBSOLETE!!
090/010	ALL	hd1_info	hd1 disk parameter, OBSOLETE!!
0A0/010	ALL	sys_desc_table	System description table (struct sys_desc_table)
0B0/010	ALL	olpc_ofw_header	OLPC's OpenFirmware CIF and friends
140/080	ALL	edid_info	Video mode setup (struct edid_info)
1C0/020	ALL	efi_info	EFI 32 information (struct efi_info)
1E0/004	ALL	alk_mem_k	Alternative mem check, in KB
+9 −0
Original line number Diff line number Diff line
@@ -2062,6 +2062,15 @@ config OLPC
	  Add support for detecting the unique features of the OLPC
	  XO hardware.

config OLPC_OPENFIRMWARE
	bool "Support for OLPC's Open Firmware"
	depends on !X86_64 && !X86_PAE
	default y if OLPC
	help
	  This option adds support for the implementation of Open Firmware
	  that is used on the OLPC XO-1 Children's Machine.
	  If unsure, say N here.

endif # X86_32

config K8_NB
+10 −1
Original line number Diff line number Diff line
@@ -70,6 +70,14 @@ struct sys_desc_table {
	__u8  table[14];
};

/* Gleaned from OFW's set-parameters in cpu/x86/pc/linux.fth */
struct olpc_ofw_header {
	__u32 ofw_magic;	/* OFW signature */
	__u32 ofw_version;
	__u32 cif_handler;	/* callback into OFW */
	__u32 irq_desc_table;
} __attribute__((packed));

struct efi_info {
	__u32 efi_loader_signature;
	__u32 efi_systab;
@@ -92,7 +100,8 @@ struct boot_params {
	__u8  hd0_info[16];	/* obsolete! */		/* 0x080 */
	__u8  hd1_info[16];	/* obsolete! */		/* 0x090 */
	struct sys_desc_table sys_desc_table;		/* 0x0a0 */
	__u8  _pad4[144];				/* 0x0b0 */
	struct olpc_ofw_header olpc_ofw_header;		/* 0x0b0 */
	__u8  _pad4[128];				/* 0x0c0 */
	struct edid_info edid_info;			/* 0x140 */
	struct efi_info efi_info;			/* 0x1c0 */
	__u32 alt_mem_k;				/* 0x1e0 */
+31 −0
Original line number Diff line number Diff line
#ifndef _ASM_X86_OLPC_OFW_H
#define _ASM_X86_OLPC_OFW_H

/* index into the page table containing the entry OFW occupies */
#define OLPC_OFW_PDE_NR 1022

#define OLPC_OFW_SIG 0x2057464F	/* aka "OFW " */

#ifdef CONFIG_OLPC_OPENFIRMWARE

/* run an OFW command by calling into the firmware */
#define olpc_ofw(name, args, res) \
	__olpc_ofw((name), ARRAY_SIZE(args), args, ARRAY_SIZE(res), res)

extern int __olpc_ofw(const char *name, int nr_args, void **args, int nr_res,
		void **res);

/* determine whether OFW is available and lives in the proper memory */
extern void olpc_ofw_detect(void);

/* install OFW's pde permanently into the kernel's pgtable */
extern void setup_olpc_ofw_pgd(void);

#else /* !CONFIG_OLPC_OPENFIRMWARE */

static inline void olpc_ofw_detect(void) { }
static inline void setup_olpc_ofw_pgd(void) { }

#endif /* !CONFIG_OLPC_OPENFIRMWARE */

#endif /* _ASM_X86_OLPC_OFW_H */
+1 −0
Original line number Diff line number Diff line
@@ -104,6 +104,7 @@ obj-$(CONFIG_SCx200) += scx200.o
scx200-y			+= scx200_32.o

obj-$(CONFIG_OLPC)		+= olpc.o
obj-$(CONFIG_OLPC_OPENFIRMWARE)	+= olpc_ofw.o
obj-$(CONFIG_X86_MRST)		+= mrst.o

microcode-y				:= microcode_core.o
Loading