freebsd_network: Add firmware_get_flags.

Needed by the MT7601U driver.
This commit is contained in:
Augustin Cavalier
2025-03-03 16:28:39 -05:00
parent 640cf189a0
commit 1f00d7e571
2 changed files with 21 additions and 9 deletions
@@ -1,23 +1,28 @@
/* /*
* Copyright 2009 Haiku Inc. All rights reserved. * Copyright 2009-2025, Haiku Inc. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
#ifndef _FBSD_COMPAT_SYS_FIRMWARE_H_ #ifndef _FBSD_COMPAT_SYS_FIRMWARE_H_
#define _FBSD_COMPAT_SYS_FIRMWARE_H_ #define _FBSD_COMPAT_SYS_FIRMWARE_H_
#define FIRMWARE_UNLOAD 0x0001
struct firmware { struct firmware {
const char* name; // system-wide name const char* name;
const void* data; // location of image const void* data;
size_t datasize; // size of image in bytes size_t datasize;
unsigned int version; // version of the image unsigned int version;
}; };
#define FIRMWARE_GET_NOWARN 0x0001
const struct firmware* firmware_get(const char*); const struct firmware* firmware_get(const char*);
void firmware_put(const struct firmware*, int); const struct firmware* firmware_get_flags(const char*, int flags);
#define FIRMWARE_UNLOAD 0x0001
void firmware_put(const struct firmware*, int flags);
#endif /* _FBSD_COMPAT_SYS_FIRMWARE_H_ */ #endif /* _FBSD_COMPAT_SYS_FIRMWARE_H_ */
@@ -45,6 +45,13 @@ getHaikuFirmwareName(const char* fbsdFirmwareName,
const struct firmware* const struct firmware*
firmware_get(const char* fbsdFirmwareName) firmware_get(const char* fbsdFirmwareName)
{
return firmware_get_flags(fbsdFirmwareName, 0);
}
const struct firmware*
firmware_get_flags(const char* fbsdFirmwareName, int flags)
{ {
char* fbsdFirmwareNameCopy = NULL; char* fbsdFirmwareNameCopy = NULL;
int fileDescriptor = -1; int fileDescriptor = -1;