mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-24 13:43:28 +00:00
arm: apple: rtkit: Add default buffer handlers
For devices without specific buffer methods, just assume we can give them raw memory pointers when they request a buffer. Signed-off-by: Hector Martin <marcan@marcan.st>
This commit is contained in:
parent
7c631d3d33
commit
92e8fd4ec2
1 changed files with 14 additions and 1 deletions
|
@ -96,6 +96,13 @@ void apple_rtkit_free(struct apple_rtkit *rtk)
|
|||
rtk->shmem_destroy(rtk->cookie, &rtk->crashlog_buffer);
|
||||
if (rtk->ioreport_buffer.buffer)
|
||||
rtk->shmem_destroy(rtk->cookie, &rtk->ioreport_buffer);
|
||||
} else {
|
||||
if (rtk->syslog_buffer.buffer)
|
||||
free(rtk->syslog_buffer.buffer);
|
||||
if (rtk->crashlog_buffer.buffer)
|
||||
free(rtk->crashlog_buffer.buffer);
|
||||
if (rtk->ioreport_buffer.buffer)
|
||||
free(rtk->ioreport_buffer.buffer);
|
||||
}
|
||||
free(rtk);
|
||||
}
|
||||
|
@ -130,7 +137,7 @@ static int rtkit_handle_buf_req(struct apple_rtkit *rtk, int endpoint, struct ap
|
|||
|
||||
buf->dva = FIELD_GET(APPLE_RTKIT_BUFFER_REQUEST_IOVA, msg->msg0);
|
||||
buf->size = num_4kpages << 12;
|
||||
buf->is_mapped = false;
|
||||
buf->is_mapped = !!buf->dva;
|
||||
|
||||
if (rtk->shmem_setup) {
|
||||
ret = rtk->shmem_setup(rtk->cookie, buf);
|
||||
|
@ -139,6 +146,12 @@ static int rtkit_handle_buf_req(struct apple_rtkit *rtk, int endpoint, struct ap
|
|||
endpoint);
|
||||
return ret;
|
||||
}
|
||||
} else if (!buf->is_mapped){
|
||||
buf->buffer = memalign(SZ_16K, ALIGN(buf->size, SZ_16K));
|
||||
if (!buf->buffer)
|
||||
return -ENOMEM;
|
||||
|
||||
buf->dva = (u64)buf->buffer;
|
||||
}
|
||||
|
||||
if (!buf->is_mapped) {
|
||||
|
|
Loading…
Reference in a new issue