Add raw1394_add_config_rom_descriptor() and raw1394_remove_config_rom_descriptor() API
This adds support of the firewire-core (juju) ABI to add and remove config ROM directories or descriptors. The raw1394 ABI supports similar requests, but for now we leave the two functions unimplemented when running on top of raw1394. Signed-off-by: Benjamin Buchalter <bj@mhlabs.com> Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> (whitespace changes)
This commit is contained in:
parent
c6753dfcc2
commit
f3c9af36c2
|
@ -519,6 +519,40 @@ int raw1394_update_config_rom(raw1394handle_t handle, const quadlet_t
|
||||||
new_rom, size, rom_version);
|
new_rom, size, rom_version);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int raw1394_add_config_rom_descriptor(raw1394handle_t handle,
|
||||||
|
const quadlet_t immediate_key,
|
||||||
|
const quadlet_t key,
|
||||||
|
const quadlet_t *new_rom_directory,
|
||||||
|
size_t size,
|
||||||
|
__u32 *out_token)
|
||||||
|
{
|
||||||
|
if (!handle) {
|
||||||
|
errno = EINVAL;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (handle->is_fw)
|
||||||
|
return fw_add_config_rom_descriptor(handle->mode.fw,
|
||||||
|
immediate_key, key, new_rom_directory, size, out_token);
|
||||||
|
else {
|
||||||
|
errno = EINVAL;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int raw1394_remove_config_rom_descriptor(raw1394handle_t handle, __u32 token)
|
||||||
|
{
|
||||||
|
if (!handle) {
|
||||||
|
errno = EINVAL;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (handle->is_fw)
|
||||||
|
return fw_remove_config_rom_descriptor(handle->mode.fw, token);
|
||||||
|
else {
|
||||||
|
errno = EINVAL;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int raw1394_get_config_rom(raw1394handle_t handle, quadlet_t *buffer,
|
int raw1394_get_config_rom(raw1394handle_t handle, quadlet_t *buffer,
|
||||||
size_t buffersize, size_t *rom_size, unsigned char *rom_version)
|
size_t buffersize, size_t *rom_size, unsigned char *rom_version)
|
||||||
{
|
{
|
||||||
|
|
35
src/fw.c
35
src/fw.c
|
@ -1542,6 +1542,41 @@ fw_update_config_rom(fw_handle_t handle, const quadlet_t *new_rom,
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
fw_add_config_rom_descriptor(fw_handle_t handle,
|
||||||
|
const quadlet_t immediate_key,
|
||||||
|
const quadlet_t key,
|
||||||
|
const quadlet_t *new_rom_directory,
|
||||||
|
size_t size,
|
||||||
|
__u32 *out_token)
|
||||||
|
{
|
||||||
|
struct fw_cdev_add_descriptor request;
|
||||||
|
int retval;
|
||||||
|
|
||||||
|
request.immediate = immediate_key;
|
||||||
|
request.key = key;
|
||||||
|
request.data = ptr_to_u64(new_rom_directory);
|
||||||
|
request.length = size;
|
||||||
|
request.handle = 0;
|
||||||
|
|
||||||
|
retval = ioctl(handle->local_device->fd, FW_CDEV_IOC_ADD_DESCRIPTOR,
|
||||||
|
&request);
|
||||||
|
if (retval < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
*out_token = request.handle;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
fw_remove_config_rom_descriptor(fw_handle_t handle, __u32 token)
|
||||||
|
{
|
||||||
|
struct fw_cdev_remove_descriptor request = {token};
|
||||||
|
|
||||||
|
return ioctl(handle->local_device->fd, FW_CDEV_IOC_REMOVE_DESCRIPTOR,
|
||||||
|
&request);
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
fw_get_config_rom(fw_handle_t handle, quadlet_t *buffer,
|
fw_get_config_rom(fw_handle_t handle, quadlet_t *buffer,
|
||||||
size_t buffersize, size_t *rom_size,
|
size_t buffersize, size_t *rom_size,
|
||||||
|
|
7
src/fw.h
7
src/fw.h
|
@ -202,6 +202,13 @@ int fw_start_fcp_listen(fw_handle_t handle);
|
||||||
int fw_stop_fcp_listen(fw_handle_t handle);
|
int fw_stop_fcp_listen(fw_handle_t handle);
|
||||||
int fw_update_config_rom(fw_handle_t handle, const quadlet_t *new_rom,
|
int fw_update_config_rom(fw_handle_t handle, const quadlet_t *new_rom,
|
||||||
size_t size, unsigned char rom_version);
|
size_t size, unsigned char rom_version);
|
||||||
|
int fw_add_config_rom_descriptor(fw_handle_t handle,
|
||||||
|
const quadlet_t immediate_key,
|
||||||
|
const quadlet_t key,
|
||||||
|
const quadlet_t *new_rom_directory,
|
||||||
|
size_t size,
|
||||||
|
__u32 *out_token);
|
||||||
|
int fw_remove_config_rom_descriptor(fw_handle_t handle, __u32 token);
|
||||||
int fw_get_config_rom(fw_handle_t handle, quadlet_t *buffer,
|
int fw_get_config_rom(fw_handle_t handle, quadlet_t *buffer,
|
||||||
size_t buffersize, size_t *rom_size,
|
size_t buffersize, size_t *rom_size,
|
||||||
unsigned char *rom_version);
|
unsigned char *rom_version);
|
||||||
|
|
|
@ -1165,6 +1165,15 @@ const char *raw1394_get_libversion(void);
|
||||||
int raw1394_update_config_rom(raw1394handle_t handle, const quadlet_t
|
int raw1394_update_config_rom(raw1394handle_t handle, const quadlet_t
|
||||||
*new_rom, size_t size, unsigned char rom_version);
|
*new_rom, size_t size, unsigned char rom_version);
|
||||||
|
|
||||||
|
int raw1394_add_config_rom_descriptor(raw1394handle_t handle,
|
||||||
|
const quadlet_t immediate_key,
|
||||||
|
const quadlet_t key,
|
||||||
|
const quadlet_t *new_rom_directory,
|
||||||
|
size_t size,
|
||||||
|
u_int32_t *out_token);
|
||||||
|
|
||||||
|
int raw1394_remove_config_rom_descriptor(raw1394handle_t handle,
|
||||||
|
u_int32_t token);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* raw1394_get_config_rom - reads the current version of the configuration ROM of a host
|
* raw1394_get_config_rom - reads the current version of the configuration ROM of a host
|
||||||
|
|
Reference in New Issue