processor.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * (C) Copyright 2002
  4. * Daniel Engström, Omicron Ceti AB, daniel@omicron.se
  5. */
  6. #ifndef __ASM_PROCESSOR_H_
  7. #define __ASM_PROCESSOR_H_ 1
  8. #define X86_GDT_ENTRY_SIZE 8
  9. #define X86_GDT_ENTRY_NULL 0
  10. #define X86_GDT_ENTRY_UNUSED 1
  11. #define X86_GDT_ENTRY_32BIT_CS 2
  12. #define X86_GDT_ENTRY_32BIT_DS 3
  13. #define X86_GDT_ENTRY_32BIT_FS 4
  14. #define X86_GDT_ENTRY_16BIT_CS 5
  15. #define X86_GDT_ENTRY_16BIT_DS 6
  16. #define X86_GDT_ENTRY_16BIT_FLAT_CS 7
  17. #define X86_GDT_ENTRY_16BIT_FLAT_DS 8
  18. #define X86_GDT_NUM_ENTRIES 9
  19. #define X86_GDT_SIZE (X86_GDT_NUM_ENTRIES * X86_GDT_ENTRY_SIZE)
  20. /* Length of the public header on Intel microcode blobs */
  21. #define UCODE_HEADER_LEN 0x30
  22. #ifndef __ASSEMBLY__
  23. /*
  24. * This register is documented in (for example) the Intel Atom Processor E3800
  25. * Product Family Datasheet in "PCU - Power Management Controller (PMC)".
  26. *
  27. * RST_CNT: Reset Control Register (RST_CNT) Offset cf9.
  28. *
  29. * The naming follows Intel's naming.
  30. */
  31. #define IO_PORT_RESET 0xcf9
  32. enum {
  33. SYS_RST = 1 << 1, /* 0 for soft reset, 1 for hard reset */
  34. RST_CPU = 1 << 2, /* initiate reset */
  35. FULL_RST = 1 << 3, /* full power cycle */
  36. };
  37. static inline __attribute__((always_inline)) void cpu_hlt(void)
  38. {
  39. asm("hlt");
  40. }
  41. static inline ulong cpu_get_sp(void)
  42. {
  43. ulong result;
  44. asm volatile(
  45. "mov %%esp, %%eax"
  46. : "=a" (result));
  47. return result;
  48. }
  49. #endif /* __ASSEMBLY__ */
  50. #endif