32 IN OC_GLOBAL_CONFIG *Config
39 OC_ASSOC *PropertyMap;
40 CHAR8 *AsciiDevicePath;
41 CHAR16 *UnicodeDevicePath;
43 CHAR16 *UnicodeProperty;
44 EFI_DEVICE_PATH_PROTOCOL *DevicePath;
48 if (PropertyDatabase == NULL) {
49 DEBUG ((DEBUG_ERROR,
"OC: Device property database protocol is missing\n"));
53 for (DeviceIndex = 0; DeviceIndex < Config->DeviceProperties.Delete.Count; ++DeviceIndex) {
54 AsciiDevicePath =
OC_BLOB_GET (Config->DeviceProperties.Delete.Keys[DeviceIndex]);
58 if (UnicodeDevicePath != NULL) {
59 DevicePath = ConvertTextToDevicePath (UnicodeDevicePath);
60 FreePool (UnicodeDevicePath);
63 if (DevicePath == NULL) {
64 DEBUG ((DEBUG_WARN,
"OC: Failed to parse %a device path\n", AsciiDevicePath));
68 for (PropertyIndex = 0; PropertyIndex < Config->DeviceProperties.Delete.Values[DeviceIndex]->Count; ++PropertyIndex) {
69 AsciiProperty =
OC_BLOB_GET (Config->DeviceProperties.Delete.Values[DeviceIndex]->Values[PropertyIndex]);
73 if (AsciiProperty[0] ==
'#') {
74 DEBUG ((DEBUG_INFO,
"OC: Device property skip deleting %a\n", AsciiProperty));
80 if (UnicodeProperty == NULL) {
81 DEBUG ((DEBUG_WARN,
"OC: Failed to convert %a property\n", AsciiProperty));
92 EFI_ERROR (Status) && Status != EFI_NOT_FOUND ? DEBUG_WARN : DEBUG_INFO,
93 "OC: Removing devprop %a:%a - %r\n",
99 FreePool (UnicodeProperty);
102 FreePool (DevicePath);
105 for (DeviceIndex = 0; DeviceIndex < Config->DeviceProperties.Add.Count; ++DeviceIndex) {
106 PropertyMap = Config->DeviceProperties.Add.Values[DeviceIndex];
107 AsciiDevicePath =
OC_BLOB_GET (Config->DeviceProperties.Add.Keys[DeviceIndex]);
111 if (UnicodeDevicePath != NULL) {
112 DevicePath = ConvertTextToDevicePath (UnicodeDevicePath);
113 FreePool (UnicodeDevicePath);
116 if (DevicePath == NULL) {
117 DEBUG ((DEBUG_WARN,
"OC: Failed to parse %a device path\n", AsciiDevicePath));
121 for (PropertyIndex = 0; PropertyIndex < PropertyMap->Count; ++PropertyIndex) {
122 AsciiProperty =
OC_BLOB_GET (PropertyMap->Keys[PropertyIndex]);
124 if (UnicodeProperty == NULL) {
125 DEBUG ((DEBUG_WARN,
"OC: Failed to convert %a property\n", AsciiProperty));
138 if (Status != EFI_BUFFER_TOO_SMALL) {
144 PropertyMap->Values[PropertyIndex]->Size
148 EFI_ERROR (Status) ? DEBUG_WARN : DEBUG_INFO,
149 "OC: Setting devprop %a:%a - %r\n",
157 "OC: Setting devprop %a:%a - ignored, exists\n",
163 FreePool (UnicodeProperty);
166 FreePool (DevicePath);