~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/platform_data/x86/simatic-ipc.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0 */
  2 /*
  3  * Siemens SIMATIC IPC drivers
  4  *
  5  * Copyright (c) Siemens AG, 2018-2023
  6  *
  7  * Authors:
  8  *  Henning Schild <henning.schild@siemens.com>
  9  *  Gerd Haeussler <gerd.haeussler.ext@siemens.com>
 10  */
 11 
 12 #ifndef __PLATFORM_DATA_X86_SIMATIC_IPC_H
 13 #define __PLATFORM_DATA_X86_SIMATIC_IPC_H
 14 
 15 #include <linux/dmi.h>
 16 #include <linux/platform_data/x86/simatic-ipc-base.h>
 17 
 18 #define SIMATIC_IPC_DMI_ENTRY_OEM       129
 19 /* binary type */
 20 #define SIMATIC_IPC_DMI_TYPE            0xff
 21 #define SIMATIC_IPC_DMI_GROUP           0x05
 22 #define SIMATIC_IPC_DMI_ENTRY           0x02
 23 #define SIMATIC_IPC_DMI_TID             0x02
 24 
 25 enum simatic_ipc_station_ids {
 26         SIMATIC_IPC_INVALID_STATION_ID = 0,
 27         SIMATIC_IPC_IPC227D = 0x00000501,
 28         SIMATIC_IPC_IPC427D = 0x00000701,
 29         SIMATIC_IPC_IPC227E = 0x00000901,
 30         SIMATIC_IPC_IPC277E = 0x00000902,
 31         SIMATIC_IPC_IPC427E = 0x00000A01,
 32         SIMATIC_IPC_IPC477E = 0x00000A02,
 33         SIMATIC_IPC_IPC127E = 0x00000D01,
 34         SIMATIC_IPC_IPC227G = 0x00000F01,
 35         SIMATIC_IPC_IPC277G = 0x00000F02,
 36         SIMATIC_IPC_IPCBX_39A = 0x00001001,
 37         SIMATIC_IPC_IPCPX_39A = 0x00001002,
 38         SIMATIC_IPC_IPCBX_21A = 0x00001101,
 39         SIMATIC_IPC_IPCBX_56A = 0x00001201,
 40         SIMATIC_IPC_IPCBX_59A = 0x00001202,
 41 };
 42 
 43 static inline u32 simatic_ipc_get_station_id(u8 *data, int max_len)
 44 {
 45         struct {
 46                 u8      type;           /* type (0xff = binary) */
 47                 u8      len;            /* len of data entry */
 48                 u8      group;
 49                 u8      entry;
 50                 u8      tid;
 51                 __le32  station_id;     /* station id (LE) */
 52         } __packed * data_entry = (void *)data + sizeof(struct dmi_header);
 53 
 54         while ((u8 *)data_entry < data + max_len) {
 55                 if (data_entry->type == SIMATIC_IPC_DMI_TYPE &&
 56                     data_entry->len == sizeof(*data_entry) &&
 57                     data_entry->group == SIMATIC_IPC_DMI_GROUP &&
 58                     data_entry->entry == SIMATIC_IPC_DMI_ENTRY &&
 59                     data_entry->tid == SIMATIC_IPC_DMI_TID) {
 60                         return le32_to_cpu(data_entry->station_id);
 61                 }
 62                 data_entry = (void *)((u8 *)(data_entry) + data_entry->len);
 63         }
 64 
 65         return SIMATIC_IPC_INVALID_STATION_ID;
 66 }
 67 
 68 static inline void
 69 simatic_ipc_find_dmi_entry_helper(const struct dmi_header *dh, void *_data)
 70 {
 71         u32 *id = _data;
 72 
 73         if (dh->type != SIMATIC_IPC_DMI_ENTRY_OEM)
 74                 return;
 75 
 76         *id = simatic_ipc_get_station_id((u8 *)dh, dh->length);
 77 }
 78 
 79 #endif /* __PLATFORM_DATA_X86_SIMATIC_IPC_H */
 80 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php