kernel/int: consolidate interrupt vector number to int32

This is no-op for 32 bit platforms because `int32` is defined as `long` there.

Change interrupt vector number from 64 bits to 32 bits for 64 bit platforms.

Change-Id: I52d1ad616cab16488804e9733c7afaf772a670ba
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7507
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
This commit is contained in:
X512 2024-03-06 01:45:48 +09:00 committed by Alex von Gluck IV
parent 0e703d1f1e
commit 02463fb461
26 changed files with 93 additions and 93 deletions

View File

@ -168,9 +168,9 @@ extern void release_write_seqlock(seqlock* lock);
extern uint32 acquire_read_seqlock(seqlock* lock);
extern bool release_read_seqlock(seqlock* lock, uint32 count);
extern status_t install_io_interrupt_handler(long interrupt_number,
interrupt_handler handler, void *data, ulong flags);
extern status_t remove_io_interrupt_handler(long interrupt_number,
extern status_t install_io_interrupt_handler(int32 interrupt_number,
interrupt_handler handler, void *data, uint32 flags);
extern status_t remove_io_interrupt_handler(int32 interrupt_number,
interrupt_handler handler, void *data);
extern status_t add_timer(timer *t, timer_hook hook, bigtime_t period,

View File

@ -30,9 +30,9 @@ status_t arch_int_init_post_device_manager(struct kernel_args* args);
void arch_int_enable_interrupts(void);
int arch_int_disable_interrupts(void);
void arch_int_restore_interrupts(int oldState);
void arch_int_enable_io_interrupt(int irq);
void arch_int_disable_io_interrupt(int irq);
void arch_int_configure_io_interrupt(int irq, uint32 config);
void arch_int_enable_io_interrupt(int32 irq);
void arch_int_disable_io_interrupt(int32 irq);
void arch_int_configure_io_interrupt(int32 irq, uint32 config);
bool arch_int_are_interrupts_enabled(void);
int32 arch_int_assign_to_cpu(int32 irq, int32 cpu);

View File

@ -79,7 +79,7 @@ typedef struct interrupt_controller_s {
} interrupt_controller;
void x86_set_irq_source(int irq, irq_source source);
void x86_set_irq_source(int32 irq, irq_source source);
void arch_int_set_interrupt_controller(const interrupt_controller &controller);

View File

@ -77,12 +77,12 @@ are_interrupts_enabled(void)
#define restore_interrupts(status) arch_int_restore_interrupts(status)
status_t reserve_io_interrupt_vectors(long count, long startVector,
status_t reserve_io_interrupt_vectors(int32 count, int32 startVector,
enum interrupt_type type);
status_t allocate_io_interrupt_vectors(long count, long *startVector,
status_t allocate_io_interrupt_vectors(int32 count, int32 *startVector,
enum interrupt_type type);
void free_io_interrupt_vectors(long count, long startVector);
void free_io_interrupt_vectors(int32 count, int32 startVector);
void assign_io_interrupt_to_cpu(long vector, int32 cpu);
void assign_io_interrupt_to_cpu(int32 vector, int32 cpu);
#endif /* _KERNEL_INT_H */

View File

@ -179,7 +179,7 @@ private:
uint32 fAllocatedMsiIrqs[1];
phys_addr_t fMsiPhysAddr {};
long fMsiStartIrq {};
int32 fMsiStartIrq {};
uint64 fMsiData {};
};

View File

@ -46,7 +46,7 @@ MsiInterruptCtrlDW::Init(PciDbiRegs volatile* dbiRegs, int32 msiIrq)
msi_set_interface(static_cast<MSIInterface*>(this));
dprintf(" fMsiStartIrq: %ld\n", fMsiStartIrq);
dprintf(" fMsiStartIrq: %" B_PRId32 "\n", fMsiStartIrq);
return B_OK;
}

View File

@ -70,9 +70,9 @@ struct iframe_stack gBootFrameStack;
void
arch_int_enable_io_interrupt(int irq)
arch_int_enable_io_interrupt(int32 irq)
{
TRACE("arch_int_enable_io_interrupt(%d)\n", irq);
TRACE("arch_int_enable_io_interrupt(%" B_PRId32 ")\n", irq);
InterruptController *ic = InterruptController::Get();
if (ic != NULL)
ic->EnableInterrupt(irq);
@ -80,9 +80,9 @@ arch_int_enable_io_interrupt(int irq)
void
arch_int_disable_io_interrupt(int irq)
arch_int_disable_io_interrupt(int32 irq)
{
TRACE("arch_int_disable_io_interrupt(%d)\n", irq);
TRACE("arch_int_disable_io_interrupt(%" B_PRId32 ")\n", irq);
InterruptController *ic = InterruptController::Get();
if (ic != NULL)
ic->DisableInterrupt(irq);

View File

@ -54,7 +54,7 @@ GICv2InterruptController::GICv2InterruptController(uint32_t gicd_addr, uint32_t
}
void GICv2InterruptController::EnableInterrupt(int irq)
void GICv2InterruptController::EnableInterrupt(int32 irq)
{
uint32_t ena_reg = GICD_REG_ISENABLER + irq / 32;
uint32_t ena_val = 1 << (irq % 32);
@ -67,7 +67,7 @@ void GICv2InterruptController::EnableInterrupt(int irq)
}
void GICv2InterruptController::DisableInterrupt(int irq)
void GICv2InterruptController::DisableInterrupt(int32 irq)
{
fGicdRegs[GICD_REG_ICENABLER + irq / 32] = 1 << (irq % 32);
}

View File

@ -12,8 +12,8 @@
class GICv2InterruptController : public InterruptController {
public:
GICv2InterruptController(uint32_t gicd_regs = 0, uint32_t gicc_regs = 0);
void EnableInterrupt(int irq);
void DisableInterrupt(int irq);
void EnableInterrupt(int32 irq);
void DisableInterrupt(int32 irq);
void HandleInterrupt();
private:
volatile uint32_t *fGicdRegs;

View File

@ -11,8 +11,8 @@ class InterruptController;
class InterruptController {
public:
virtual void EnableInterrupt(int irq) = 0;
virtual void DisableInterrupt(int irq) = 0;
virtual void EnableInterrupt(int32 irq) = 0;
virtual void DisableInterrupt(int32 irq) = 0;
virtual void HandleInterrupt() = 0;

View File

@ -27,7 +27,7 @@ enum {
void
OMAP3InterruptController::EnableInterrupt(int irq)
OMAP3InterruptController::EnableInterrupt(int32 irq)
{
uint32 bit = irq % 32, bank = irq / 32;
fRegBase[INTCPS_MIR_CLEARn + (8 * bank)] = 1 << bit;
@ -35,7 +35,7 @@ OMAP3InterruptController::EnableInterrupt(int irq)
void
OMAP3InterruptController::DisableInterrupt(int irq)
OMAP3InterruptController::DisableInterrupt(int32 irq)
{
uint32 bit = irq % 32, bank = irq / 32;
fRegBase[INTCPS_MIR_SETn + (8 * bank)] = 1 << bit;

View File

@ -11,8 +11,8 @@ class OMAP3InterruptController;
class OMAP3InterruptController : public InterruptController {
public:
OMAP3InterruptController(uint32_t reg_base);
void EnableInterrupt(int irq);
void DisableInterrupt(int irq);
void EnableInterrupt(int32 irq);
void DisableInterrupt(int32 irq);
void HandleInterrupt();
protected:

View File

@ -9,7 +9,7 @@
#define PXA_ICMR2 0x28
void
PXAInterruptController::EnableInterrupt(int irq)
PXAInterruptController::EnableInterrupt(int32 irq)
{
if (irq <= 31) {
fRegBase[PXA_ICMR] |= 1 << irq;
@ -21,7 +21,7 @@ PXAInterruptController::EnableInterrupt(int irq)
void
PXAInterruptController::DisableInterrupt(int irq)
PXAInterruptController::DisableInterrupt(int32 irq)
{
if (irq <= 31) {
fRegBase[PXA_ICMR] &= ~(1 << irq);

View File

@ -11,8 +11,8 @@ class PXAInterruptController;
class PXAInterruptController : public InterruptController {
public:
PXAInterruptController(uint32_t reg_base);
void EnableInterrupt(int irq);
void DisableInterrupt(int irq);
void EnableInterrupt(int32 irq);
void DisableInterrupt(int32 irq);
void HandleInterrupt();
protected:

View File

@ -17,7 +17,7 @@
void
Sun4iInterruptController::EnableInterrupt(int irq)
Sun4iInterruptController::EnableInterrupt(int32 irq)
{
if (irq <= 31) {
fRegBase[SUN4I_INTC_MASK_REG0] |= 1 << irq;

View File

@ -13,8 +13,8 @@
class Sun4iInterruptController : public InterruptController {
public:
Sun4iInterruptController(uint32_t reg_base);
void EnableInterrupt(int irq);
void DisableInterrupt(int irq);
void EnableInterrupt(int32 irq);
void DisableInterrupt(int32 irq);
void HandleInterrupt();
protected:

View File

@ -41,7 +41,7 @@ struct iframe_stack gBootFrameStack;
void
arch_int_enable_io_interrupt(int irq)
arch_int_enable_io_interrupt(int32 irq)
{
InterruptController *ic = InterruptController::Get();
if (ic != NULL)
@ -50,7 +50,7 @@ arch_int_enable_io_interrupt(int irq)
void
arch_int_disable_io_interrupt(int irq)
arch_int_disable_io_interrupt(int32 irq)
{
InterruptController *ic = InterruptController::Get();
if (ic != NULL)

View File

@ -70,7 +70,7 @@ struct iframe_stack gBootFrameStack;
void
arch_int_enable_io_interrupt(int irq)
arch_int_enable_io_interrupt(int32 irq)
{
//if (!sPIC)
// return;
@ -82,7 +82,7 @@ arch_int_enable_io_interrupt(int irq)
void
arch_int_disable_io_interrupt(int irq)
arch_int_disable_io_interrupt(int32 irq)
{
//if (!sPIC)
// return;

6
src/system/kernel/arch/mips/arch_int.cpp Executable file → Normal file
View File

@ -1,4 +1,4 @@
/*
/*
** Copyright 2001, Travis Geiselbrecht. All rights reserved.
** Distributed under the terms of the NewOS License.
*/
@ -9,12 +9,12 @@
struct vector *vector_table;
void arch_int_enable_io_interrupt(int irq)
void arch_int_enable_io_interrupt(int32 irq)
{
return;
}
void arch_int_disable_io_interrupt(int irq)
void arch_int_disable_io_interrupt(int32 irq)
{
return;
}

View File

@ -54,7 +54,7 @@ static void *sPICCookie;
void
arch_int_enable_io_interrupt(int irq)
arch_int_enable_io_interrupt(int32 irq)
{
if (!sPIC)
return;
@ -65,7 +65,7 @@ arch_int_enable_io_interrupt(int irq)
void
arch_int_disable_io_interrupt(int irq)
arch_int_disable_io_interrupt(int32 irq)
{
if (!sPIC)
return;

View File

@ -605,18 +605,18 @@ arch_int_init_io(kernel_args* args)
void
arch_int_enable_io_interrupt(int irq)
arch_int_enable_io_interrupt(int32 irq)
{
dprintf("arch_int_enable_io_interrupt(%d)\n", irq);
dprintf("arch_int_enable_io_interrupt(%" B_PRId32 ")\n", irq);
gPlicRegs->priority[irq] = 1;
gPlicRegs->enable[sPlicContexts[0]][irq / 32] |= 1 << (irq % 32);
}
void
arch_int_disable_io_interrupt(int irq)
arch_int_disable_io_interrupt(int32 irq)
{
dprintf("arch_int_disable_io_interrupt(%d)\n", irq);
dprintf("arch_int_disable_io_interrupt(%" B_PRId32 ")\n", irq);
gPlicRegs->priority[irq] = 0;
gPlicRegs->enable[sPlicContexts[0]][irq / 32] &= ~(1 << (irq % 32));
}

View File

@ -39,13 +39,13 @@ arch_int_init_io(kernel_args* args)
void
arch_int_enable_io_interrupt(int irq)
arch_int_enable_io_interrupt(int32 irq)
{
}
void
arch_int_disable_io_interrupt(int irq)
arch_int_disable_io_interrupt(int32 irq)
{
}

View File

@ -360,7 +360,7 @@ x86_page_fault_exception(struct iframe* frame)
void
x86_set_irq_source(int irq, irq_source source)
x86_set_irq_source(int32 irq, irq_source source)
{
sVectorSources[irq] = source;
}
@ -370,21 +370,21 @@ x86_set_irq_source(int irq, irq_source source)
void
arch_int_enable_io_interrupt(int irq)
arch_int_enable_io_interrupt(int32 irq)
{
sCurrentPIC->enable_io_interrupt(irq);
}
void
arch_int_disable_io_interrupt(int irq)
arch_int_disable_io_interrupt(int32 irq)
{
sCurrentPIC->disable_io_interrupt(irq);
}
void
arch_int_configure_io_interrupt(int irq, uint32 config)
arch_int_configure_io_interrupt(int32 irq, uint32 config)
{
sCurrentPIC->configure_io_interrupt(irq, config);
}

View File

@ -51,7 +51,7 @@ msi_allocate_vectors(uint32 count, uint32 *startVector, uint64 *address,
if (!sMSISupported)
return B_UNSUPPORTED;
long vector;
int32 vector;
status_t result = allocate_io_interrupt_vectors(count, &vector,
INTERRUPT_TYPE_IRQ);
if (result != B_OK)

View File

@ -430,8 +430,8 @@ uint32 assign_cpu(void)
for the given interrupt number with \a data as the argument.
*/
status_t
install_io_interrupt_handler(long vector, interrupt_handler handler, void *data,
ulong flags)
install_io_interrupt_handler(int32 vector, interrupt_handler handler, void *data,
uint32 flags)
{
struct io_handler *io = NULL;
cpu_status state;
@ -524,7 +524,7 @@ install_io_interrupt_handler(long vector, interrupt_handler handler, void *data,
/*! Remove a previously installed interrupt handler */
status_t
remove_io_interrupt_handler(long vector, interrupt_handler handler, void *data)
remove_io_interrupt_handler(int32 vector, interrupt_handler handler, void *data)
{
status_t status = B_BAD_VALUE;
struct io_handler *io = NULL;
@ -607,14 +607,14 @@ remove_io_interrupt_handler(long vector, interrupt_handler handler, void *data)
vectors using allocate_io_interrupt_vectors() instead.
*/
status_t
reserve_io_interrupt_vectors(long count, long startVector, interrupt_type type)
reserve_io_interrupt_vectors(int32 count, int32 startVector, interrupt_type type)
{
MutexLocker locker(&sIOInterruptVectorAllocationLock);
for (long i = 0; i < count; i++) {
for (int32 i = 0; i < count; i++) {
if (sAllocatedIOInterruptVectors[startVector + i]) {
panic("reserved interrupt vector range %ld-%ld overlaps already "
"allocated vector %ld", startVector, startVector + count - 1,
panic("reserved interrupt vector range %" B_PRId32 "-%" B_PRId32 " overlaps already "
"allocated vector %" B_PRId32, startVector, startVector + count - 1,
startVector + i);
free_io_interrupt_vectors(i, startVector);
return B_BUSY;
@ -627,8 +627,8 @@ reserve_io_interrupt_vectors(long count, long startVector, interrupt_type type)
sAllocatedIOInterruptVectors[startVector + i] = true;
}
dprintf("reserve_io_interrupt_vectors: reserved %ld vectors starting "
"from %ld\n", count, startVector);
dprintf("reserve_io_interrupt_vectors: reserved %" B_PRId32 " vectors starting "
"from %" B_PRId32 "\n", count, startVector);
return B_OK;
}
@ -638,14 +638,14 @@ reserve_io_interrupt_vectors(long count, long startVector, interrupt_type type)
The first vector to be used is returned in \a startVector on success.
*/
status_t
allocate_io_interrupt_vectors(long count, long *startVector,
allocate_io_interrupt_vectors(int32 count, int32 *startVector,
interrupt_type type)
{
MutexLocker locker(&sIOInterruptVectorAllocationLock);
long vector = 0;
int32 vector = 0;
bool runFound = true;
for (long i = 0; i < NUM_IO_VECTORS - (count - 1); i++) {
for (int32 i = 0; i < NUM_IO_VECTORS - (count - 1); i++) {
if (sAllocatedIOInterruptVectors[i])
continue;
@ -664,11 +664,11 @@ allocate_io_interrupt_vectors(long count, long *startVector,
}
if (!runFound) {
dprintf("found no free vectors to allocate %ld io interrupts\n", count);
dprintf("found no free vectors to allocate %" B_PRId32 " io interrupts\n", count);
return B_NO_MEMORY;
}
for (long i = 0; i < count; i++) {
for (int32 i = 0; i < count; i++) {
sVectors[vector + i].type = type;
sVectors[vector + i].assigned_cpu = &sVectorCPUAssignments[vector];
sAllocatedIOInterruptVectors[vector + i] = true;
@ -678,8 +678,8 @@ allocate_io_interrupt_vectors(long count, long *startVector,
sVectorCPUAssignments[vector].count = count;
*startVector = vector;
dprintf("allocate_io_interrupt_vectors: allocated %ld vectors starting "
"from %ld\n", count, vector);
dprintf("allocate_io_interrupt_vectors: allocated %" B_PRId32 " vectors starting "
"from %" B_PRId32 "\n", count, vector);
return B_OK;
}
@ -690,28 +690,28 @@ allocate_io_interrupt_vectors(long count, long *startVector,
a vector range.
*/
void
free_io_interrupt_vectors(long count, long startVector)
free_io_interrupt_vectors(int32 count, int32 startVector)
{
if (startVector + count > NUM_IO_VECTORS) {
panic("invalid start vector %ld or count %ld supplied to "
panic("invalid start vector %" B_PRId32 " or count %" B_PRId32 " supplied to "
"free_io_interrupt_vectors\n", startVector, count);
return;
}
dprintf("free_io_interrupt_vectors: freeing %ld vectors starting "
"from %ld\n", count, startVector);
dprintf("free_io_interrupt_vectors: freeing %" B_PRId32 " vectors starting "
"from %" B_PRId32 "\n", count, startVector);
MutexLocker locker(sIOInterruptVectorAllocationLock);
for (long i = 0; i < count; i++) {
for (int32 i = 0; i < count; i++) {
if (!sAllocatedIOInterruptVectors[startVector + i]) {
panic("io interrupt vector %ld was not allocated\n",
panic("io interrupt vector %" B_PRId32 " was not allocated\n",
startVector + i);
}
io_vector& vector = sVectors[startVector + i];
InterruptsSpinLocker vectorLocker(vector.vector_lock);
if (vector.assigned_cpu != NULL && vector.assigned_cpu->cpu != -1) {
panic("freeing io interrupt vector %ld that is still asigned to a "
panic("freeing io interrupt vector %" B_PRId32 " that is still asigned to a "
"cpu", startVector + i);
continue;
}
@ -722,7 +722,7 @@ free_io_interrupt_vectors(long count, long startVector)
}
void assign_io_interrupt_to_cpu(long vector, int32 newCPU)
void assign_io_interrupt_to_cpu(int32 vector, int32 newCPU)
{
ASSERT(sVectors[vector].type == INTERRUPT_TYPE_IRQ);

View File

@ -106,9 +106,9 @@ public:
uint8 ReadReg(uint32 reg) { return in8(fBase + reg); };
void WriteReg(uint32 reg, uint8 v) { out8(v, fBase + reg); };
void EnableIOInterrupt(int irq);
void DisableIOInterrupt(int irq);
bool AcknowledgeIOInterrupt(int irq);
void EnableIOInterrupt(int32 irq);
void DisableIOInterrupt(int32 irq);
bool AcknowledgeIOInterrupt(int32 irq);
private:
uint32 fBase;
@ -149,9 +149,9 @@ public:
virtual char SerialDebugGetChar();
virtual void SerialDebugPutChar(char c);
virtual void EnableIOInterrupt(int irq);
virtual void DisableIOInterrupt(int irq);
virtual bool AcknowledgeIOInterrupt(int irq);
virtual void EnableIOInterrupt(int32 irq);
virtual void DisableIOInterrupt(int32 irq);
virtual bool AcknowledgeIOInterrupt(int32 irq);
virtual uint8 ReadRTCReg(uint8 reg);
virtual void WriteRTCReg(uint8 reg, uint8 val);
@ -176,7 +176,7 @@ private:
int32 (*nfCall)(uint32 ID, ...);
char *nfPage;
uint32 nfDebugPrintfID;
};
@ -277,7 +277,7 @@ M68KAtari::RTC::ReadReg(uint32 reg)
out8(0x0a, fBase+1);
while((in8(fBase+3) & 0x80) && --waitTime);
}
out8((uint8)reg,fBase+1);
return in8(fBase+3);
}
@ -327,7 +327,7 @@ M68KAtari::Init(struct kernel_args *kernelArgs)
// initialize ARAnyM NatFeatures
nfGetID =
kernelArgs->arch_args.plat_args.atari.nat_feat.nf_get_id;
nfCall =
nfCall =
kernelArgs->arch_args.plat_args.atari.nat_feat.nf_call;
nfPage = (char *)
kernelArgs->arch_args.plat_args.atari.nat_feat.nf_page;
@ -338,7 +338,7 @@ M68KAtari::Init(struct kernel_args *kernelArgs)
} else
// won't really work anyway from here
panic("You MUST have an ST MFP! Wait, is that *really* an Atari ???");
return B_OK;
}
@ -395,7 +395,7 @@ M68KAtari::InitRTC(struct kernel_args *kernelArgs,
status_t
M68KAtari::InitTimer(struct kernel_args *kernelArgs)
{
fMFP[0]->WriteReg(MFP_TACR, 0); // stop it
install_io_interrupt_handler(fMFP[0]->Vector()+13, &MFPTimerInterrupt, this, 0);
return B_OK;
@ -553,7 +553,7 @@ M68KAtari::SerialDebugPutChar(char c)
#if 0
static char buffer[2] = { '\0', '\0' };
buffer[0] = c;
nfCall(nfDebugPrintfID /*| 0*/, buffer);
#endif
nfPage[0] = c;
@ -568,7 +568,7 @@ M68KAtari::SerialDebugPutChar(char c)
void
M68KAtari::EnableIOInterrupt(int irq)
M68KAtari::EnableIOInterrupt(int32 irq)
{
MFP *mfp = MFPForIrq(irq);
@ -578,7 +578,7 @@ M68KAtari::EnableIOInterrupt(int irq)
void
M68KAtari::DisableIOInterrupt(int irq)
M68KAtari::DisableIOInterrupt(int32 irq)
{
MFP *mfp = MFPForIrq(irq);
@ -588,7 +588,7 @@ M68KAtari::DisableIOInterrupt(int irq)
bool
M68KAtari::AcknowledgeIOInterrupt(int irq)
M68KAtari::AcknowledgeIOInterrupt(int32 irq)
{
MFP *mfp = MFPForIrq(irq);