pam.h 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. #ifndef QEMU_PAM_H
  2. #define QEMU_PAM_H
  3. /*
  4. * Copyright (c) 2006 Fabrice Bellard
  5. * Copyright (c) 2011 Isaku Yamahata <yamahata at valinux co jp>
  6. * VA Linux Systems Japan K.K.
  7. * Copyright (c) 2012 Jason Baron <jbaron@redhat.com>
  8. *
  9. * Split out from piix_pci.c
  10. *
  11. * Permission is hereby granted, free of charge, to any person obtaining a copy
  12. * of this software and associated documentation files (the "Software"), to deal
  13. * in the Software without restriction, including without limitation the rights
  14. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  15. * copies of the Software, and to permit persons to whom the Software is
  16. * furnished to do so, subject to the following conditions:
  17. *
  18. * The above copyright notice and this permission notice shall be included in
  19. * all copies or substantial portions of the Software.
  20. *
  21. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  22. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  23. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  24. * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  25. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  26. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  27. * THE SOFTWARE.
  28. */
  29. /*
  30. * SMRAM memory area and PAM memory area in Legacy address range for PC.
  31. * PAM: Programmable Attribute Map registers
  32. *
  33. * 0xa0000 - 0xbffff compatible SMRAM
  34. *
  35. * 0xc0000 - 0xc3fff Expansion area memory segments
  36. * 0xc4000 - 0xc7fff
  37. * 0xc8000 - 0xcbfff
  38. * 0xcc000 - 0xcffff
  39. * 0xd0000 - 0xd3fff
  40. * 0xd4000 - 0xd7fff
  41. * 0xd8000 - 0xdbfff
  42. * 0xdc000 - 0xdffff
  43. * 0xe0000 - 0xe3fff Extended System BIOS Area Memory Segments
  44. * 0xe4000 - 0xe7fff
  45. * 0xe8000 - 0xebfff
  46. * 0xec000 - 0xeffff
  47. *
  48. * 0xf0000 - 0xfffff System BIOS Area Memory Segments
  49. */
  50. #include "qemu-common.h"
  51. #include "exec/memory.h"
  52. #define SMRAM_C_BASE 0xa0000
  53. #define SMRAM_C_END 0xc0000
  54. #define SMRAM_C_SIZE 0x20000
  55. #define PAM_EXPAN_BASE 0xc0000
  56. #define PAM_EXPAN_SIZE 0x04000
  57. #define PAM_EXBIOS_BASE 0xe0000
  58. #define PAM_EXBIOS_SIZE 0x04000
  59. #define PAM_BIOS_BASE 0xf0000
  60. #define PAM_BIOS_END 0xfffff
  61. /* 64KB: Intel 3 series express chipset family p. 58*/
  62. #define PAM_BIOS_SIZE 0x10000
  63. /* PAM registers: log nibble and high nibble*/
  64. #define PAM_ATTR_WE ((uint8_t)2)
  65. #define PAM_ATTR_RE ((uint8_t)1)
  66. #define PAM_ATTR_MASK ((uint8_t)3)
  67. /* SMRAM register */
  68. #define SMRAM_D_OPEN ((uint8_t)(1 << 6))
  69. #define SMRAM_D_CLS ((uint8_t)(1 << 5))
  70. #define SMRAM_D_LCK ((uint8_t)(1 << 4))
  71. #define SMRAM_G_SMRAME ((uint8_t)(1 << 3))
  72. #define SMRAM_C_BASE_SEG_MASK ((uint8_t)0x7)
  73. #define SMRAM_C_BASE_SEG ((uint8_t)0x2) /* hardwired to b010 */
  74. typedef struct PAMMemoryRegion {
  75. MemoryRegion alias[4]; /* index = PAM value */
  76. unsigned current;
  77. } PAMMemoryRegion;
  78. void smram_update(MemoryRegion *smram_region, uint8_t smram,
  79. uint8_t smm_enabled);
  80. void smram_set_smm(uint8_t *host_smm_enabled, int smm, uint8_t smram,
  81. MemoryRegion *smram_region);
  82. void init_pam(MemoryRegion *ram, MemoryRegion *system, MemoryRegion *pci,
  83. PAMMemoryRegion *mem, uint32_t start, uint32_t size);
  84. void pam_update(PAMMemoryRegion *mem, int idx, uint8_t val);
  85. #endif /* QEMU_PAM_H */