diff options
Diffstat (limited to 'sys/amd64/include')
| -rw-r--r-- | sys/amd64/include/apicreg.h | 24 | ||||
| -rw-r--r-- | sys/amd64/include/atomic.h | 13 |
2 files changed, 33 insertions, 4 deletions
diff --git a/sys/amd64/include/apicreg.h b/sys/amd64/include/apicreg.h index be9de4f8fe1ff..3d84792ed5046 100644 --- a/sys/amd64/include/apicreg.h +++ b/sys/amd64/include/apicreg.h @@ -463,4 +463,28 @@ typedef struct IOAPIC ioapic_t; #define IOART_INTVEC 0x000000ff /* R/W: INTerrupt vector field */ +#ifdef LOCORE + +#ifdef SMP + +/* + * Protects the IO APIC and apic_imen as a critical region. + */ +#define IMASK_LOCK MTX_LOCK_SPIN(_imen_mtx, 0) +#define IMASK_UNLOCK MTX_UNLOCK_SPIN(_imen_mtx) + +#else /* SMP */ + +#define IMASK_LOCK /* NOP */ +#define IMASK_UNLOCK /* NOP */ + +#endif /* SMP */ + +#else /* LOCORE */ + +/* global data in mp_machdep.c */ +extern struct mtx imen_mtx; + +#endif /* LOCORE */ + #endif /* _MACHINE_APIC_H_ */ diff --git a/sys/amd64/include/atomic.h b/sys/amd64/include/atomic.h index b5035b89e4d47..cb899a62d62f3 100644 --- a/sys/amd64/include/atomic.h +++ b/sys/amd64/include/atomic.h @@ -74,16 +74,18 @@ u_##TYPE atomic_load_acq_##TYPE(volatile u_##TYPE *p); \ void atomic_store_rel_##TYPE(volatile u_##TYPE *p, u_##TYPE v); #else /* !KLD_MODULE */ + #if defined(SMP) #if defined(LOCORE) #define MPLOCKED lock ; -#else +#else /* !LOCORE */ #define MPLOCKED "lock ; " -#endif -#else +#endif /* LOCORE */ +#else /* !SMP */ #define MPLOCKED -#endif +#endif /* SMP */ +#if !defined(LOCORE) /* * The assembly is volatilized to demark potential before-and-after side * effects if an interrupt or SMP collision were to occur. @@ -201,8 +203,10 @@ atomic_store_rel_##TYPE(volatile u_##TYPE *p, u_##TYPE v)\ : : "memory"); \ } #endif /* defined(I386_CPU) */ +#endif /* !defined(LOCORE) */ #endif /* KLD_MODULE */ +#if !defined(LOCORE) ATOMIC_ASM(set, char, "orb %b2,%0", v) ATOMIC_ASM(clear, char, "andb %b2,%0", ~v) ATOMIC_ASM(add, char, "addb %b2,%0", v) @@ -401,4 +405,5 @@ atomic_readandclear_long(volatile u_long *addr) return (result); } #endif /* !defined(WANT_FUNCTIONS) */ +#endif /* !defined(LOCORE) */ #endif /* ! _MACHINE_ATOMIC_H_ */ |
