Subversion Repositories HelenOS

Rev

Rev 3022 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3022 Rev 4055
Line 35... Line 35...
35
#ifndef KERN_sparc64_ASM_H_
35
#ifndef KERN_sparc64_ASM_H_
36
#define KERN_sparc64_ASM_H_
36
#define KERN_sparc64_ASM_H_
37
 
37
 
38
#include <arch/arch.h>
38
#include <arch/arch.h>
39
#include <arch/types.h>
39
#include <arch/types.h>
-
 
40
#include <typedefs.h>
40
#include <align.h>
41
#include <align.h>
41
#include <arch/register.h>
42
#include <arch/register.h>
42
#include <config.h>
43
#include <config.h>
43
#include <arch/stack.h>
44
#include <arch/stack.h>
-
 
45
#include <arch/barrier.h>
-
 
46
 
-
 
47
static inline void pio_write_8(ioport8_t *port, uint8_t v)
-
 
48
{
-
 
49
    *port = v;
-
 
50
    memory_barrier();
-
 
51
}
-
 
52
 
-
 
53
static inline void pio_write_16(ioport16_t *port, uint16_t v)
-
 
54
{
-
 
55
    *port = v;
-
 
56
    memory_barrier();
-
 
57
}
-
 
58
 
-
 
59
static inline void pio_write_32(ioport32_t *port, uint32_t v)
-
 
60
{
-
 
61
    *port = v;
-
 
62
    memory_barrier();
-
 
63
}
-
 
64
 
-
 
65
static inline uint8_t pio_read_8(ioport8_t *port)
-
 
66
{
-
 
67
    uint8_t rv;
-
 
68
 
-
 
69
    rv = *port;
-
 
70
    memory_barrier();
-
 
71
 
-
 
72
    return rv;
-
 
73
}
-
 
74
 
-
 
75
static inline uint16_t pio_read_16(ioport16_t *port)
-
 
76
{
-
 
77
    uint16_t rv;
-
 
78
 
-
 
79
    rv = *port;
-
 
80
    memory_barrier();
-
 
81
 
-
 
82
    return rv;
-
 
83
}
-
 
84
 
-
 
85
static inline uint32_t pio_read_32(ioport32_t *port)
-
 
86
{
-
 
87
    uint32_t rv;
-
 
88
 
-
 
89
    rv = *port;
-
 
90
    memory_barrier();
-
 
91
 
-
 
92
    return rv;
-
 
93
}
44
 
94
 
45
/** Read Processor State register.
95
/** Read Processor State register.
46
 *
96
 *
47
 * @return Value of PSTATE register.
97
 * @return Value of PSTATE register.
48
 */
98
 */
Line 84... Line 134...
84
static inline void tick_compare_write(uint64_t v)
134
static inline void tick_compare_write(uint64_t v)
85
{
135
{
86
    asm volatile ("wr %0, %1, %%tick_cmpr\n" : : "r" (v), "i" (0));
136
    asm volatile ("wr %0, %1, %%tick_cmpr\n" : : "r" (v), "i" (0));
87
}
137
}
88
 
138
 
-
 
139
/** Read STICK_compare Register.
-
 
140
 *
-
 
141
 * @return Value of STICK_compare register.
-
 
142
 */
-
 
143
static inline uint64_t stick_compare_read(void)
-
 
144
{
-
 
145
    uint64_t v;
-
 
146
   
-
 
147
    asm volatile ("rd %%asr25, %0\n" : "=r" (v));
-
 
148
   
-
 
149
    return v;
-
 
150
}
-
 
151
 
-
 
152
/** Write STICK_compare Register.
-
 
153
 *
-
 
154
 * @param v New value of STICK_comapre register.
-
 
155
 */
-
 
156
static inline void stick_compare_write(uint64_t v)
-
 
157
{
-
 
158
    asm volatile ("wr %0, %1, %%asr25\n" : : "r" (v), "i" (0));
-
 
159
}
-
 
160
 
89
/** Read TICK Register.
161
/** Read TICK Register.
90
 *
162
 *
91
 * @return Value of TICK register.
163
 * @return Value of TICK register.
92
 */
164
 */
93
static inline uint64_t tick_read(void)
165
static inline uint64_t tick_read(void)
Line 355... Line 427...
355
static inline void nucleus_leave(void)
427
static inline void nucleus_leave(void)
356
{
428
{
357
    asm volatile ("wrpr %g0, %g0, %tl\n");
429
    asm volatile ("wrpr %g0, %g0, %tl\n");
358
}
430
}
359
 
431
 
360
/** Read UPA_CONFIG register.
-
 
361
 *
-
 
362
 * @return Value of the UPA_CONFIG register.
-
 
363
 */
-
 
364
static inline uint64_t upa_config_read(void)
-
 
365
{
-
 
366
    return asi_u64_read(ASI_UPA_CONFIG, 0);
-
 
367
}
-
 
368
 
-
 
369
extern void cpu_halt(void);
432
extern void cpu_halt(void);
370
extern void cpu_sleep(void);
433
extern void cpu_sleep(void);
371
extern void asm_delay_loop(const uint32_t usec);
434
extern void asm_delay_loop(const uint32_t usec);
372
 
435
 
373
extern uint64_t read_from_ag_g7(void);
436
extern uint64_t read_from_ag_g7(void);