coreboot_table.h 2.1 KB

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