mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 16:08:04 +02:00
nouveau: add nv_device_uuid
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30455>
(cherry picked from commit 826d00617c)
This commit is contained in:
parent
1aad77d7ea
commit
c9b31c3971
2 changed files with 25 additions and 1 deletions
|
|
@ -704,7 +704,7 @@
|
|||
"description": "nouveau: add nv_device_uuid",
|
||||
"nominated": true,
|
||||
"nomination_type": 0,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": null,
|
||||
"notes": null
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
#ifndef NV_DEVINFO_H
|
||||
#define NV_DEVINFO_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "util/macros.h"
|
||||
|
||||
#define NVIDIA_VENDOR_ID 0x10de
|
||||
|
|
@ -46,4 +49,25 @@ struct nv_device_info {
|
|||
uint64_t bar_size_B;
|
||||
};
|
||||
|
||||
static inline void
|
||||
nv_device_uuid(const struct nv_device_info *info, uint8_t *uuid, size_t len, bool vm_bind)
|
||||
{
|
||||
uint16_t vendor_id = NVIDIA_VENDOR_ID;
|
||||
|
||||
assert(len >= 16);
|
||||
|
||||
memset(uuid, 0, len);
|
||||
memcpy(&uuid[0], &info->chipset, 2);
|
||||
memcpy(&uuid[2], &vendor_id, 2);
|
||||
memcpy(&uuid[4], &info->device_id, 2);
|
||||
|
||||
if (info->type != NV_DEVICE_TYPE_SOC) {
|
||||
memcpy(&uuid[6], &info->pci.domain, 2);
|
||||
uuid[8] = info->pci.bus;
|
||||
uuid[9] = info->pci.dev;
|
||||
uuid[10] = info->pci.func;
|
||||
}
|
||||
uuid[11] = vm_bind;
|
||||
}
|
||||
|
||||
#endif /* NV_DEVINFO_H */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue