lbio.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. /* memory.h - describe the memory map */
  2. /*
  3. * GRUB -- GRand Unified Bootloader
  4. * Copyright (C) 2002,2007,2010 Free Software Foundation, Inc.
  5. *
  6. * GRUB is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * GRUB is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. #ifndef _GRUB_MACHINE_LBIO_HEADER
  20. #define _GRUB_MACHINE_LBIO_HEADER 1
  21. #include <grub/types.h>
  22. #include <grub/err.h>
  23. struct grub_linuxbios_table_header
  24. {
  25. grub_uint8_t signature[4];
  26. grub_uint32_t header_size;
  27. grub_uint32_t header_checksum;
  28. grub_uint32_t table_size;
  29. grub_uint32_t table_checksum;
  30. grub_uint32_t table_entries;
  31. };
  32. typedef struct grub_linuxbios_table_header *grub_linuxbios_table_header_t;
  33. struct grub_linuxbios_timestamp_entry
  34. {
  35. grub_uint32_t id;
  36. grub_uint64_t tsc;
  37. } GRUB_PACKED;
  38. struct grub_linuxbios_timestamp_table
  39. {
  40. grub_uint64_t base_tsc;
  41. grub_uint32_t capacity;
  42. grub_uint32_t used;
  43. struct grub_linuxbios_timestamp_entry entries[0];
  44. } GRUB_PACKED;
  45. struct grub_linuxbios_mainboard
  46. {
  47. grub_uint8_t vendor;
  48. grub_uint8_t part_number;
  49. char strings[0];
  50. };
  51. struct grub_linuxbios_table_item
  52. {
  53. grub_uint32_t tag;
  54. grub_uint32_t size;
  55. };
  56. typedef struct grub_linuxbios_table_item *grub_linuxbios_table_item_t;
  57. enum
  58. {
  59. GRUB_LINUXBIOS_MEMBER_UNUSED = 0x00,
  60. GRUB_LINUXBIOS_MEMBER_MEMORY = 0x01,
  61. GRUB_LINUXBIOS_MEMBER_MAINBOARD = 0x03,
  62. GRUB_LINUXBIOS_MEMBER_CONSOLE = 0x10,
  63. GRUB_LINUXBIOS_MEMBER_LINK = 0x11,
  64. GRUB_LINUXBIOS_MEMBER_FRAMEBUFFER = 0x12,
  65. GRUB_LINUXBIOS_MEMBER_TIMESTAMPS = 0x16,
  66. GRUB_LINUXBIOS_MEMBER_CBMEMC = 0x17
  67. };
  68. struct grub_linuxbios_table_framebuffer {
  69. grub_uint64_t lfb;
  70. grub_uint32_t width;
  71. grub_uint32_t height;
  72. grub_uint32_t pitch;
  73. grub_uint8_t bpp;
  74. grub_uint8_t red_field_pos;
  75. grub_uint8_t red_mask_size;
  76. grub_uint8_t green_field_pos;
  77. grub_uint8_t green_mask_size;
  78. grub_uint8_t blue_field_pos;
  79. grub_uint8_t blue_mask_size;
  80. grub_uint8_t reserved_field_pos;
  81. grub_uint8_t reserved_mask_size;
  82. } GRUB_PACKED;
  83. struct grub_linuxbios_mem_region
  84. {
  85. grub_uint64_t addr;
  86. grub_uint64_t size;
  87. #define GRUB_MACHINE_MEMORY_AVAILABLE 1
  88. grub_uint32_t type;
  89. } GRUB_PACKED;
  90. typedef struct grub_linuxbios_mem_region *mem_region_t;
  91. grub_err_t
  92. EXPORT_FUNC(grub_linuxbios_table_iterate) (int (*hook) (grub_linuxbios_table_item_t,
  93. void *),
  94. void *hook_data);
  95. grub_linuxbios_table_header_t
  96. grub_linuxbios_get_tables (void);
  97. int
  98. grub_linuxbios_check_signature (grub_linuxbios_table_header_t tbl_header);
  99. #endif