diff options
author | Angel Pons <th3fanbus@gmail.com> | 2021-08-27 10:34:05 +0200 |
---|---|---|
committer | Felix Held <felix-coreboot@felixheld.de> | 2021-08-31 15:15:58 +0000 |
commit | be2e2bbba56370501ca054da39d0048a6bfcab7d (patch) | |
tree | a5d79b4dfb033614e953450ba58f02efada75253 | |
parent | e8982d1be84c0ed8d07d8c7d1db11535349c7682 (diff) |
smbios.c: Move function definition near call-site
The `smbios_get_device_type_from_dev()` function is only called once
from the `smbios_walk_device_tree_type41()` function. Put the former
function's definition above the latter function's, instead of having
them a thousand lines apart.
Change-Id: Idc6175324ca8a14841eaf7d6904712efb75f2d26
Signed-off-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/57205
Reviewed-by: Christian Walter <christian.walter@9elements.com>
Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
-rw-r--r-- | src/arch/x86/smbios.c | 70 |
1 files changed, 35 insertions, 35 deletions
diff --git a/src/arch/x86/smbios.c b/src/arch/x86/smbios.c index ee8014943f..0af149e6aa 100644 --- a/src/arch/x86/smbios.c +++ b/src/arch/x86/smbios.c @@ -37,41 +37,6 @@ static u8 smbios_checksum(u8 *p, u32 length) return -ret; } -/* Get the device type 41 from the dev struct */ -static u8 smbios_get_device_type_from_dev(struct device *dev) -{ - u16 pci_basesubclass = (dev->class >> 8) & 0xFFFF; - - switch (pci_basesubclass) { - case PCI_CLASS_NOT_DEFINED: - return SMBIOS_DEVICE_TYPE_OTHER; - case PCI_CLASS_DISPLAY_VGA: - case PCI_CLASS_DISPLAY_XGA: - case PCI_CLASS_DISPLAY_3D: - case PCI_CLASS_DISPLAY_OTHER: - return SMBIOS_DEVICE_TYPE_VIDEO; - case PCI_CLASS_STORAGE_SCSI: - return SMBIOS_DEVICE_TYPE_SCSI; - case PCI_CLASS_NETWORK_ETHERNET: - return SMBIOS_DEVICE_TYPE_ETHERNET; - case PCI_CLASS_NETWORK_TOKEN_RING: - return SMBIOS_DEVICE_TYPE_TOKEN_RING; - case PCI_CLASS_MULTIMEDIA_VIDEO: - case PCI_CLASS_MULTIMEDIA_AUDIO: - case PCI_CLASS_MULTIMEDIA_PHONE: - case PCI_CLASS_MULTIMEDIA_OTHER: - return SMBIOS_DEVICE_TYPE_SOUND; - case PCI_CLASS_STORAGE_ATA: - return SMBIOS_DEVICE_TYPE_PATA; - case PCI_CLASS_STORAGE_SATA: - return SMBIOS_DEVICE_TYPE_SATA; - case PCI_CLASS_STORAGE_SAS: - return SMBIOS_DEVICE_TYPE_SAS; - default: - return SMBIOS_DEVICE_TYPE_UNKNOWN; - } -} - int smbios_add_string(u8 *start, const char *str) { int i = 1; @@ -1130,6 +1095,41 @@ static int smbios_write_type127(unsigned long *current, int handle) return len; } +/* Get the device type 41 from the dev struct */ +static u8 smbios_get_device_type_from_dev(struct device *dev) +{ + u16 pci_basesubclass = (dev->class >> 8) & 0xFFFF; + + switch (pci_basesubclass) { + case PCI_CLASS_NOT_DEFINED: + return SMBIOS_DEVICE_TYPE_OTHER; + case PCI_CLASS_DISPLAY_VGA: + case PCI_CLASS_DISPLAY_XGA: + case PCI_CLASS_DISPLAY_3D: + case PCI_CLASS_DISPLAY_OTHER: + return SMBIOS_DEVICE_TYPE_VIDEO; + case PCI_CLASS_STORAGE_SCSI: + return SMBIOS_DEVICE_TYPE_SCSI; + case PCI_CLASS_NETWORK_ETHERNET: + return SMBIOS_DEVICE_TYPE_ETHERNET; + case PCI_CLASS_NETWORK_TOKEN_RING: + return SMBIOS_DEVICE_TYPE_TOKEN_RING; + case PCI_CLASS_MULTIMEDIA_VIDEO: + case PCI_CLASS_MULTIMEDIA_AUDIO: + case PCI_CLASS_MULTIMEDIA_PHONE: + case PCI_CLASS_MULTIMEDIA_OTHER: + return SMBIOS_DEVICE_TYPE_SOUND; + case PCI_CLASS_STORAGE_ATA: + return SMBIOS_DEVICE_TYPE_PATA; + case PCI_CLASS_STORAGE_SATA: + return SMBIOS_DEVICE_TYPE_SATA; + case PCI_CLASS_STORAGE_SAS: + return SMBIOS_DEVICE_TYPE_SAS; + default: + return SMBIOS_DEVICE_TYPE_UNKNOWN; + } +} + /* Generate Type41 entries from devicetree */ static int smbios_walk_device_tree_type41(struct device *dev, int *handle, unsigned long *current) |