blob: 5c1ad11aa39264aee7e9210cbf6747adab443930 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
Russell King4baa9922008-08-02 10:55:55 +01002 * arch/arm/include/asm/mach/arch.h
Linus Torvalds1da177e2005-04-16 15:20:36 -07003 *
4 * Copyright (C) 2000 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
Jon Medhurstb382b942013-05-21 13:40:51 +000011#include <linux/types.h>
12
Linus Torvalds1da177e2005-04-16 15:20:36 -070013#ifndef __ASSEMBLY__
Robin Holt16d6d5b2013-07-08 16:01:39 -070014#include <linux/reboot.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070015
16struct tag;
Fabio Estevam1a1f2be2011-11-09 19:13:43 +010017struct pt_regs;
Marc Zyngierabcee5f2011-09-08 09:06:10 +010018struct smp_operations;
19#ifdef CONFIG_SMP
20#define smp_ops(ops) (&(ops))
Jon Medhurstb382b942013-05-21 13:40:51 +000021#define smp_init_ops(ops) (&(ops))
Marc Zyngierabcee5f2011-09-08 09:06:10 +010022#else
23#define smp_ops(ops) (struct smp_operations *)NULL
Jon Medhurstb382b942013-05-21 13:40:51 +000024#define smp_init_ops(ops) (bool (*)(void))NULL
Marc Zyngierabcee5f2011-09-08 09:06:10 +010025#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070026
27struct machine_desc {
Linus Torvalds1da177e2005-04-16 15:20:36 -070028 unsigned int nr; /* architecture number */
Linus Torvalds1da177e2005-04-16 15:20:36 -070029 const char *name; /* architecture name */
Nicolas Pitre2bb98392011-07-05 22:38:10 -040030 unsigned long atag_offset; /* tagged list (relative) */
Uwe Kleine-König7b482c82011-12-20 22:56:45 +010031 const char *const *dt_compat; /* array of device tree
Grant Likely93c02ab2011-04-28 14:27:21 -060032 * 'compatible' strings */
Linus Torvalds1da177e2005-04-16 15:20:36 -070033
Nicolas Pitred71e3eb2010-10-14 22:37:52 -040034 unsigned int nr_irqs; /* number of IRQs */
35
Nicolas Pitre4fddcae2011-07-05 22:28:08 -040036#ifdef CONFIG_ZONE_DMA
Rob Herring364230b2013-08-01 15:29:29 -050037 phys_addr_t dma_zone_size; /* size of DMA-able area */
Nicolas Pitre4fddcae2011-07-05 22:28:08 -040038#endif
39
Linus Torvalds1da177e2005-04-16 15:20:36 -070040 unsigned int video_start; /* start of video RAM */
41 unsigned int video_end; /* end of video RAM */
42
Russell Kingb44c3502011-11-01 14:27:33 +000043 unsigned char reserve_lp0 :1; /* never has lp0 */
44 unsigned char reserve_lp1 :1; /* never has lp1 */
45 unsigned char reserve_lp2 :1; /* never has lp2 */
Robin Holt16d6d5b2013-07-08 16:01:39 -070046 enum reboot_mode reboot_mode; /* default restart mode */
Russell King805604e2014-04-28 15:24:10 +010047 unsigned l2c_aux_val; /* L2 cache aux value */
48 unsigned l2c_aux_mask; /* L2 cache aux mask */
49 void (*l2c_write_sec)(unsigned long, unsigned);
Masahiro Yamadaf460b6a2015-08-26 07:49:12 +010050 const struct smp_operations *smp; /* SMP operations */
Jon Medhurstb382b942013-05-21 13:40:51 +000051 bool (*smp_init)(void);
Laura Abbott1c2f87c2014-04-13 22:54:58 +010052 void (*fixup)(struct tag *, char **);
Laura Abbott5a12a5972014-07-15 10:03:36 -070053 void (*dt_fixup)(void);
Russell Kingc0b759d2015-04-04 10:01:10 +010054 long long (*pv_fixup)(void);
Russell King98c672c2010-05-22 18:18:57 +010055 void (*reserve)(void);/* reserve mem blocks */
Linus Torvalds1da177e2005-04-16 15:20:36 -070056 void (*map_io)(void);/* IO mapping function */
Russell Kingdec12e62010-12-16 13:49:34 +000057 void (*init_early)(void);
Linus Torvalds1da177e2005-04-16 15:20:36 -070058 void (*init_irq)(void);
Stephen Warren6bb27d72012-11-08 12:40:59 -070059 void (*init_time)(void);
Linus Torvalds1da177e2005-04-16 15:20:36 -070060 void (*init_machine)(void);
Shawn Guo90de4132012-04-25 22:24:44 +080061 void (*init_late)(void);
eric miao52108642010-12-13 09:42:34 +010062#ifdef CONFIG_MULTI_IRQ_HANDLER
63 void (*handle_irq)(struct pt_regs *);
64#endif
Robin Holt7b6d8642013-07-08 16:01:40 -070065 void (*restart)(enum reboot_mode, const char *);
Linus Torvalds1da177e2005-04-16 15:20:36 -070066};
67
68/*
Russell King8ff14432010-12-20 10:18:36 +000069 * Current machine - only accessible during boot.
70 */
Russell Kingff69a4c2013-07-26 14:55:59 +010071extern const struct machine_desc *machine_desc;
Russell King8ff14432010-12-20 10:18:36 +000072
73/*
Grant Likely62913192011-04-28 14:27:21 -060074 * Machine type table - also only accessible during boot
75 */
Russell Kingff69a4c2013-07-26 14:55:59 +010076extern const struct machine_desc __arch_info_begin[], __arch_info_end[];
Grant Likely62913192011-04-28 14:27:21 -060077#define for_each_machine_desc(p) \
78 for (p = __arch_info_begin; p < __arch_info_end; p++)
79
80/*
Linus Torvalds1da177e2005-04-16 15:20:36 -070081 * Set of macros to define architecture features. This is built into
82 * a table by the linker.
83 */
Russell Kingf339ab32005-10-28 14:29:43 +010084#define MACHINE_START(_type,_name) \
85static const struct machine_desc __mach_desc_##_type \
David Rientjesb91d8a12007-05-11 16:18:55 -070086 __used \
Ben Dooks9d0fd1e2005-09-20 16:45:20 +010087 __attribute__((__section__(".arch.info.init"))) = { \
Russell Kingf339ab32005-10-28 14:29:43 +010088 .nr = MACH_TYPE_##_type, \
Linus Torvalds1da177e2005-04-16 15:20:36 -070089 .name = _name,
90
Linus Torvalds1da177e2005-04-16 15:20:36 -070091#define MACHINE_END \
92};
93
Grant Likely85cad1b2011-07-25 09:52:11 -060094#define DT_MACHINE_START(_name, _namestr) \
95static const struct machine_desc __mach_desc_##_name \
96 __used \
97 __attribute__((__section__(".arch.info.init"))) = { \
98 .nr = ~0, \
99 .name = _namestr,
100
Linus Torvalds1da177e2005-04-16 15:20:36 -0700101#endif