coreboot_table.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /*
  2. * coreboot_table.h
  3. *
  4. * Internal header for coreboot table access.
  5. *
  6. * Copyright 2014 Gerd Hoffmann <kraxel@redhat.com>
  7. * Copyright 2017 Google Inc.
  8. * Copyright 2017 Samuel Holland <samuel@sholland.org>
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License v2.0 as published by
  12. * the Free Software Foundation.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. */
  19. #ifndef __COREBOOT_TABLE_H
  20. #define __COREBOOT_TABLE_H
  21. #include <linux/io.h>
  22. /* Coreboot table header structure */
  23. struct coreboot_table_header {
  24. char signature[4];
  25. u32 header_bytes;
  26. u32 header_checksum;
  27. u32 table_bytes;
  28. u32 table_checksum;
  29. u32 table_entries;
  30. };
  31. /* List of coreboot entry structures that is used */
  32. /* Generic */
  33. struct coreboot_table_entry {
  34. u32 tag;
  35. u32 size;
  36. };
  37. /* Points to a CBMEM entry */
  38. struct lb_cbmem_ref {
  39. u32 tag;
  40. u32 size;
  41. u64 cbmem_addr;
  42. };
  43. /* Describes framebuffer setup by coreboot */
  44. struct lb_framebuffer {
  45. u32 tag;
  46. u32 size;
  47. u64 physical_address;
  48. u32 x_resolution;
  49. u32 y_resolution;
  50. u32 bytes_per_line;
  51. u8 bits_per_pixel;
  52. u8 red_mask_pos;
  53. u8 red_mask_size;
  54. u8 green_mask_pos;
  55. u8 green_mask_size;
  56. u8 blue_mask_pos;
  57. u8 blue_mask_size;
  58. u8 reserved_mask_pos;
  59. u8 reserved_mask_size;
  60. };
  61. /* A device, additionally with information from coreboot. */
  62. struct coreboot_device {
  63. struct device dev;
  64. union {
  65. struct coreboot_table_entry entry;
  66. struct lb_cbmem_ref cbmem_ref;
  67. struct lb_framebuffer framebuffer;
  68. };
  69. };
  70. /* A driver for handling devices described in coreboot tables. */
  71. struct coreboot_driver {
  72. int (*probe)(struct coreboot_device *);
  73. int (*remove)(struct coreboot_device *);
  74. struct device_driver drv;
  75. u32 tag;
  76. };
  77. /* Register a driver that uses the data from a coreboot table. */
  78. int coreboot_driver_register(struct coreboot_driver *driver);
  79. /* Unregister a driver that uses the data from a coreboot table. */
  80. void coreboot_driver_unregister(struct coreboot_driver *driver);
  81. /* Initialize coreboot table module given a pointer to iomem */
  82. int coreboot_table_init(struct device *dev, void __iomem *ptr);
  83. /* Cleanup coreboot table module */
  84. int coreboot_table_exit(void);
  85. #endif /* __COREBOOT_TABLE_H */