mirror of
				https://source.denx.de/u-boot/u-boot.git
				synced 2025-10-31 08:21:36 +01:00 
			
		
		
		
	Pull request for efi-2023.04-rc5
UEFI: * Create unique device paths for USB devices with the same vendor and product id. -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEbcT5xx8ppvoGt20zxIHbvCwFGsQFAmQewugACgkQxIHbvCwF GsSLMA/+LlG5/QsfJC++3i6v1QtDNksv2VNyEXIUnane2QGj/Ch7fwoK3nKm9KOD KEOnYKONFZfiPKK1On7ITJwnhR8dsag/5x+JAsjmFc4n2TE1XqN5H0JmCc1X7Ees bB92jSlaMpYi2wZQ2CPmzTOsG9jSVOv0u+CrL3cbrIuuXmsKY8MpfDeuvHCwiEXJ w5WhAwJoS1LF6rqndHZJIczI74S3ixAQ4BhpiMxNvNdm2Vl/0A43SuxlEIU16HMz tTiwKCc0IrQg03CF8atFPfJCq4v0xF2cjBV9hn93BZiKety6YCQptdmCjyNjUnuZ mrT3Wqth6vcYmL16FIkbZl7GADMt8d5sA5daORI56qSseEVtHYmJ3RqO6ZgYebNP hQwGwVB23lGF742hB1IXvjXVeqHoIGFSDb/aI1IZ3zdZJ/OFOqSkFe8CfTLq3rR9 SB6pbxsOzL7jwi4MbcWrdByk79933XMUfr8fm+yIkqf3yhWlihnQmr6au/X27SmW veAXfQmjrPsMYFlEgVI+oFXYUKRp0McO0tLO3gNd/ROMNAs0w1f3NV5hz8dCx0Sp r4Fi+pthrG41fF8Vcc4bK6XqddXONfhZ4uOWGLoGr9lAnixw4iF6oN7lYPvBJL/T ej2zCL/vLRWawJ9OJ97uA10FFtUKla6JpD1b2JscQNWGJxspj58= =oE1C -----END PGP SIGNATURE----- Merge tag 'efi-2023.04-rc5' of https://source.denx.de/u-boot/custodians/u-boot-efi Pull request for efi-2023.04-rc5 UEFI: * Create unique device paths for USB devices with the same vendor and product id.
This commit is contained in:
		
						commit
						8be7b4629e
					
				| @ -570,6 +570,7 @@ struct efi_mac_addr { | |||||||
| #define DEVICE_PATH_TYPE_HARDWARE_DEVICE	0x01 | #define DEVICE_PATH_TYPE_HARDWARE_DEVICE	0x01 | ||||||
| #  define DEVICE_PATH_SUB_TYPE_MEMORY		0x03 | #  define DEVICE_PATH_SUB_TYPE_MEMORY		0x03 | ||||||
| #  define DEVICE_PATH_SUB_TYPE_VENDOR		0x04 | #  define DEVICE_PATH_SUB_TYPE_VENDOR		0x04 | ||||||
|  | #  define DEVICE_PATH_SUB_TYPE_CONTROLLER	0x05 | ||||||
| 
 | 
 | ||||||
| struct efi_device_path_memory { | struct efi_device_path_memory { | ||||||
| 	struct efi_device_path dp; | 	struct efi_device_path dp; | ||||||
| @ -584,6 +585,11 @@ struct efi_device_path_vendor { | |||||||
| 	u8 vendor_data[]; | 	u8 vendor_data[]; | ||||||
| } __packed; | } __packed; | ||||||
| 
 | 
 | ||||||
|  | struct efi_device_path_controller { | ||||||
|  | 	struct efi_device_path dp; | ||||||
|  | 	u32 controller_number; | ||||||
|  | } __packed; | ||||||
|  | 
 | ||||||
| #define DEVICE_PATH_TYPE_ACPI_DEVICE		0x02 | #define DEVICE_PATH_TYPE_ACPI_DEVICE		0x02 | ||||||
| #  define DEVICE_PATH_SUB_TYPE_ACPI_DEVICE	0x01 | #  define DEVICE_PATH_SUB_TYPE_ACPI_DEVICE	0x01 | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -147,7 +147,7 @@ struct efi_device_path *efi_dp_shorten(struct efi_device_path *dp) | |||||||
| 		 * in practice fallback.efi just uses MEDIA:HARD_DRIVE | 		 * in practice fallback.efi just uses MEDIA:HARD_DRIVE | ||||||
| 		 * so not sure when we would see these other cases. | 		 * so not sure when we would see these other cases. | ||||||
| 		 */ | 		 */ | ||||||
| 		if (EFI_DP_TYPE(dp, MESSAGING_DEVICE, MSG_USB_CLASS) || | 		if (EFI_DP_TYPE(dp, MESSAGING_DEVICE, MSG_USB) || | ||||||
| 		    EFI_DP_TYPE(dp, MEDIA_DEVICE, HARD_DRIVE_PATH) || | 		    EFI_DP_TYPE(dp, MEDIA_DEVICE, HARD_DRIVE_PATH) || | ||||||
| 		    EFI_DP_TYPE(dp, MEDIA_DEVICE, FILE_PATH)) | 		    EFI_DP_TYPE(dp, MEDIA_DEVICE, FILE_PATH)) | ||||||
| 			return dp; | 			return dp; | ||||||
| @ -564,6 +564,11 @@ __maybe_unused static unsigned int dp_size(struct udevice *dev) | |||||||
| 			return dp_size(dev->parent) | 			return dp_size(dev->parent) | ||||||
| 				+ sizeof(struct efi_device_path_vendor) + 1; | 				+ sizeof(struct efi_device_path_vendor) + 1; | ||||||
| #endif | #endif | ||||||
|  | #ifdef CONFIG_USB | ||||||
|  | 		case UCLASS_MASS_STORAGE: | ||||||
|  | 			return dp_size(dev->parent) | ||||||
|  | 				+ sizeof(struct efi_device_path_controller); | ||||||
|  | #endif | ||||||
| #ifdef CONFIG_VIRTIO_BLK | #ifdef CONFIG_VIRTIO_BLK | ||||||
| 		case UCLASS_VIRTIO: | 		case UCLASS_VIRTIO: | ||||||
| 			 /*
 | 			 /*
 | ||||||
| @ -585,7 +590,7 @@ __maybe_unused static unsigned int dp_size(struct udevice *dev) | |||||||
| 	case UCLASS_MASS_STORAGE: | 	case UCLASS_MASS_STORAGE: | ||||||
| 	case UCLASS_USB_HUB: | 	case UCLASS_USB_HUB: | ||||||
| 		return dp_size(dev->parent) + | 		return dp_size(dev->parent) + | ||||||
| 			sizeof(struct efi_device_path_usb_class); | 			sizeof(struct efi_device_path_usb); | ||||||
| 	default: | 	default: | ||||||
| 		/* just skip over unknown classes: */ | 		/* just skip over unknown classes: */ | ||||||
| 		return dp_size(dev->parent); | 		return dp_size(dev->parent); | ||||||
| @ -741,6 +746,19 @@ __maybe_unused static void *dp_fill(void *buf, struct udevice *dev) | |||||||
| 			memcpy(&dp->ns_id, &ns_id, sizeof(ns_id)); | 			memcpy(&dp->ns_id, &ns_id, sizeof(ns_id)); | ||||||
| 			return &dp[1]; | 			return &dp[1]; | ||||||
| 			} | 			} | ||||||
|  | #endif | ||||||
|  | #if defined(CONFIG_USB) | ||||||
|  | 		case UCLASS_MASS_STORAGE: { | ||||||
|  | 			struct blk_desc *desc = desc = dev_get_uclass_plat(dev); | ||||||
|  | 			struct efi_device_path_controller *dp = | ||||||
|  | 				dp_fill(buf, dev->parent); | ||||||
|  | 
 | ||||||
|  | 			dp->dp.type	= DEVICE_PATH_TYPE_HARDWARE_DEVICE; | ||||||
|  | 			dp->dp.sub_type = DEVICE_PATH_SUB_TYPE_CONTROLLER; | ||||||
|  | 			dp->dp.length	= sizeof(*dp); | ||||||
|  | 			dp->controller_number = desc->lun; | ||||||
|  | 			return &dp[1]; | ||||||
|  | 		} | ||||||
| #endif | #endif | ||||||
| 		default: | 		default: | ||||||
| 			debug("%s(%u) %s: unhandled parent class: %s (%u)\n", | 			debug("%s(%u) %s: unhandled parent class: %s (%u)\n", | ||||||
| @ -767,19 +785,22 @@ __maybe_unused static void *dp_fill(void *buf, struct udevice *dev) | |||||||
| #endif | #endif | ||||||
| 	case UCLASS_MASS_STORAGE: | 	case UCLASS_MASS_STORAGE: | ||||||
| 	case UCLASS_USB_HUB: { | 	case UCLASS_USB_HUB: { | ||||||
| 		struct efi_device_path_usb_class *udp = | 		struct efi_device_path_usb *udp = dp_fill(buf, dev->parent); | ||||||
| 			dp_fill(buf, dev->parent); |  | ||||||
| 		struct usb_device *udev = dev_get_parent_priv(dev); |  | ||||||
| 		struct usb_device_descriptor *desc = &udev->descriptor; |  | ||||||
| 
 | 
 | ||||||
|  | 		switch (device_get_uclass_id(dev->parent)) { | ||||||
|  | 		case UCLASS_USB_HUB: { | ||||||
|  | 			struct usb_device *udev = dev_get_parent_priv(dev); | ||||||
|  | 
 | ||||||
|  | 			udp->parent_port_number = udev->portnr; | ||||||
|  | 			break; | ||||||
|  | 		} | ||||||
|  | 		default: | ||||||
|  | 			udp->parent_port_number = 0; | ||||||
|  | 		} | ||||||
| 		udp->dp.type     = DEVICE_PATH_TYPE_MESSAGING_DEVICE; | 		udp->dp.type     = DEVICE_PATH_TYPE_MESSAGING_DEVICE; | ||||||
| 		udp->dp.sub_type = DEVICE_PATH_SUB_TYPE_MSG_USB_CLASS; | 		udp->dp.sub_type = DEVICE_PATH_SUB_TYPE_MSG_USB; | ||||||
| 		udp->dp.length   = sizeof(*udp); | 		udp->dp.length   = sizeof(*udp); | ||||||
| 		udp->vendor_id   = desc->idVendor; | 		udp->usb_interface = 0; | ||||||
| 		udp->product_id  = desc->idProduct; |  | ||||||
| 		udp->device_class    = desc->bDeviceClass; |  | ||||||
| 		udp->device_subclass = desc->bDeviceSubClass; |  | ||||||
| 		udp->device_protocol = desc->bDeviceProtocol; |  | ||||||
| 
 | 
 | ||||||
| 		return &udp[1]; | 		return &udp[1]; | ||||||
| 	} | 	} | ||||||
|  | |||||||
| @ -77,6 +77,13 @@ static char *dp_hardware(char *s, struct efi_device_path *dp) | |||||||
| 		s += sprintf(s, ")"); | 		s += sprintf(s, ")"); | ||||||
| 		break; | 		break; | ||||||
| 	} | 	} | ||||||
|  | 	case DEVICE_PATH_SUB_TYPE_CONTROLLER: { | ||||||
|  | 		struct efi_device_path_controller *cdp = | ||||||
|  | 			(struct efi_device_path_controller *)dp; | ||||||
|  | 
 | ||||||
|  | 		s += sprintf(s, "Ctrl(0x%0x)", cdp->controller_number); | ||||||
|  | 		break; | ||||||
|  | 	} | ||||||
| 	default: | 	default: | ||||||
| 		s = dp_unknown(s, dp); | 		s = dp_unknown(s, dp); | ||||||
| 		break; | 		break; | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user