Subversion Repositories HelenOS

Rev

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

Rev 3386 Rev 4153
Line 40... Line 40...
40
#include <typedefs.h>
40
#include <typedefs.h>
41
#include <align.h>
41
#include <align.h>
42
#include <arch/register.h>
42
#include <arch/register.h>
43
#include <config.h>
43
#include <config.h>
44
#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
}
45
 
94
 
46
/** Read Processor State register.
95
/** Read Processor State register.
47
 *
96
 *
48
 * @return Value of PSTATE register.
97
 * @return Value of PSTATE register.
49
 */
98
 */
Line 85... Line 134...
85
static inline void tick_compare_write(uint64_t v)
134
static inline void tick_compare_write(uint64_t v)
86
{
135
{
87
    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));
88
}
137
}
89
 
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
 
90
/** Read TICK Register.
161
/** Read TICK Register.
91
 *
162
 *
92
 * @return Value of TICK register.
163
 * @return Value of TICK register.
93
 */
164
 */
94
static inline uint64_t tick_read(void)
165
static inline uint64_t tick_read(void)
Line 356... Line 427...
356
static inline void nucleus_leave(void)
427
static inline void nucleus_leave(void)
357
{
428
{
358
    asm volatile ("wrpr %g0, %g0, %tl\n");
429
    asm volatile ("wrpr %g0, %g0, %tl\n");
359
}
430
}
360
 
431
 
361
/** Read UPA_CONFIG register.
-
 
362
 *
-
 
363
 * @return Value of the UPA_CONFIG register.
-
 
364
 */
-
 
365
static inline uint64_t upa_config_read(void)
-
 
366
{
-
 
367
    return asi_u64_read(ASI_UPA_CONFIG, 0);
-
 
368
}
-
 
369
 
-
 
370
extern void cpu_halt(void);
432
extern void cpu_halt(void);
371
extern void cpu_sleep(void);
433
extern void cpu_sleep(void);
372
extern void asm_delay_loop(const uint32_t usec);
434
extern void asm_delay_loop(const uint32_t usec);
373
 
435
 
374
extern uint64_t read_from_ag_g7(void);
436
extern uint64_t read_from_ag_g7(void);