Merge remote-tracking branch 'origin/master' into dev/netservices

Change-Id: I48c8cf4f03e281a5caeb9f27bf052285961529ff
This commit is contained in:
Niels Sascha Reedijk
2022-10-29 22:58:24 +01:00
7294 changed files with 12529 additions and 281209 deletions
+2
View File
@@ -144,6 +144,7 @@ typedef struct {
bool removable; /* non-zero if removable */
bool read_only; /* non-zero if read only */
bool write_once; /* non-zero if write-once */
uint32 bytes_per_physical_sector; /* physical sector size in bytes */
} device_geometry;
@@ -174,6 +175,7 @@ typedef struct {
off_t offset; /* offset (in bytes) */
off_t size; /* size (in bytes) */
int32 logical_block_size; /* logical block size of partition */
int32 physical_block_size; /* physical block size of partition */
int32 session; /* id of session */
int32 partition; /* id of partition */
char device[256]; /* path to the physical device */
+3
View File
@@ -19,6 +19,9 @@ extern "C" {
extern int pthread_getattr_np(pthread_t thread, pthread_attr_t* attr);
extern int pthread_getname_np(pthread_t thread, char* buffer, size_t length);
extern int pthread_setname_np(pthread_t thread, const char* name);
#ifdef __cplusplus
}
+2
View File
@@ -130,6 +130,7 @@ typedef struct {
bool removable; /* non-zero if removable */
bool read_only; /* non-zero if read only */
bool write_once; /* non-zero if write-once */
uint32 bytes_per_physical_sector; /* physical sector size in bytes */
} device_geometry;
enum {
@@ -151,6 +152,7 @@ typedef struct {
off_t offset; /* offset (in bytes) */
off_t size; /* size (in bytes) */
int32 logical_block_size; /* logical block size of partition */
int32 physical_block_size; /* physical block size of partition */
int32 session; /* id of session */
int32 partition; /* id of partition */
char device[256]; /* path to the physical device */
+1
View File
@@ -25,6 +25,7 @@ typedef struct partition_data {
off_t size;
off_t content_size;
uint32 block_size;
uint32 physical_block_size;
int32 child_count;
int32 index; // [sys]
uint32 status;
+6 -6
View File
@@ -232,15 +232,15 @@ enum vertical_alignment {
enum {
B_USE_DEFAULT_SPACING = -1002,
B_USE_ITEM_SPACING = -1003,
B_USE_ITEM_INSETS = -1003,
B_USE_ITEM_INSETS = B_USE_ITEM_SPACING,
B_USE_HALF_ITEM_SPACING = -1004,
B_USE_HALF_ITEM_INSETS = -1004,
B_USE_WINDOW_INSETS = -1005,
B_USE_HALF_ITEM_INSETS = B_USE_HALF_ITEM_SPACING,
B_USE_WINDOW_SPACING = -1005,
B_USE_SMALL_INSETS = -1006,
B_USE_WINDOW_INSETS = B_USE_WINDOW_SPACING,
B_USE_SMALL_SPACING = -1006,
B_USE_BIG_INSETS = -1007,
B_USE_BIG_SPACING = -1007
B_USE_SMALL_INSETS = B_USE_SMALL_SPACING,
B_USE_BIG_SPACING = -1007,
B_USE_BIG_INSETS = B_USE_BIG_SPACING,
};
+1 -1
View File
@@ -75,7 +75,7 @@ public:
void SetPort(uint16 port);
status_t SetPort(const char* service);
void SetToLinkLevel(uint8* address, size_t length);
void SetToLinkLevel(const uint8* address, size_t length);
void SetToLinkLevel(const char* name);
void SetToLinkLevel(uint32 index);
void SetLinkLevelIndex(uint32 index);
+2
View File
@@ -114,6 +114,8 @@ public:
status_t GetNextNetwork(uint32& cookie,
wireless_network& network);
status_t GetNetworks(wireless_network*& networks,
uint32& count);
status_t GetNetwork(const char* name,
wireless_network& network);
status_t GetNetwork(const BNetworkAddress& address,
+3
View File
@@ -49,6 +49,9 @@
#define PTHREAD_PRIO_INHERIT 1
#define PTHREAD_PRIO_PROTECT 2
#define PTHREAD_DESTRUCTOR_ITERATIONS 4
/* private structure */
struct __pthread_cleanup_handler {
struct __pthread_cleanup_handler *previous;
+38
View File
@@ -37,9 +37,21 @@
#include <sys/types.h>
#include <time.h>
typedef pthread_cond_t cnd_t;
typedef pthread_mutex_t mtx_t;
typedef pthread_t thrd_t;
typedef pthread_key_t tss_t;
typedef pthread_once_t once_flag;
typedef void (*tss_dtor_t)(void *);
typedef int (*thrd_start_t)(void *);
enum {
mtx_plain = 0x1,
mtx_recursive = 0x2,
mtx_timed = 0x4
};
enum {
thrd_busy = 1,
thrd_error = 2,
@@ -48,10 +60,31 @@ enum {
thrd_timedout = 5
};
#if !defined(__cplusplus) || __cplusplus < 201103L
#define thread_local _Thread_local
#endif
#define ONCE_FLAG_INIT { 0 }
#define TSS_DTOR_ITERATIONS 4
#ifdef __cplusplus
extern "C" {
#endif
void call_once(once_flag *, void (*)(void));
int cnd_broadcast(cnd_t *);
void cnd_destroy(cnd_t *);
int cnd_init(cnd_t *);
int cnd_signal(cnd_t *);
int cnd_timedwait(cnd_t *__restrict, mtx_t *__restrict __mtx,
const struct timespec *__restrict);
int cnd_wait(cnd_t *, mtx_t *__mtx);
void mtx_destroy(mtx_t *__mtx);
int mtx_init(mtx_t *__mtx, int);
int mtx_lock(mtx_t *__mtx);
int mtx_timedlock(mtx_t *__restrict __mtx,
const struct timespec *__restrict);
int mtx_trylock(mtx_t *__mtx);
int mtx_unlock(mtx_t *__mtx);
int thrd_create(thrd_t *thread, thrd_start_t, void *);
thrd_t thrd_current(void);
int thrd_detach(thrd_t);
@@ -62,6 +95,11 @@ int thrd_join(thrd_t, int *);
int thrd_sleep(const struct timespec *, struct timespec *);
void thrd_yield(void);
int tss_create(tss_t *, tss_dtor_t);
void tss_delete(tss_t);
void * tss_get(tss_t);
int tss_set(tss_t, void *);
#ifdef __cplusplus
}
#endif
+1 -1
View File
@@ -63,7 +63,7 @@ typedef struct scsi_periph_callbacks {
// informs of new size of medium
// (set to NULL if not a block device)
void (*set_capacity)(periph_device_cookie cookie, uint64 capacity,
uint32 blockSize);
uint32 blockSize, uint32 physicalBlockSize);
// *** removable devices
// called when media got changed (can be NULL if medium is not changable)
@@ -0,0 +1,36 @@
/*
* Copyright 2022, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef FS_OPS_SUPPORT_H
#define FS_OPS_SUPPORT_H
#ifndef FS_SHELL
# include <kernel.h>
# include <kernel/debug.h>
# include <dirent.h>
#else
# include "fssh_kernel_priv.h"
#endif
static struct dirent*
next_dirent(struct dirent* dirent, size_t nameLength, size_t& bufferRemaining)
{
const size_t reclen = offsetof(struct dirent, d_name) + nameLength + 1;
ASSERT(reclen <= bufferRemaining);
dirent->d_reclen = reclen;
const size_t roundedReclen = ROUNDUP(reclen, alignof(struct dirent));
if (roundedReclen >= bufferRemaining) {
bufferRemaining -= reclen;
return NULL;
}
dirent->d_reclen = roundedReclen;
bufferRemaining -= roundedReclen;
return (struct dirent*)((uint8*)dirent + roundedReclen);
}
#endif // FS_OPS_SUPPORT_H
@@ -1990,9 +1990,9 @@ typedef struct _PIXEL_CLOCK_PARAMETERS_V6
#define PIXEL_CLOCK_V6_MISC_HDMI_BPP_MASK 0x0c
#define PIXEL_CLOCK_V6_MISC_HDMI_24BPP 0x00
#define PIXEL_CLOCK_V6_MISC_HDMI_36BPP 0x04
#define PIXEL_CLOCK_V6_MISC_HDMI_36BPP_V6 0x08 //for V6, the correct defintion for 36bpp should be 2 for 36bpp(2:1)
#define PIXEL_CLOCK_V6_MISC_HDMI_36BPP_V6 0x08 //for V6, the correct definition for 36bpp should be 2 for 36bpp(2:1)
#define PIXEL_CLOCK_V6_MISC_HDMI_30BPP 0x08
#define PIXEL_CLOCK_V6_MISC_HDMI_30BPP_V6 0x04 //for V6, the correct defintion for 30bpp should be 1 for 36bpp(5:4)
#define PIXEL_CLOCK_V6_MISC_HDMI_30BPP_V6 0x04 //for V6, the correct definition for 30bpp should be 1 for 36bpp(5:4)
#define PIXEL_CLOCK_V6_MISC_HDMI_48BPP 0x0c
#define PIXEL_CLOCK_V6_MISC_REF_DIV_SRC 0x10
#define PIXEL_CLOCK_V6_MISC_GEN_DPREFCLK 0x40
@@ -3258,8 +3258,8 @@ ucMaxNBVoltageHigh: Voltage regulator dependent PWM value. High 8 bits of t
ucMinNBVoltageHigh: Voltage regulator dependent PWM value. High 8 bits of the value for the min voltage.Set this one to 0x00 if VC without PWM or no VC at all.
usInterNBVoltageLow: Voltage regulator dependent PWM value. The value makes the the voltage >=Min NB voltage but <=InterNBVoltageHigh. Set this to 0x0000 if VC without PWM or no VC at all.
usInterNBVoltageHigh: Voltage regulator dependent PWM value. The value makes the the voltage >=InterNBVoltageLow but <=Max NB voltage.Set this to 0x0000 if VC without PWM or no VC at all.
usInterNBVoltageLow: Voltage regulator dependent PWM value. The value makes the voltage >=Min NB voltage but <=InterNBVoltageHigh. Set this to 0x0000 if VC without PWM or no VC at all.
usInterNBVoltageHigh: Voltage regulator dependent PWM value. The value makes the voltage >=InterNBVoltageLow but <=Max NB voltage.Set this to 0x0000 if VC without PWM or no VC at all.
*/
@@ -4302,6 +4302,7 @@ typedef struct _ATOM_DPCD_INFO
#define ATOM_VRAM_OPERATION_FLAGS_SHIFT 30
#define ATOM_VRAM_BLOCK_NEEDS_NO_RESERVATION 0x1
#define ATOM_VRAM_BLOCK_NEEDS_RESERVATION 0x0
#define ATOM_VRAM_BLOCK_SRIOV_MSG_SHARE_RESERVATION 0x2
/***********************************************************************************/
// Structure used in VRAM_UsageByFirmwareTable
@@ -4371,7 +4372,7 @@ typedef struct _ATOM_GPIO_PIN_ASSIGNMENT
// GPIO use to control PCIE_VDDC in certain SLT board
#define PCIE_VDDC_CONTROL_GPIO_PINID 56
//from SMU7.x, if ucGPIO_ID=PP_AC_DC_SWITCH_GPIO_PINID in GPIO_LUTTable, AC/DC swithing feature is enable
//from SMU7.x, if ucGPIO_ID=PP_AC_DC_SWITCH_GPIO_PINID in GPIO_LUTTable, AC/DC switching feature is enable
#define PP_AC_DC_SWITCH_GPIO_PINID 60
//from SMU7.x, if ucGPIO_ID=VDDC_REGULATOR_VRHOT_GPIO_PINID in GPIO_LUTable, VRHot feature is enable
#define VDDC_VRHOT_GPIO_PINID 61
@@ -4667,7 +4668,7 @@ typedef struct _ATOM_EXTERNAL_DISPLAY_CONNECTION_INFO
UCHAR Reserved[3]; // for potential expansion
}ATOM_EXTERNAL_DISPLAY_CONNECTION_INFO;
//Related definitions, all records are differnt but they have a commond header
//Related definitions, all records are different but they have a common header
typedef struct _ATOM_COMMON_RECORD_HEADER
{
UCHAR ucRecordType; //An emun to indicate the record type
@@ -5180,11 +5181,11 @@ typedef struct _ATOM_LEAKAGE_VOLTAGE_OBJECT_V3
typedef struct _ATOM_SVID2_VOLTAGE_OBJECT_V3
{
ATOM_VOLTAGE_OBJECT_HEADER_V3 sHeader; // voltage mode = VOLTAGE_OBJ_SVID2
// 14:7 PSI0_VID
// 6 PSI0_EN
// 5 PSI1
// 4:2 load line slope trim.
// 1:0 offset trim,
// 14:7 - PSI0_VID
// 6 - PSI0_EN
// 5 - PSI1
// 4:2 - load line slope trim.
// 1:0 - offset trim,
USHORT usLoadLine_PSI;
// GPU GPIO pin Id to SVID2 regulator VRHot pin. possible value 0~31. 0 means GPIO0, 31 means GPIO31
UCHAR ucSVDGpioId; //0~31 indicate GPIO0~31
@@ -5638,7 +5639,9 @@ typedef struct _ATOM_SMU_INFO_V2_1
{
ATOM_COMMON_TABLE_HEADER asHeader;
UCHAR ucSclkEntryNum; // for potential future extend, indicate the number of ATOM_SCLK_FCW_RANGE_ENTRY_V1
UCHAR ucReserved[3];
UCHAR ucSMUVer;
UCHAR ucSharePowerSource;
UCHAR ucReserved;
ATOM_SCLK_FCW_RANGE_ENTRY_V1 asSclkFcwRangeEntry[8];
}ATOM_SMU_INFO_V2_1;
@@ -5657,6 +5660,22 @@ typedef struct _ATOM_GFX_INFO_V2_1
UCHAR max_texture_channel_caches;
}ATOM_GFX_INFO_V2_1;
typedef struct _ATOM_GFX_INFO_V2_3
{
ATOM_COMMON_TABLE_HEADER asHeader;
UCHAR GfxIpMinVer;
UCHAR GfxIpMajVer;
UCHAR max_shader_engines;
UCHAR max_tile_pipes;
UCHAR max_cu_per_sh;
UCHAR max_sh_per_se;
UCHAR max_backends_per_se;
UCHAR max_texture_channel_caches;
USHORT usHiLoLeakageThreshold;
USHORT usEdcDidtLoDpm7TableOffset; //offset of DPM7 low leakage table _ATOM_EDC_DIDT_TABLE_V1
USHORT usEdcDidtHiDpm7TableOffset; //offset of DPM7 high leakage table _ATOM_EDC_DIDT_TABLE_V1
USHORT usReserverd[3];
}ATOM_GFX_INFO_V2_3;
typedef struct _ATOM_POWER_SOURCE_OBJECT
{
@@ -7132,7 +7151,7 @@ typedef struct _ATOM_ASIC_INTERNAL_SS_INFO_V3
#define GET_COMMAND_TABLE_COMMANDSET_REVISION(TABLE_HEADER_OFFSET) (((static_cast<ATOM_COMMON_TABLE_HEADER*>(TABLE_HEADER_OFFSET))->ucTableFormatRevision )&0x3F)
#define GET_COMMAND_TABLE_PARAMETER_REVISION(TABLE_HEADER_OFFSET) (((static_cast<ATOM_COMMON_TABLE_HEADER*>(TABLE_HEADER_OFFSET))->ucTableContentRevision)&0x3F)
#else // not __cplusplus
#define GetIndexIntoMasterTable(MasterOrData, FieldName) (((char*)(&((ATOM_MASTER_LIST_OF_##MasterOrData##_TABLES*)0)->FieldName)-(char*)0)/sizeof(USHORT))
#define GetIndexIntoMasterTable(MasterOrData, FieldName) (offsetof(ATOM_MASTER_LIST_OF_##MasterOrData##_TABLES, FieldName) / sizeof(USHORT))
#define GET_COMMAND_TABLE_COMMANDSET_REVISION(TABLE_HEADER_OFFSET) ((((ATOM_COMMON_TABLE_HEADER*)TABLE_HEADER_OFFSET)->ucTableFormatRevision)&0x3F)
#define GET_COMMAND_TABLE_PARAMETER_REVISION(TABLE_HEADER_OFFSET) ((((ATOM_COMMON_TABLE_HEADER*)TABLE_HEADER_OFFSET)->ucTableContentRevision)&0x3F)
@@ -9190,7 +9209,7 @@ typedef struct _ATOM_POWERPLAY_INFO_V3
/*********************************************************************************/
#pragma pack() // BIOS data must use byte aligment
#pragma pack() // BIOS data must use byte alignment
#pragma pack(1)
@@ -9221,7 +9240,7 @@ typedef struct _ATOM_SERVICE_INFO
#pragma pack() // BIOS data must use byte aligment
#pragma pack() // BIOS data must use byte alignment
//
// AMD ACPI Table
@@ -61,13 +61,17 @@ typedef struct _ATOM_PPLIB_THERMALCONTROLLER
#define ATOM_PP_THERMALCONTROLLER_LM96163 17
#define ATOM_PP_THERMALCONTROLLER_CISLANDS 18
#define ATOM_PP_THERMALCONTROLLER_KAVERI 19
#define ATOM_PP_THERMALCONTROLLER_ICELAND 20
#define ATOM_PP_THERMALCONTROLLER_TONGA 21
#define ATOM_PP_THERMALCONTROLLER_FIJI 22
#define ATOM_PP_THERMALCONTROLLER_POLARIS10 23
#define ATOM_PP_THERMALCONTROLLER_VEGA10 24
// Thermal controller 'combo type' to use an external controller for Fan control and an internal controller for thermal.
// We probably should reserve the bit 0x80 for this use.
// To keep the number of these types low we should also use the same code for all ASICs (i.e. do not distinguish RV6xx and RV7xx Internal here).
// The driver can pick the correct internal controller based on the ASIC.
#define ATOM_PP_THERMALCONTROLLER_ADT7473_WITH_INTERNAL 0x89 // ADT7473 Fan Control + Internal Thermal Controller
#define ATOM_PP_THERMALCONTROLLER_EMC2103_WITH_INTERNAL 0x8D // EMC2103 Fan Control + Internal Thermal Controller
@@ -96,6 +100,29 @@ typedef struct _ATOM_PPLIB_FANTABLE2
USHORT usTMax; // The max temperature
} ATOM_PPLIB_FANTABLE2;
typedef struct _ATOM_PPLIB_FANTABLE3
{
ATOM_PPLIB_FANTABLE2 basicTable2;
UCHAR ucFanControlMode;
USHORT usFanPWMMax;
USHORT usFanOutputSensitivity;
} ATOM_PPLIB_FANTABLE3;
typedef struct _ATOM_PPLIB_FANTABLE4
{
ATOM_PPLIB_FANTABLE3 basicTable3;
USHORT usFanRPMMax;
} ATOM_PPLIB_FANTABLE4;
typedef struct _ATOM_PPLIB_FANTABLE5
{
ATOM_PPLIB_FANTABLE4 basicTable4;
USHORT usFanCurrentLow;
USHORT usFanCurrentHigh;
USHORT usFanRPMLow;
USHORT usFanRPMHigh;
} ATOM_PPLIB_FANTABLE5;
typedef struct _ATOM_PPLIB_EXTENDEDHEADER
{
USHORT usSize;
@@ -107,7 +134,11 @@ typedef struct _ATOM_PPLIB_EXTENDEDHEADER
USHORT usSAMUTableOffset; //points to ATOM_PPLIB_SAMU_Table
USHORT usPPMTableOffset; //points to ATOM_PPLIB_PPM_Table
USHORT usACPTableOffset; //points to ATOM_PPLIB_ACP_Table
USHORT usPowerTuneTableOffset; //points to ATOM_PPLIB_POWERTUNE_Table
/* points to ATOM_PPLIB_POWERTUNE_Table */
USHORT usPowerTuneTableOffset;
/* points to ATOM_PPLIB_CLOCK_Voltage_Dependency_Table for sclkVddgfxTable */
USHORT usSclkVddgfxTableOffset;
USHORT usVQBudgetingTableOffset; /* points to the vqBudgetingTable; */
} ATOM_PPLIB_EXTENDEDHEADER;
//// ATOM_PPLIB_POWERPLAYTABLE::ulPlatformCaps
@@ -135,6 +166,10 @@ typedef struct _ATOM_PPLIB_EXTENDEDHEADER
#define ATOM_PP_PLATFORM_CAP_VRHOT_GPIO_CONFIGURABLE 0x00200000 // Does the driver supports VR HOT GPIO Configurable.
#define ATOM_PP_PLATFORM_CAP_TEMP_INVERSION 0x00400000 // Does the driver supports Temp Inversion feature.
#define ATOM_PP_PLATFORM_CAP_EVV 0x00800000
#define ATOM_PP_PLATFORM_COMBINE_PCC_WITH_THERMAL_SIGNAL 0x01000000
#define ATOM_PP_PLATFORM_LOAD_POST_PRODUCTION_FIRMWARE 0x02000000
#define ATOM_PP_PLATFORM_CAP_DISABLE_USING_ACTUAL_TEMPERATURE_FOR_POWER_CALC 0x04000000
#define ATOM_PP_PLATFORM_CAP_VRHOT_POLARITY_HIGH 0x08000000
typedef struct _ATOM_PPLIB_POWERPLAYTABLE
{
@@ -413,6 +448,20 @@ typedef struct _ATOM_PPLIB_SUMO_CLOCK_INFO{
ULONG rsv2[2];
}ATOM_PPLIB_SUMO_CLOCK_INFO;
typedef struct _ATOM_PPLIB_KV_CLOCK_INFO {
USHORT usEngineClockLow;
UCHAR ucEngineClockHigh;
UCHAR vddcIndex;
USHORT tdpLimit;
USHORT rsv1;
ULONG rsv2[2];
} ATOM_PPLIB_KV_CLOCK_INFO;
typedef struct _ATOM_PPLIB_CZ_CLOCK_INFO {
UCHAR index;
UCHAR rsv[3];
} ATOM_PPLIB_CZ_CLOCK_INFO;
typedef struct _ATOM_PPLIB_STATE_V2
{
//number of valid dpm levels in this state; Driver uses it to calculate the whole
@@ -657,7 +706,8 @@ typedef struct _ATOM_PPLIB_POWERTUNE_Table_V1
UCHAR revid;
ATOM_PowerTune_Table power_tune_table;
USHORT usMaximumPowerDeliveryLimit;
USHORT usReserve[7];
USHORT usTjMax;
USHORT usReserve[6];
} ATOM_PPLIB_POWERTUNE_Table_V1;
#define ATOM_PPM_A_A 1
@@ -677,6 +727,27 @@ typedef struct _ATOM_PPLIB_PPM_Table
ULONG ulTjmax;
} ATOM_PPLIB_PPM_Table;
#define VQ_DisplayConfig_NoneAWD 1
#define VQ_DisplayConfig_AWD 2
typedef struct ATOM_PPLIB_VQ_Budgeting_Record{
ULONG ulDeviceID;
ULONG ulSustainableSOCPowerLimitLow; /* in mW */
ULONG ulSustainableSOCPowerLimitHigh; /* in mW */
ULONG ulDClk;
ULONG ulEClk;
ULONG ulDispSclk;
UCHAR ucDispConfig;
} ATOM_PPLIB_VQ_Budgeting_Record;
typedef struct ATOM_PPLIB_VQ_Budgeting_Table {
UCHAR revid;
UCHAR numEntries;
ATOM_PPLIB_VQ_Budgeting_Record entries[1];
} ATOM_PPLIB_VQ_Budgeting_Table;
#pragma pack()
#endif
@@ -133,6 +133,7 @@ struct iframe {
uint64 x[20];
uint64 lr;
uint64 sp;
uint64 fp;
// exception info
uint64 esr;
@@ -170,6 +171,9 @@ static inline void arch_cpu_idle(void)
}
extern addr_t arm64_get_fp(void);
#ifdef __cplusplus
}
#endif
@@ -17,12 +17,17 @@
#define _PACKED __attribute__((packed))
#define MAX_VIRTUAL_RANGES_TO_KEEP 32
typedef struct {
uint64 phys_pgdir;
uint64 vir_pgdir;
uint64 next_pagetable;
// The virtual ranges we want to keep in the kernel.
uint32 num_virtual_ranges_to_keep;
addr_range virtual_ranges_to_keep[MAX_VIRTUAL_RANGES_TO_KEEP];
// needed for UEFI, otherwise kernel acpi support can't find ACPI root
FixedWidthPointer<void> acpi_root;
FixedWidthPointer<void> fdt;
@@ -1,4 +1,5 @@
/*
* Copyright 2022, Haiku Inc. All rights reserved.
* Copyright 2018, Jaroslaw Pelczar <[email protected]>
* Distributed under the terms of the MIT License.
*/
@@ -13,6 +14,8 @@
extern "C" {
#endif
void arm64_push_iframe(struct iframe_stack *stack, struct iframe *frame);
void arm64_pop_iframe(struct iframe_stack *stack);
static inline Thread * arch_thread_get_current_thread(void)
{
@@ -1,4 +1,5 @@
/*
* Copyright 2022, Haiku Inc. All rights reserved.
* Copyright 2018, Jaroslaw Pelczar <[email protected]>
* Distributed under the terms of the MIT License.
*/
@@ -8,10 +9,20 @@
#include <kernel.h>
#define IFRAME_TRACE_DEPTH 4
struct iframe_stack {
struct iframe *frames[IFRAME_TRACE_DEPTH];
int32 index;
};
struct arch_thread {
uint64 regs[13]; // x19-x30, sp
uint64 fp_regs[8]; // d8-d15
// used to track interrupts on this thread
struct iframe_stack iframes;
};
struct arch_team {
@@ -122,6 +122,9 @@
// K8 MSR registers
#define K8_MSR_IPM 0xc0010055
#define MSR_F10H_DE_CFG 0xc0011029
#define DE_CFG_SERIALIZE_LFENCE (1 << 1)
// Hardware P-States MSR registers §14.4.1
// reference https://software.intel.com/content/dam/develop/public/us/en/documents/253669-sdm-vol-3b.pdf
@@ -18,14 +18,12 @@
#ifdef _BOOT_MODE
#ifdef _BOOT_PLATFORM_BIOS
#define KERNEL_LOAD_BASE_32_BIT 0x80000000
#define KERNEL_LOAD_BASE_64_BIT 0xffffffff80000000ll
#define KERNEL_FIXUP_FOR_LONG_MODE (KERNEL_LOAD_BASE_64_BIT - KERNEL_LOAD_BASE_32_BIT)
#elif defined(__x86_64__)
#if defined(__x86_64__)
#define KERNEL_LOAD_BASE 0xffffffff80000000ll
#else
#define KERNEL_LOAD_BASE 0x80000000
#define KERNEL_LOAD_BASE 0x80000000
#define KERNEL_LOAD_BASE_64_BIT 0xffffffff80000000ll
#define KERNEL_FIXUP_FOR_LONG_MODE (KERNEL_LOAD_BASE_64_BIT - KERNEL_LOAD_BASE)
#endif
#elif defined(__x86_64__)
@@ -70,6 +70,9 @@ public:
void SetBlockSize(uint32 blockSize);
uint32 BlockSize() const;
void SetPhysicalBlockSize(uint32 blockSize);
uint32 PhysicalBlockSize() const;
void SetIndex(int32 index);
int32 Index() const; // 0 for devices
+1
View File
@@ -32,6 +32,7 @@ extern status_t load_module(const char *path, module_info ***_modules);
extern status_t module_init(struct kernel_args *args);
extern status_t module_init_post_threads(void);
extern status_t module_init_post_boot_device(bool bootingFromBootLoaderVolume);
extern status_t module_get_path(const char* moduleName, char** path);
#ifdef __cplusplus
}
+3 -2
View File
@@ -1,6 +1,6 @@
/*
* Copyright 2003-2004, Axel Dörfler, [email protected].
* Copyright 2004-2018, Haiku, Inc. All rights reserved.
* Copyright 2003-2022, Axel Dörfler, [email protected].
* Copyright 2004-2022, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _KERNEL_UTIL_KERNEL_CPP_H
@@ -36,6 +36,7 @@ extern void* operator new(size_t size, const mynothrow_t &) _NOEXCEPT;
extern void* operator new[](size_t size, const mynothrow_t &) _NOEXCEPT;
extern void operator delete(void *ptr) _NOEXCEPT;
extern void operator delete[](void *ptr) _NOEXCEPT;
extern void operator delete(void *ptr, const std::nothrow_t &) _NOEXCEPT;
#if __cplusplus >= 201402L
extern void operator delete(void* ptr, std::size_t) _NOEXCEPT;
@@ -94,6 +94,9 @@ status_t __pthread_init_creation_attributes(
void __pthread_set_default_priority(int32 priority);
status_t __pthread_mutex_lock(pthread_mutex_t* mutex, bigtime_t timeout);
int __pthread_getname_np(pthread_t thread, char* buffer, size_t length);
int __pthread_setname_np(pthread_t thread, const char* name);
#ifdef __cplusplus
}
#endif
+43
View File
@@ -0,0 +1,43 @@
/*
* Copyright 2022, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _SCOPE_EXIT_H
#define _SCOPE_EXIT_H
#if __cplusplus < 201103L
#error This file requires compiler support for the C++11 standard.
#endif
#include <utility>
template<typename F>
class ScopeExit
{
public:
explicit ScopeExit(F&& fn) : fFn(fn)
{
}
~ScopeExit()
{
fFn();
}
ScopeExit(ScopeExit&& other) : fFn(std::move(other.fFn))
{
}
private:
ScopeExit(const ScopeExit&);
ScopeExit& operator=(const ScopeExit&);
private:
F fFn;
};
#endif // _SCOPE_EXIT_H
+9 -7
View File
@@ -48,17 +48,19 @@ parse_intel(const char* name)
break;
}
// ignore vendor
for (; name[index] != '\0'; index++) {
if (name[index] == ' ') {
index++;
break;
}
}
// parse model
int outIndex = 0;
for (; name[index] != '\0'; index++) {
// ignore vendor
if (strncmp(&name[index], "Intel", 5) == 0) {
for (; name[index] != '\0'; index++) {
if (name[index] == ' ') {
index++;
break;
}
}
}
if (!strncmp(&name[index], "(R)", 3)) {
outIndex += strlcpy(&buffer[outIndex], "®",
sizeof(buffer) - outIndex);
+24
View File
@@ -12,6 +12,30 @@
#include "usbhdr.h"
static void
usb_get_class_info(uint8 usb_class_base_id, uint8 usb_class_sub_id, uint8 usb_class_proto_id,
char *classInfo, size_t size)
{
USB_CLASSCODETABLE *foundItem = NULL;
int i;
for (i = 0; i < (int)USB_CLASSCODETABLE_LEN; i++) {
if ((usb_class_base_id == UsbClassCodeTable[i].BaseClass)
&& (usb_class_sub_id == UsbClassCodeTable[i].SubClass)) {
foundItem = &UsbClassCodeTable[i];
if (usb_class_proto_id == UsbClassCodeTable[i].Protocol)
break;
}
}
if (foundItem) {
snprintf(classInfo, size, "%s (%s%s%s)", foundItem->BaseDesc, foundItem->SubDesc,
(foundItem->ProtocolDesc && strcmp("", foundItem->ProtocolDesc)) ? ", " : "",
foundItem->ProtocolDesc);
} else
snprintf(classInfo, size, "%s (%u:%u:%u)", "(Unknown)",
usb_class_base_id, usb_class_sub_id, usb_class_proto_id);
}
void
usb_get_vendor_info(uint16 vendorID, const char **vendorName)
{
+1 -1
View File
@@ -43,7 +43,7 @@ public:
const char* Name() const;
status_t SetName(const char* name);
const char* ContentName() const;
BString ContentName() const;
status_t SetContentName(const char* name);
const char* Type() const;
+3 -1
View File
@@ -38,6 +38,7 @@ public:
off_t Size() const;
off_t ContentSize() const; // 0 if uninitialized
uint32 BlockSize() const;
uint32 PhysicalBlockSize() const;
int32 Index() const; // 0 for devices
uint32 Status() const;
@@ -52,7 +53,8 @@ public:
uint32 Flags() const;
const char* Name() const;
const char* ContentName() const;
BString ContentName() const;
const char* RawContentName() const;
const char* Type() const; // See DiskDeviceTypes.h
const char* ContentType() const; // See DiskDeviceTypes.h
partition_id ID() const;
@@ -22,6 +22,7 @@ struct user_partition_data {
off_t size;
off_t content_size;
uint32 block_size;
uint32 physical_block_size;
uint32 status;
uint32 flags;
dev_t volume;