drm/i915/bios: add an enum for BDB block IDs
authorJani Nikula <jani.nikula@intel.com>
Fri, 31 May 2019 13:15:03 +0000 (16:15 +0300)
committerJani Nikula <jani.nikula@intel.com>
Wed, 5 Jun 2019 12:20:37 +0000 (15:20 +0300)
Better grouping, better semantics for find_section(). No functional
changes.

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/192cc8a45cb5c36ccbde25a725df135793a4263f.1559308269.git.jani.nikula@intel.com
drivers/gpu/drm/i915/intel_bios.c
drivers/gpu/drm/i915/intel_vbt_defs.h

index b5aedb605c05dd7927e238eebd16d3483bf8ded6..1c037dfa83f5389e9aaf4089261e11dc2a50ed97 100644 (file)
@@ -76,13 +76,13 @@ static u32 get_blocksize(const void *block_data)
 }
 
 static const void *
-find_section(const void *_bdb, int section_id)
+find_section(const void *_bdb, enum bdb_block_id section_id)
 {
        const struct bdb_header *bdb = _bdb;
        const u8 *base = _bdb;
        int index = 0;
        u32 total, current_size;
-       u8 current_id;
+       enum bdb_block_id current_id;
 
        /* skip to first section */
        index += bdb->header_size;
index 6d46ca4bf8c417fa37ce4495bcda847e484bd8ab..89ef14cafb6be773af53907e244534052b5fdbb3 100644 (file)
@@ -80,41 +80,42 @@ struct bdb_header {
  * an ID and size in the first 3 bytes (ID in first, size in next 2).
  * Known types are listed below.
  */
-#define BDB_GENERAL_FEATURES     1
-#define BDB_GENERAL_DEFINITIONS          2
-#define BDB_OLD_TOGGLE_LIST      3
-#define BDB_MODE_SUPPORT_LIST    4
-#define BDB_GENERIC_MODE_TABLE   5
-#define BDB_EXT_MMIO_REGS        6
-#define BDB_SWF_IO               7
-#define BDB_SWF_MMIO             8
-#define BDB_PSR                          9
-#define BDB_MODE_REMOVAL_TABLE  10
-#define BDB_CHILD_DEVICE_TABLE  11
-#define BDB_DRIVER_FEATURES     12
-#define BDB_DRIVER_PERSISTENCE  13
-#define BDB_EXT_TABLE_PTRS      14
-#define BDB_DOT_CLOCK_OVERRIDE  15
-#define BDB_DISPLAY_SELECT      16
-/* 17 rsvd */
-#define BDB_DRIVER_ROTATION     18
-#define BDB_DISPLAY_REMOVE      19
-#define BDB_OEM_CUSTOM          20
-#define BDB_EFP_LIST            21 /* workarounds for VGA hsync/vsync */
-#define BDB_SDVO_LVDS_OPTIONS   22
-#define BDB_SDVO_PANEL_DTDS     23
-#define BDB_SDVO_LVDS_PNP_IDS   24
-#define BDB_SDVO_LVDS_POWER_SEQ         25
-#define BDB_TV_OPTIONS          26
-#define BDB_EDP                         27
-#define BDB_LVDS_OPTIONS        40
-#define BDB_LVDS_LFP_DATA_PTRS  41
-#define BDB_LVDS_LFP_DATA       42
-#define BDB_LVDS_BACKLIGHT      43
-#define BDB_LVDS_POWER          44
-#define BDB_MIPI_CONFIG                 52
-#define BDB_MIPI_SEQUENCE       53
-#define BDB_SKIP               254 /* VBIOS private block, ignore */
+enum bdb_block_id {
+       BDB_GENERAL_FEATURES            = 1,
+       BDB_GENERAL_DEFINITIONS         = 2,
+       BDB_OLD_TOGGLE_LIST             = 3,
+       BDB_MODE_SUPPORT_LIST           = 4,
+       BDB_GENERIC_MODE_TABLE          = 5,
+       BDB_EXT_MMIO_REGS               = 6,
+       BDB_SWF_IO                      = 7,
+       BDB_SWF_MMIO                    = 8,
+       BDB_PSR                         = 9,
+       BDB_MODE_REMOVAL_TABLE          = 10,
+       BDB_CHILD_DEVICE_TABLE          = 11,
+       BDB_DRIVER_FEATURES             = 12,
+       BDB_DRIVER_PERSISTENCE          = 13,
+       BDB_EXT_TABLE_PTRS              = 14,
+       BDB_DOT_CLOCK_OVERRIDE          = 15,
+       BDB_DISPLAY_SELECT              = 16,
+       BDB_DRIVER_ROTATION             = 18,
+       BDB_DISPLAY_REMOVE              = 19,
+       BDB_OEM_CUSTOM                  = 20,
+       BDB_EFP_LIST                    = 21, /* workarounds for VGA hsync/vsync */
+       BDB_SDVO_LVDS_OPTIONS           = 22,
+       BDB_SDVO_PANEL_DTDS             = 23,
+       BDB_SDVO_LVDS_PNP_IDS           = 24,
+       BDB_SDVO_LVDS_POWER_SEQ         = 25,
+       BDB_TV_OPTIONS                  = 26,
+       BDB_EDP                         = 27,
+       BDB_LVDS_OPTIONS                = 40,
+       BDB_LVDS_LFP_DATA_PTRS          = 41,
+       BDB_LVDS_LFP_DATA               = 42,
+       BDB_LVDS_BACKLIGHT              = 43,
+       BDB_LVDS_POWER                  = 44,
+       BDB_MIPI_CONFIG                 = 52,
+       BDB_MIPI_SEQUENCE               = 53,
+       BDB_SKIP                        = 254, /* VBIOS private block, ignore */
+};
 
 /*
  * Block 1 - General Bit Definitions