aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBin Meng2018-10-15 04:21:06 -0500
committerSimon Glass2018-11-14 11:16:27 -0600
commitf26ce03b444ac97448eca0cc58071f5fa8ffc3bd (patch)
tree618078ba11d28b94322b0e7b9f7c8a3c7b9f0369
parent8f994c860d91cb40cf1bf6b9c69aeb40d05e9343 (diff)
downloadu-boot-f26ce03b444ac97448eca0cc58071f5fa8ffc3bd.tar.gz
u-boot-f26ce03b444ac97448eca0cc58071f5fa8ffc3bd.tar.xz
u-boot-f26ce03b444ac97448eca0cc58071f5fa8ffc3bd.zip
efi_driver: blk: Switch to use platdata_auto_alloc_size for the driver data
Currently the efi block driver uses priv_auto_alloc_size for the driver data, however that's only available after the device probe phase. In order to make it accessible in an earlier phase, switch to use platdata_auto_alloc_size instead. This patch is the prerequisite for the follow up patch of DM BLK driver changes to work with EFI loader. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
-rw-r--r--lib/efi_driver/efi_block_device.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/lib/efi_driver/efi_block_device.c b/lib/efi_driver/efi_block_device.c
index 5b9c139f38..7b71b4dd2e 100644
--- a/lib/efi_driver/efi_block_device.c
+++ b/lib/efi_driver/efi_block_device.c
@@ -38,7 +38,7 @@
38 * handle handle of the controller on which this driver is installed 38 * handle handle of the controller on which this driver is installed
39 * io block io protocol proxied by this driver 39 * io block io protocol proxied by this driver
40 */ 40 */
41struct efi_blk_priv { 41struct efi_blk_platdata {
42 efi_handle_t handle; 42 efi_handle_t handle;
43 struct efi_block_io *io; 43 struct efi_block_io *io;
44}; 44};
@@ -55,8 +55,8 @@ struct efi_blk_priv {
55static ulong efi_bl_read(struct udevice *dev, lbaint_t blknr, lbaint_t blkcnt, 55static ulong efi_bl_read(struct udevice *dev, lbaint_t blknr, lbaint_t blkcnt,
56 void *buffer) 56 void *buffer)
57{ 57{
58 struct efi_blk_priv *priv = dev->priv; 58 struct efi_blk_platdata *platdata = dev_get_platdata(dev);
59 struct efi_block_io *io = priv->io; 59 struct efi_block_io *io = platdata->io;
60 efi_status_t ret; 60 efi_status_t ret;
61 61
62 EFI_PRINT("%s: read '%s', from block " LBAFU ", " LBAFU " blocks\n", 62 EFI_PRINT("%s: read '%s', from block " LBAFU ", " LBAFU " blocks\n",
@@ -84,8 +84,8 @@ static ulong efi_bl_read(struct udevice *dev, lbaint_t blknr, lbaint_t blkcnt,
84static ulong efi_bl_write(struct udevice *dev, lbaint_t blknr, lbaint_t blkcnt, 84static ulong efi_bl_write(struct udevice *dev, lbaint_t blknr, lbaint_t blkcnt,
85 const void *buffer) 85 const void *buffer)
86{ 86{
87 struct efi_blk_priv *priv = dev->priv; 87 struct efi_blk_platdata *platdata = dev_get_platdata(dev);
88 struct efi_block_io *io = priv->io; 88 struct efi_block_io *io = platdata->io;
89 efi_status_t ret; 89 efi_status_t ret;
90 90
91 EFI_PRINT("%s: write '%s', from block " LBAFU ", " LBAFU " blocks\n", 91 EFI_PRINT("%s: write '%s', from block " LBAFU ", " LBAFU " blocks\n",
@@ -135,7 +135,7 @@ static int efi_bl_bind(efi_handle_t handle, void *interface)
135 struct efi_object *obj = efi_search_obj(handle); 135 struct efi_object *obj = efi_search_obj(handle);
136 struct efi_block_io *io = interface; 136 struct efi_block_io *io = interface;
137 int disks; 137 int disks;
138 struct efi_blk_priv *priv; 138 struct efi_blk_platdata *platdata;
139 139
140 EFI_PRINT("%s: handle %p, interface %p\n", __func__, handle, io); 140 EFI_PRINT("%s: handle %p, interface %p\n", __func__, handle, io);
141 141
@@ -163,16 +163,16 @@ static int efi_bl_bind(efi_handle_t handle, void *interface)
163 return -ENOENT; 163 return -ENOENT;
164 /* Set the DM_FLAG_NAME_ALLOCED flag to avoid a memory leak */ 164 /* Set the DM_FLAG_NAME_ALLOCED flag to avoid a memory leak */
165 device_set_name_alloced(bdev); 165 device_set_name_alloced(bdev);
166 /* Allocate priv */ 166
167 platdata = dev_get_platdata(bdev);
168 platdata->handle = handle;
169 platdata->io = interface;
170
167 ret = device_probe(bdev); 171 ret = device_probe(bdev);
168 if (ret) 172 if (ret)
169 return ret; 173 return ret;
170 EFI_PRINT("%s: block device '%s' created\n", __func__, bdev->name); 174 EFI_PRINT("%s: block device '%s' created\n", __func__, bdev->name);
171 175
172 priv = bdev->priv;
173 priv->handle = handle;
174 priv->io = interface;
175
176 ret = blk_prepare_device(bdev); 176 ret = blk_prepare_device(bdev);
177 177
178 /* Create handles for the partions of the block device */ 178 /* Create handles for the partions of the block device */
@@ -193,7 +193,7 @@ U_BOOT_DRIVER(efi_blk) = {
193 .name = "efi_blk", 193 .name = "efi_blk",
194 .id = UCLASS_BLK, 194 .id = UCLASS_BLK,
195 .ops = &efi_blk_ops, 195 .ops = &efi_blk_ops,
196 .priv_auto_alloc_size = sizeof(struct efi_blk_priv), 196 .platdata_auto_alloc_size = sizeof(struct efi_blk_platdata),
197}; 197};
198 198
199/* EFI driver operators */ 199/* EFI driver operators */