m68k/UAPI: Move generic definitions to <asm/bootinfo.h>

Move generic definitions used by bootstraps to uapi/asm/bootinfo.h:
  - Machine types,
  - CPU, FPU, and MMU types,
  - struct mem_info.

Keep a copy of struct mem_info for in-kernel use, and rename it to struct
m68k_mem_info, as the exported one will be modified later.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
This commit is contained in:
Geert Uytterhoeven 2013-10-02 21:50:56 +02:00
parent 4c3c522bce
commit 799300840c
6 changed files with 85 additions and 95 deletions

View File

@ -22,6 +22,7 @@
#ifndef _M68K_SETUP_H
#define _M68K_SETUP_H
#include <uapi/asm/bootinfo.h>
#include <uapi/asm/setup.h>
@ -297,14 +298,14 @@ extern int m68k_is040or060;
#define NUM_MEMINFO 4
#ifndef __ASSEMBLY__
struct mem_info {
struct m68k_mem_info {
unsigned long addr; /* physical address of memory chunk */
unsigned long size; /* length of memory chunk (in bytes) */
};
extern int m68k_num_memory; /* # of memory blocks found (and used) */
extern int m68k_realnum_memory; /* real # of memory blocks found */
extern struct mem_info m68k_memory[NUM_MEMINFO];/* memory description */
extern struct m68k_mem_info m68k_memory[NUM_MEMINFO];/* memory description */
#endif
#endif /* _M68K_SETUP_H */

View File

@ -11,8 +11,6 @@
#ifndef _UAPI_ASM_M68K_BOOTINFO_H
#define _UAPI_ASM_M68K_BOOTINFO_H
#include <linux/types.h>
#ifndef __ASSEMBLY__
@ -35,6 +33,12 @@ struct bi_record {
unsigned long data[0]; /* data */
};
struct mem_info {
unsigned long addr; /* physical address of memory chunk */
unsigned long size; /* length of memory chunk (in bytes) */
};
#endif /* __ASSEMBLY__ */
@ -58,6 +62,78 @@ struct bi_record {
/* (string) */
/*
* Linux/m68k Architectures (BI_MACHTYPE)
*/
#define MACH_AMIGA 1
#define MACH_ATARI 2
#define MACH_MAC 3
#define MACH_APOLLO 4
#define MACH_SUN3 5
#define MACH_MVME147 6
#define MACH_MVME16x 7
#define MACH_BVME6000 8
#define MACH_HP300 9
#define MACH_Q40 10
#define MACH_SUN3X 11
#define MACH_M54XX 12
/*
* CPU, FPU and MMU types (BI_CPUTYPE, BI_FPUTYPE, BI_MMUTYPE)
*
* Note: we may rely on the following equalities:
*
* CPU_68020 == MMU_68851
* CPU_68030 == MMU_68030
* CPU_68040 == FPU_68040 == MMU_68040
* CPU_68060 == FPU_68060 == MMU_68060
*/
#define CPUB_68020 0
#define CPUB_68030 1
#define CPUB_68040 2
#define CPUB_68060 3
#define CPUB_COLDFIRE 4
#define CPU_68020 (1 << CPUB_68020)
#define CPU_68030 (1 << CPUB_68030)
#define CPU_68040 (1 << CPUB_68040)
#define CPU_68060 (1 << CPUB_68060)
#define CPU_COLDFIRE (1 << CPUB_COLDFIRE)
#define FPUB_68881 0
#define FPUB_68882 1
#define FPUB_68040 2 /* Internal FPU */
#define FPUB_68060 3 /* Internal FPU */
#define FPUB_SUNFPA 4 /* Sun-3 FPA */
#define FPUB_COLDFIRE 5 /* ColdFire FPU */
#define FPU_68881 (1 << FPUB_68881)
#define FPU_68882 (1 << FPUB_68882)
#define FPU_68040 (1 << FPUB_68040)
#define FPU_68060 (1 << FPUB_68060)
#define FPU_SUNFPA (1 << FPUB_SUNFPA)
#define FPU_COLDFIRE (1 << FPUB_COLDFIRE)
#define MMUB_68851 0
#define MMUB_68030 1 /* Internal MMU */
#define MMUB_68040 2 /* Internal MMU */
#define MMUB_68060 3 /* Internal MMU */
#define MMUB_APOLLO 4 /* Custom Apollo */
#define MMUB_SUN3 5 /* Custom Sun-3 */
#define MMUB_COLDFIRE 6 /* Internal MMU */
#define MMU_68851 (1 << MMUB_68851)
#define MMU_68030 (1 << MMUB_68030)
#define MMU_68040 (1 << MMUB_68040)
#define MMU_68060 (1 << MMUB_68060)
#define MMU_SUN3 (1 << MMUB_SUN3)
#define MMU_APOLLO (1 << MMUB_APOLLO)
#define MMU_COLDFIRE (1 << MMUB_COLDFIRE)
/*
* Stuff for bootinfo interface versioning
*

View File

@ -6,98 +6,11 @@
** This file is subject to the terms and conditions of the GNU General Public
** License. See the file COPYING in the main directory of this archive
** for more details.
**
** Created 09/29/92 by Greg Harp
**
** 5/2/94 Roman Hodek:
** Added bi_atari part of the machine dependent union bi_un; for now it
** contains just a model field to distinguish between TT and Falcon.
** 26/7/96 Roman Zippel:
** Renamed to setup.h; added some useful macros to allow gcc some
** optimizations if possible.
** 5/10/96 Geert Uytterhoeven:
** Redesign of the boot information structure; moved boot information
** structure to bootinfo.h
*/
#ifndef _UAPI_M68K_SETUP_H
#define _UAPI_M68K_SETUP_H
/*
* Linux/m68k Architectures
*/
#define MACH_AMIGA 1
#define MACH_ATARI 2
#define MACH_MAC 3
#define MACH_APOLLO 4
#define MACH_SUN3 5
#define MACH_MVME147 6
#define MACH_MVME16x 7
#define MACH_BVME6000 8
#define MACH_HP300 9
#define MACH_Q40 10
#define MACH_SUN3X 11
#define MACH_M54XX 12
#define COMMAND_LINE_SIZE 256
/*
* CPU, FPU and MMU types
*
* Note: we may rely on the following equalities:
*
* CPU_68020 == MMU_68851
* CPU_68030 == MMU_68030
* CPU_68040 == FPU_68040 == MMU_68040
* CPU_68060 == FPU_68060 == MMU_68060
*/
#define CPUB_68020 0
#define CPUB_68030 1
#define CPUB_68040 2
#define CPUB_68060 3
#define CPUB_COLDFIRE 4
#define CPU_68020 (1<<CPUB_68020)
#define CPU_68030 (1<<CPUB_68030)
#define CPU_68040 (1<<CPUB_68040)
#define CPU_68060 (1<<CPUB_68060)
#define CPU_COLDFIRE (1<<CPUB_COLDFIRE)
#define FPUB_68881 0
#define FPUB_68882 1
#define FPUB_68040 2 /* Internal FPU */
#define FPUB_68060 3 /* Internal FPU */
#define FPUB_SUNFPA 4 /* Sun-3 FPA */
#define FPUB_COLDFIRE 5 /* ColdFire FPU */
#define FPU_68881 (1<<FPUB_68881)
#define FPU_68882 (1<<FPUB_68882)
#define FPU_68040 (1<<FPUB_68040)
#define FPU_68060 (1<<FPUB_68060)
#define FPU_SUNFPA (1<<FPUB_SUNFPA)
#define FPU_COLDFIRE (1<<FPUB_COLDFIRE)
#define MMUB_68851 0
#define MMUB_68030 1 /* Internal MMU */
#define MMUB_68040 2 /* Internal MMU */
#define MMUB_68060 3 /* Internal MMU */
#define MMUB_APOLLO 4 /* Custom Apollo */
#define MMUB_SUN3 5 /* Custom Sun-3 */
#define MMUB_COLDFIRE 6 /* Internal MMU */
#define MMU_68851 (1<<MMUB_68851)
#define MMU_68030 (1<<MMUB_68030)
#define MMU_68040 (1<<MMUB_68040)
#define MMU_68060 (1<<MMUB_68060)
#define MMU_SUN3 (1<<MMUB_SUN3)
#define MMU_APOLLO (1<<MMUB_APOLLO)
#define MMU_COLDFIRE (1<<MMUB_COLDFIRE)
#endif /* _UAPI_M68K_SETUP_H */

View File

@ -71,10 +71,10 @@ EXPORT_SYMBOL(m68k_num_memory);
int m68k_realnum_memory;
EXPORT_SYMBOL(m68k_realnum_memory);
unsigned long m68k_memoffset;
struct mem_info m68k_memory[NUM_MEMINFO];
struct m68k_mem_info m68k_memory[NUM_MEMINFO];
EXPORT_SYMBOL(m68k_memory);
static struct mem_info m68k_ramdisk __initdata;
static struct m68k_mem_info m68k_ramdisk __initdata;
static char m68k_command_line[CL_SIZE] __initdata;

View File

@ -59,7 +59,7 @@ EXPORT_SYMBOL(pg_data_table);
void __init m68k_setup_node(int node)
{
#ifndef CONFIG_SINGLE_MEMORY_CHUNK
struct mem_info *info = m68k_memory + node;
struct m68k_mem_info *info = m68k_memory + node;
int i, end;
i = (unsigned long)phys_to_virt(info->addr) >> __virt_to_node_shift();

View File

@ -233,7 +233,7 @@ void __init paging_init(void)
printk("Fix your bootloader or use a memfile to make use of this area!\n");
m68k_num_memory--;
memmove(m68k_memory + i, m68k_memory + i + 1,
(m68k_num_memory - i) * sizeof(struct mem_info));
(m68k_num_memory - i) * sizeof(struct m68k_mem_info));
continue;
}
addr = m68k_memory[i].addr + m68k_memory[i].size;