merge mainline into cbi
This commit is contained in:
commit
d68538e928
699 changed files with 77518 additions and 15443 deletions
|
@ -24,6 +24,8 @@
|
|||
#include <grub/scsicmd.h>
|
||||
#include <grub/misc.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
#define GRUB_USBMS_DIRECTION_BIT 7
|
||||
|
||||
/* Length of CBI command should be always 12 bytes */
|
||||
|
@ -109,7 +111,11 @@ grub_usbms_cbi_reset (grub_usb_device_t dev, int interface)
|
|||
static grub_err_t
|
||||
grub_usbms_bo_reset (grub_usb_device_t dev, int interface)
|
||||
{
|
||||
return grub_usb_control_msg (dev, 0x21, 255, 0, interface, 0, 0);
|
||||
grub_usb_err_t u;
|
||||
u = grub_usb_control_msg (dev, 0x21, 255, 0, interface, 0, 0);
|
||||
if (u)
|
||||
return grub_error (GRUB_ERR_IO, "USB error %d", u);
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
|
@ -259,16 +265,20 @@ grub_usbms_attach (grub_usb_device_t usbdev, int configno, int interfno)
|
|||
|
||||
|
||||
static int
|
||||
grub_usbms_iterate (int (*hook) (int bus, int luns))
|
||||
grub_usbms_iterate (int NESTED_FUNC_ATTR (*hook) (int id, int bus, int luns),
|
||||
grub_disk_pull_t pull)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
if (pull != GRUB_DISK_PULL_NONE)
|
||||
return 0;
|
||||
|
||||
grub_usb_poll_devices ();
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE (grub_usbms_devices); i++)
|
||||
if (grub_usbms_devices[i])
|
||||
{
|
||||
if (hook (i, grub_usbms_devices[i]->luns))
|
||||
if (hook (GRUB_SCSI_SUBSYSTEM_USBMS, i, grub_usbms_devices[i]->luns))
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -584,14 +594,18 @@ grub_usbms_read (struct grub_scsi *scsi, grub_size_t cmdsize, char *cmd,
|
|||
|
||||
static grub_err_t
|
||||
grub_usbms_write (struct grub_scsi *scsi, grub_size_t cmdsize, char *cmd,
|
||||
grub_size_t size, char *buf)
|
||||
grub_size_t size, const char *buf)
|
||||
{
|
||||
return grub_usbms_transfer (scsi, cmdsize, cmd, size, buf, 1);
|
||||
return grub_usbms_transfer (scsi, cmdsize, cmd, size, (char *) buf, 1);
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_usbms_open (int devnum, struct grub_scsi *scsi)
|
||||
grub_usbms_open (int id, int devnum, struct grub_scsi *scsi)
|
||||
{
|
||||
if (id != GRUB_SCSI_SUBSYSTEM_USBMS)
|
||||
return grub_error (GRUB_ERR_UNKNOWN_DEVICE,
|
||||
"not USB Mass Storage device");
|
||||
|
||||
grub_usb_poll_devices ();
|
||||
|
||||
if (!grub_usbms_devices[devnum])
|
||||
|
@ -606,15 +620,13 @@ grub_usbms_open (int devnum, struct grub_scsi *scsi)
|
|||
|
||||
static struct grub_scsi_dev grub_usbms_dev =
|
||||
{
|
||||
.name = "usb",
|
||||
.id = GRUB_SCSI_SUBSYSTEM_USBMS,
|
||||
.iterate = grub_usbms_iterate,
|
||||
.open = grub_usbms_open,
|
||||
.read = grub_usbms_read,
|
||||
.write = grub_usbms_write
|
||||
};
|
||||
|
||||
struct grub_usb_attach_desc attach_hook =
|
||||
static struct grub_usb_attach_desc attach_hook =
|
||||
{
|
||||
.class = GRUB_USB_CLASS_MASS_STORAGE,
|
||||
.hook = grub_usbms_attach
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue