source: trunk/hal/oldies/hal_arch.h @ 30

Last change on this file since 30 was 1, checked in by alain, 8 years ago

First import

File size: 3.2 KB
RevLine 
[1]1/*
2 * kern/hal-arch.h - Architecture related Hardware Abstraction Layer
3 *
4 * Copyright (c) 2008,2009,2010,2011,2012 Ghassan Almaless
5 * Copyright (c) 2011,2012 UPMC Sorbonne Universites
6 *
7 * This file is part of ALMOS-kernel.
8 *
9 * ALMOS-kernel is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; version 2.0 of the License.
12 *
13 * ALMOS-kernel is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with ALMOS-kernel; if not, write to the Free Software Foundation,
20 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22
23#ifndef  _HAL_ARCH_H_
24#define  _HAL_ARCH_H_
25
26#ifndef  _SYSTEM_H_
27#error hal-arch.h cannot be included directly, use system.h instead
28#endif
29
30#include <types.h>
31
32/** Used atructures */
33struct cpu_s;
34struct cluster_s;
35struct irq_action_s;
36struct event_s;
37struct boot_info_s;
38struct dqdt_cluster_s;
39struct dqdt_attr_s;
40
41/** Provided structures, functions and macros */
42#define ARCH_THREAD_PAGE_ORDER 
43struct arch_cpu_s;
44struct arch_cluster_s;
45
46/* CPUs/CLUSTERs Numbers */
47#define CLUSTER_NR
48#define CPU_PER_CLUSTER_NR
49uint_t arch_onln_cpu_nr(void);
50uint_t arch_onln_cluster_nr(void);
51uint_t arch_cpu_per_cluster(void);
52cid_t  arch_boot_cid(void);
53
54static inline uint_t arch_cpu_gid(uint_t cid, uint_t lid);
55static inline uint_t arch_cpu_lid(uint_t cpu_gid);
56static inline uint_t arch_cpu_cid(uint_t cpu_gid);
57
58/* Architecture Initialization */
59void arch_init(struct boot_info_s *info);
60void arch_memory_init(struct boot_info_s *info);
61error_t arch_dqdt_build(struct boot_info_s *info);
62
63/* Real time, Real clock timers */
64#define CPU_CLOCK_TICK
65#define MSEC_PER_TICK
66#define CYCLES_PER_SECOND
67
68/* Architecture context */
69error_t arch_cpu_init(struct cpu_s *cpu);
70
71/* IRQs, IPIs and others */
72error_t arch_cpu_set_irq_entry(struct cpu_s *cpu, int irq_nr, struct irq_action_s *action);
73error_t arch_cpu_get_irq_entry(struct cpu_s *cpu, int irq_nr, struct irq_action_s **action);
74error_t arch_cpu_send_ipi(gid_t dest, uint32_t val);
75
76/* Specific architecture-dependent DQDT macros & functions */
77#define DQDT_DIST_NOTSET     0  /* must be zero (c.f: see dqdt_attr_init in kern/dqdt.h) */
78#define DQDT_DIST_DEFAULT    1
79#define DQDT_DIST_RANDOM     2
80
81uint_t arch_dqdt_distance(struct dqdt_cluster_s *c1, struct dqdt_cluster_s *c2, struct dqdt_attr_s *attr);
82
83/* Specific architecture depanding CPU operations */
84typedef enum
85{
86        ARCH_PWR_IDLE,
87        ARCH_PWR_SLEEP,
88        ARCH_PWR_SHUTDOWN
89} arch_power_state_t;
90
91error_t arch_set_power_state(struct cpu_s *cpu, arch_power_state_t state);
92
93/* Specific architecture depanding CLUSTER operations */
94
95
96/* Specific architecture implementation */
97
98#define ARCH_HAS_BARRIERS
99
100sint_t  arch_barrier_init(struct cluster_s *cluster, struct event_s *event, uint_t count);
101sint_t  arch_barrier_wait(struct cluster_s *cluster, uint_t barrier_id);
102error_t arch_barrier_destroy(struct cluster_s *cluster, uint_t barrier_id);
103
104
105#include <arch.h>
106
107#endif  /* _HAL_CPU_H_ */
Note: See TracBrowser for help on using the repository browser.