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 <[email protected]> Reviewed-by: Alex von Gluck IV <[email protected]>
This commit is contained in:
@@ -168,9 +168,9 @@ extern void release_write_seqlock(seqlock* lock);
|
|||||||
extern uint32 acquire_read_seqlock(seqlock* lock);
|
extern uint32 acquire_read_seqlock(seqlock* lock);
|
||||||
extern bool release_read_seqlock(seqlock* lock, uint32 count);
|
extern bool release_read_seqlock(seqlock* lock, uint32 count);
|
||||||
|
|
||||||
extern status_t install_io_interrupt_handler(long interrupt_number,
|
extern status_t install_io_interrupt_handler(int32 interrupt_number,
|
||||||
interrupt_handler handler, void *data, ulong flags);
|
interrupt_handler handler, void *data, uint32 flags);
|
||||||
extern status_t remove_io_interrupt_handler(long interrupt_number,
|
extern status_t remove_io_interrupt_handler(int32 interrupt_number,
|
||||||
interrupt_handler handler, void *data);
|
interrupt_handler handler, void *data);
|
||||||
|
|
||||||
extern status_t add_timer(timer *t, timer_hook hook, bigtime_t period,
|
extern status_t add_timer(timer *t, timer_hook hook, bigtime_t period,
|
||||||
|
|||||||
@@ -30,9 +30,9 @@ status_t arch_int_init_post_device_manager(struct kernel_args* args);
|
|||||||
void arch_int_enable_interrupts(void);
|
void arch_int_enable_interrupts(void);
|
||||||
int arch_int_disable_interrupts(void);
|
int arch_int_disable_interrupts(void);
|
||||||
void arch_int_restore_interrupts(int oldState);
|
void arch_int_restore_interrupts(int oldState);
|
||||||
void arch_int_enable_io_interrupt(int irq);
|
void arch_int_enable_io_interrupt(int32 irq);
|
||||||
void arch_int_disable_io_interrupt(int irq);
|
void arch_int_disable_io_interrupt(int32 irq);
|
||||||
void arch_int_configure_io_interrupt(int irq, uint32 config);
|
void arch_int_configure_io_interrupt(int32 irq, uint32 config);
|
||||||
bool arch_int_are_interrupts_enabled(void);
|
bool arch_int_are_interrupts_enabled(void);
|
||||||
int32 arch_int_assign_to_cpu(int32 irq, int32 cpu);
|
int32 arch_int_assign_to_cpu(int32 irq, int32 cpu);
|
||||||
|
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ typedef struct interrupt_controller_s {
|
|||||||
} interrupt_controller;
|
} 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);
|
void arch_int_set_interrupt_controller(const interrupt_controller &controller);
|
||||||
|
|
||||||
|
|||||||
@@ -77,12 +77,12 @@ are_interrupts_enabled(void)
|
|||||||
#define restore_interrupts(status) arch_int_restore_interrupts(status)
|
#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);
|
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);
|
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 */
|
#endif /* _KERNEL_INT_H */
|
||||||
|
|||||||
@@ -179,7 +179,7 @@ private:
|
|||||||
|
|
||||||
uint32 fAllocatedMsiIrqs[1];
|
uint32 fAllocatedMsiIrqs[1];
|
||||||
phys_addr_t fMsiPhysAddr {};
|
phys_addr_t fMsiPhysAddr {};
|
||||||
long fMsiStartIrq {};
|
int32 fMsiStartIrq {};
|
||||||
uint64 fMsiData {};
|
uint64 fMsiData {};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ MsiInterruptCtrlDW::Init(PciDbiRegs volatile* dbiRegs, int32 msiIrq)
|
|||||||
|
|
||||||
msi_set_interface(static_cast<MSIInterface*>(this));
|
msi_set_interface(static_cast<MSIInterface*>(this));
|
||||||
|
|
||||||
dprintf(" fMsiStartIrq: %ld\n", fMsiStartIrq);
|
dprintf(" fMsiStartIrq: %" B_PRId32 "\n", fMsiStartIrq);
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,9 +70,9 @@ struct iframe_stack gBootFrameStack;
|
|||||||
|
|
||||||
|
|
||||||
void
|
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();
|
InterruptController *ic = InterruptController::Get();
|
||||||
if (ic != NULL)
|
if (ic != NULL)
|
||||||
ic->EnableInterrupt(irq);
|
ic->EnableInterrupt(irq);
|
||||||
@@ -80,9 +80,9 @@ arch_int_enable_io_interrupt(int irq)
|
|||||||
|
|
||||||
|
|
||||||
void
|
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();
|
InterruptController *ic = InterruptController::Get();
|
||||||
if (ic != NULL)
|
if (ic != NULL)
|
||||||
ic->DisableInterrupt(irq);
|
ic->DisableInterrupt(irq);
|
||||||
|
|||||||
@@ -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_reg = GICD_REG_ISENABLER + irq / 32;
|
||||||
uint32_t ena_val = 1 << (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);
|
fGicdRegs[GICD_REG_ICENABLER + irq / 32] = 1 << (irq % 32);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,8 +12,8 @@
|
|||||||
class GICv2InterruptController : public InterruptController {
|
class GICv2InterruptController : public InterruptController {
|
||||||
public:
|
public:
|
||||||
GICv2InterruptController(uint32_t gicd_regs = 0, uint32_t gicc_regs = 0);
|
GICv2InterruptController(uint32_t gicd_regs = 0, uint32_t gicc_regs = 0);
|
||||||
void EnableInterrupt(int irq);
|
void EnableInterrupt(int32 irq);
|
||||||
void DisableInterrupt(int irq);
|
void DisableInterrupt(int32 irq);
|
||||||
void HandleInterrupt();
|
void HandleInterrupt();
|
||||||
private:
|
private:
|
||||||
volatile uint32_t *fGicdRegs;
|
volatile uint32_t *fGicdRegs;
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ class InterruptController;
|
|||||||
|
|
||||||
class InterruptController {
|
class InterruptController {
|
||||||
public:
|
public:
|
||||||
virtual void EnableInterrupt(int irq) = 0;
|
virtual void EnableInterrupt(int32 irq) = 0;
|
||||||
virtual void DisableInterrupt(int irq) = 0;
|
virtual void DisableInterrupt(int32 irq) = 0;
|
||||||
|
|
||||||
virtual void HandleInterrupt() = 0;
|
virtual void HandleInterrupt() = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ enum {
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
OMAP3InterruptController::EnableInterrupt(int irq)
|
OMAP3InterruptController::EnableInterrupt(int32 irq)
|
||||||
{
|
{
|
||||||
uint32 bit = irq % 32, bank = irq / 32;
|
uint32 bit = irq % 32, bank = irq / 32;
|
||||||
fRegBase[INTCPS_MIR_CLEARn + (8 * bank)] = 1 << bit;
|
fRegBase[INTCPS_MIR_CLEARn + (8 * bank)] = 1 << bit;
|
||||||
@@ -35,7 +35,7 @@ OMAP3InterruptController::EnableInterrupt(int irq)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
OMAP3InterruptController::DisableInterrupt(int irq)
|
OMAP3InterruptController::DisableInterrupt(int32 irq)
|
||||||
{
|
{
|
||||||
uint32 bit = irq % 32, bank = irq / 32;
|
uint32 bit = irq % 32, bank = irq / 32;
|
||||||
fRegBase[INTCPS_MIR_SETn + (8 * bank)] = 1 << bit;
|
fRegBase[INTCPS_MIR_SETn + (8 * bank)] = 1 << bit;
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ class OMAP3InterruptController;
|
|||||||
class OMAP3InterruptController : public InterruptController {
|
class OMAP3InterruptController : public InterruptController {
|
||||||
public:
|
public:
|
||||||
OMAP3InterruptController(uint32_t reg_base);
|
OMAP3InterruptController(uint32_t reg_base);
|
||||||
void EnableInterrupt(int irq);
|
void EnableInterrupt(int32 irq);
|
||||||
void DisableInterrupt(int irq);
|
void DisableInterrupt(int32 irq);
|
||||||
void HandleInterrupt();
|
void HandleInterrupt();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
#define PXA_ICMR2 0x28
|
#define PXA_ICMR2 0x28
|
||||||
|
|
||||||
void
|
void
|
||||||
PXAInterruptController::EnableInterrupt(int irq)
|
PXAInterruptController::EnableInterrupt(int32 irq)
|
||||||
{
|
{
|
||||||
if (irq <= 31) {
|
if (irq <= 31) {
|
||||||
fRegBase[PXA_ICMR] |= 1 << irq;
|
fRegBase[PXA_ICMR] |= 1 << irq;
|
||||||
@@ -21,7 +21,7 @@ PXAInterruptController::EnableInterrupt(int irq)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
PXAInterruptController::DisableInterrupt(int irq)
|
PXAInterruptController::DisableInterrupt(int32 irq)
|
||||||
{
|
{
|
||||||
if (irq <= 31) {
|
if (irq <= 31) {
|
||||||
fRegBase[PXA_ICMR] &= ~(1 << irq);
|
fRegBase[PXA_ICMR] &= ~(1 << irq);
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ class PXAInterruptController;
|
|||||||
class PXAInterruptController : public InterruptController {
|
class PXAInterruptController : public InterruptController {
|
||||||
public:
|
public:
|
||||||
PXAInterruptController(uint32_t reg_base);
|
PXAInterruptController(uint32_t reg_base);
|
||||||
void EnableInterrupt(int irq);
|
void EnableInterrupt(int32 irq);
|
||||||
void DisableInterrupt(int irq);
|
void DisableInterrupt(int32 irq);
|
||||||
void HandleInterrupt();
|
void HandleInterrupt();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Sun4iInterruptController::EnableInterrupt(int irq)
|
Sun4iInterruptController::EnableInterrupt(int32 irq)
|
||||||
{
|
{
|
||||||
if (irq <= 31) {
|
if (irq <= 31) {
|
||||||
fRegBase[SUN4I_INTC_MASK_REG0] |= 1 << irq;
|
fRegBase[SUN4I_INTC_MASK_REG0] |= 1 << irq;
|
||||||
|
|||||||
@@ -13,8 +13,8 @@
|
|||||||
class Sun4iInterruptController : public InterruptController {
|
class Sun4iInterruptController : public InterruptController {
|
||||||
public:
|
public:
|
||||||
Sun4iInterruptController(uint32_t reg_base);
|
Sun4iInterruptController(uint32_t reg_base);
|
||||||
void EnableInterrupt(int irq);
|
void EnableInterrupt(int32 irq);
|
||||||
void DisableInterrupt(int irq);
|
void DisableInterrupt(int32 irq);
|
||||||
void HandleInterrupt();
|
void HandleInterrupt();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ struct iframe_stack gBootFrameStack;
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
arch_int_enable_io_interrupt(int irq)
|
arch_int_enable_io_interrupt(int32 irq)
|
||||||
{
|
{
|
||||||
InterruptController *ic = InterruptController::Get();
|
InterruptController *ic = InterruptController::Get();
|
||||||
if (ic != NULL)
|
if (ic != NULL)
|
||||||
@@ -50,7 +50,7 @@ arch_int_enable_io_interrupt(int irq)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
arch_int_disable_io_interrupt(int irq)
|
arch_int_disable_io_interrupt(int32 irq)
|
||||||
{
|
{
|
||||||
InterruptController *ic = InterruptController::Get();
|
InterruptController *ic = InterruptController::Get();
|
||||||
if (ic != NULL)
|
if (ic != NULL)
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ struct iframe_stack gBootFrameStack;
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
arch_int_enable_io_interrupt(int irq)
|
arch_int_enable_io_interrupt(int32 irq)
|
||||||
{
|
{
|
||||||
//if (!sPIC)
|
//if (!sPIC)
|
||||||
// return;
|
// return;
|
||||||
@@ -82,7 +82,7 @@ arch_int_enable_io_interrupt(int irq)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
arch_int_disable_io_interrupt(int irq)
|
arch_int_disable_io_interrupt(int32 irq)
|
||||||
{
|
{
|
||||||
//if (!sPIC)
|
//if (!sPIC)
|
||||||
// return;
|
// return;
|
||||||
|
|||||||
Executable → Regular
+3
-3
@@ -1,4 +1,4 @@
|
|||||||
/*
|
/*
|
||||||
** Copyright 2001, Travis Geiselbrecht. All rights reserved.
|
** Copyright 2001, Travis Geiselbrecht. All rights reserved.
|
||||||
** Distributed under the terms of the NewOS License.
|
** Distributed under the terms of the NewOS License.
|
||||||
*/
|
*/
|
||||||
@@ -9,12 +9,12 @@
|
|||||||
|
|
||||||
struct vector *vector_table;
|
struct vector *vector_table;
|
||||||
|
|
||||||
void arch_int_enable_io_interrupt(int irq)
|
void arch_int_enable_io_interrupt(int32 irq)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void arch_int_disable_io_interrupt(int irq)
|
void arch_int_disable_io_interrupt(int32 irq)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ static void *sPICCookie;
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
arch_int_enable_io_interrupt(int irq)
|
arch_int_enable_io_interrupt(int32 irq)
|
||||||
{
|
{
|
||||||
if (!sPIC)
|
if (!sPIC)
|
||||||
return;
|
return;
|
||||||
@@ -65,7 +65,7 @@ arch_int_enable_io_interrupt(int irq)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
arch_int_disable_io_interrupt(int irq)
|
arch_int_disable_io_interrupt(int32 irq)
|
||||||
{
|
{
|
||||||
if (!sPIC)
|
if (!sPIC)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -605,18 +605,18 @@ arch_int_init_io(kernel_args* args)
|
|||||||
|
|
||||||
|
|
||||||
void
|
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->priority[irq] = 1;
|
||||||
gPlicRegs->enable[sPlicContexts[0]][irq / 32] |= 1 << (irq % 32);
|
gPlicRegs->enable[sPlicContexts[0]][irq / 32] |= 1 << (irq % 32);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
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->priority[irq] = 0;
|
||||||
gPlicRegs->enable[sPlicContexts[0]][irq / 32] &= ~(1 << (irq % 32));
|
gPlicRegs->enable[sPlicContexts[0]][irq / 32] &= ~(1 << (irq % 32));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,13 +39,13 @@ arch_int_init_io(kernel_args* args)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
arch_int_enable_io_interrupt(int irq)
|
arch_int_enable_io_interrupt(int32 irq)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
arch_int_disable_io_interrupt(int irq)
|
arch_int_disable_io_interrupt(int32 irq)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -360,7 +360,7 @@ x86_page_fault_exception(struct iframe* frame)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
x86_set_irq_source(int irq, irq_source source)
|
x86_set_irq_source(int32 irq, irq_source source)
|
||||||
{
|
{
|
||||||
sVectorSources[irq] = source;
|
sVectorSources[irq] = source;
|
||||||
}
|
}
|
||||||
@@ -370,21 +370,21 @@ x86_set_irq_source(int irq, irq_source source)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
arch_int_enable_io_interrupt(int irq)
|
arch_int_enable_io_interrupt(int32 irq)
|
||||||
{
|
{
|
||||||
sCurrentPIC->enable_io_interrupt(irq);
|
sCurrentPIC->enable_io_interrupt(irq);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
arch_int_disable_io_interrupt(int irq)
|
arch_int_disable_io_interrupt(int32 irq)
|
||||||
{
|
{
|
||||||
sCurrentPIC->disable_io_interrupt(irq);
|
sCurrentPIC->disable_io_interrupt(irq);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
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);
|
sCurrentPIC->configure_io_interrupt(irq, config);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ msi_allocate_vectors(uint32 count, uint32 *startVector, uint64 *address,
|
|||||||
if (!sMSISupported)
|
if (!sMSISupported)
|
||||||
return B_UNSUPPORTED;
|
return B_UNSUPPORTED;
|
||||||
|
|
||||||
long vector;
|
int32 vector;
|
||||||
status_t result = allocate_io_interrupt_vectors(count, &vector,
|
status_t result = allocate_io_interrupt_vectors(count, &vector,
|
||||||
INTERRUPT_TYPE_IRQ);
|
INTERRUPT_TYPE_IRQ);
|
||||||
if (result != B_OK)
|
if (result != B_OK)
|
||||||
|
|||||||
+24
-24
@@ -430,8 +430,8 @@ uint32 assign_cpu(void)
|
|||||||
for the given interrupt number with \a data as the argument.
|
for the given interrupt number with \a data as the argument.
|
||||||
*/
|
*/
|
||||||
status_t
|
status_t
|
||||||
install_io_interrupt_handler(long vector, interrupt_handler handler, void *data,
|
install_io_interrupt_handler(int32 vector, interrupt_handler handler, void *data,
|
||||||
ulong flags)
|
uint32 flags)
|
||||||
{
|
{
|
||||||
struct io_handler *io = NULL;
|
struct io_handler *io = NULL;
|
||||||
cpu_status state;
|
cpu_status state;
|
||||||
@@ -524,7 +524,7 @@ install_io_interrupt_handler(long vector, interrupt_handler handler, void *data,
|
|||||||
|
|
||||||
/*! Remove a previously installed interrupt handler */
|
/*! Remove a previously installed interrupt handler */
|
||||||
status_t
|
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;
|
status_t status = B_BAD_VALUE;
|
||||||
struct io_handler *io = NULL;
|
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.
|
vectors using allocate_io_interrupt_vectors() instead.
|
||||||
*/
|
*/
|
||||||
status_t
|
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);
|
MutexLocker locker(&sIOInterruptVectorAllocationLock);
|
||||||
|
|
||||||
for (long i = 0; i < count; i++) {
|
for (int32 i = 0; i < count; i++) {
|
||||||
if (sAllocatedIOInterruptVectors[startVector + i]) {
|
if (sAllocatedIOInterruptVectors[startVector + i]) {
|
||||||
panic("reserved interrupt vector range %ld-%ld overlaps already "
|
panic("reserved interrupt vector range %" B_PRId32 "-%" B_PRId32 " overlaps already "
|
||||||
"allocated vector %ld", startVector, startVector + count - 1,
|
"allocated vector %" B_PRId32, startVector, startVector + count - 1,
|
||||||
startVector + i);
|
startVector + i);
|
||||||
free_io_interrupt_vectors(i, startVector);
|
free_io_interrupt_vectors(i, startVector);
|
||||||
return B_BUSY;
|
return B_BUSY;
|
||||||
@@ -627,8 +627,8 @@ reserve_io_interrupt_vectors(long count, long startVector, interrupt_type type)
|
|||||||
sAllocatedIOInterruptVectors[startVector + i] = true;
|
sAllocatedIOInterruptVectors[startVector + i] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
dprintf("reserve_io_interrupt_vectors: reserved %ld vectors starting "
|
dprintf("reserve_io_interrupt_vectors: reserved %" B_PRId32 " vectors starting "
|
||||||
"from %ld\n", count, startVector);
|
"from %" B_PRId32 "\n", count, startVector);
|
||||||
return B_OK;
|
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.
|
The first vector to be used is returned in \a startVector on success.
|
||||||
*/
|
*/
|
||||||
status_t
|
status_t
|
||||||
allocate_io_interrupt_vectors(long count, long *startVector,
|
allocate_io_interrupt_vectors(int32 count, int32 *startVector,
|
||||||
interrupt_type type)
|
interrupt_type type)
|
||||||
{
|
{
|
||||||
MutexLocker locker(&sIOInterruptVectorAllocationLock);
|
MutexLocker locker(&sIOInterruptVectorAllocationLock);
|
||||||
|
|
||||||
long vector = 0;
|
int32 vector = 0;
|
||||||
bool runFound = true;
|
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])
|
if (sAllocatedIOInterruptVectors[i])
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -664,11 +664,11 @@ allocate_io_interrupt_vectors(long count, long *startVector,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!runFound) {
|
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;
|
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].type = type;
|
||||||
sVectors[vector + i].assigned_cpu = &sVectorCPUAssignments[vector];
|
sVectors[vector + i].assigned_cpu = &sVectorCPUAssignments[vector];
|
||||||
sAllocatedIOInterruptVectors[vector + i] = true;
|
sAllocatedIOInterruptVectors[vector + i] = true;
|
||||||
@@ -678,8 +678,8 @@ allocate_io_interrupt_vectors(long count, long *startVector,
|
|||||||
sVectorCPUAssignments[vector].count = count;
|
sVectorCPUAssignments[vector].count = count;
|
||||||
|
|
||||||
*startVector = vector;
|
*startVector = vector;
|
||||||
dprintf("allocate_io_interrupt_vectors: allocated %ld vectors starting "
|
dprintf("allocate_io_interrupt_vectors: allocated %" B_PRId32 " vectors starting "
|
||||||
"from %ld\n", count, vector);
|
"from %" B_PRId32 "\n", count, vector);
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -690,28 +690,28 @@ allocate_io_interrupt_vectors(long count, long *startVector,
|
|||||||
a vector range.
|
a vector range.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
free_io_interrupt_vectors(long count, long startVector)
|
free_io_interrupt_vectors(int32 count, int32 startVector)
|
||||||
{
|
{
|
||||||
if (startVector + count > NUM_IO_VECTORS) {
|
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);
|
"free_io_interrupt_vectors\n", startVector, count);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
dprintf("free_io_interrupt_vectors: freeing %ld vectors starting "
|
dprintf("free_io_interrupt_vectors: freeing %" B_PRId32 " vectors starting "
|
||||||
"from %ld\n", count, startVector);
|
"from %" B_PRId32 "\n", count, startVector);
|
||||||
|
|
||||||
MutexLocker locker(sIOInterruptVectorAllocationLock);
|
MutexLocker locker(sIOInterruptVectorAllocationLock);
|
||||||
for (long i = 0; i < count; i++) {
|
for (int32 i = 0; i < count; i++) {
|
||||||
if (!sAllocatedIOInterruptVectors[startVector + 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);
|
startVector + i);
|
||||||
}
|
}
|
||||||
|
|
||||||
io_vector& vector = sVectors[startVector + i];
|
io_vector& vector = sVectors[startVector + i];
|
||||||
InterruptsSpinLocker vectorLocker(vector.vector_lock);
|
InterruptsSpinLocker vectorLocker(vector.vector_lock);
|
||||||
if (vector.assigned_cpu != NULL && vector.assigned_cpu->cpu != -1) {
|
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);
|
"cpu", startVector + i);
|
||||||
continue;
|
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);
|
ASSERT(sVectors[vector].type == INTERRUPT_TYPE_IRQ);
|
||||||
|
|
||||||
|
|||||||
@@ -106,9 +106,9 @@ public:
|
|||||||
uint8 ReadReg(uint32 reg) { return in8(fBase + reg); };
|
uint8 ReadReg(uint32 reg) { return in8(fBase + reg); };
|
||||||
void WriteReg(uint32 reg, uint8 v) { out8(v, fBase + reg); };
|
void WriteReg(uint32 reg, uint8 v) { out8(v, fBase + reg); };
|
||||||
|
|
||||||
void EnableIOInterrupt(int irq);
|
void EnableIOInterrupt(int32 irq);
|
||||||
void DisableIOInterrupt(int irq);
|
void DisableIOInterrupt(int32 irq);
|
||||||
bool AcknowledgeIOInterrupt(int irq);
|
bool AcknowledgeIOInterrupt(int32 irq);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint32 fBase;
|
uint32 fBase;
|
||||||
@@ -149,9 +149,9 @@ public:
|
|||||||
virtual char SerialDebugGetChar();
|
virtual char SerialDebugGetChar();
|
||||||
virtual void SerialDebugPutChar(char c);
|
virtual void SerialDebugPutChar(char c);
|
||||||
|
|
||||||
virtual void EnableIOInterrupt(int irq);
|
virtual void EnableIOInterrupt(int32 irq);
|
||||||
virtual void DisableIOInterrupt(int irq);
|
virtual void DisableIOInterrupt(int32 irq);
|
||||||
virtual bool AcknowledgeIOInterrupt(int irq);
|
virtual bool AcknowledgeIOInterrupt(int32 irq);
|
||||||
|
|
||||||
virtual uint8 ReadRTCReg(uint8 reg);
|
virtual uint8 ReadRTCReg(uint8 reg);
|
||||||
virtual void WriteRTCReg(uint8 reg, uint8 val);
|
virtual void WriteRTCReg(uint8 reg, uint8 val);
|
||||||
@@ -176,7 +176,7 @@ private:
|
|||||||
int32 (*nfCall)(uint32 ID, ...);
|
int32 (*nfCall)(uint32 ID, ...);
|
||||||
char *nfPage;
|
char *nfPage;
|
||||||
uint32 nfDebugPrintfID;
|
uint32 nfDebugPrintfID;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -277,7 +277,7 @@ M68KAtari::RTC::ReadReg(uint32 reg)
|
|||||||
out8(0x0a, fBase+1);
|
out8(0x0a, fBase+1);
|
||||||
while((in8(fBase+3) & 0x80) && --waitTime);
|
while((in8(fBase+3) & 0x80) && --waitTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
out8((uint8)reg,fBase+1);
|
out8((uint8)reg,fBase+1);
|
||||||
return in8(fBase+3);
|
return in8(fBase+3);
|
||||||
}
|
}
|
||||||
@@ -327,7 +327,7 @@ M68KAtari::Init(struct kernel_args *kernelArgs)
|
|||||||
// initialize ARAnyM NatFeatures
|
// initialize ARAnyM NatFeatures
|
||||||
nfGetID =
|
nfGetID =
|
||||||
kernelArgs->arch_args.plat_args.atari.nat_feat.nf_get_id;
|
kernelArgs->arch_args.plat_args.atari.nat_feat.nf_get_id;
|
||||||
nfCall =
|
nfCall =
|
||||||
kernelArgs->arch_args.plat_args.atari.nat_feat.nf_call;
|
kernelArgs->arch_args.plat_args.atari.nat_feat.nf_call;
|
||||||
nfPage = (char *)
|
nfPage = (char *)
|
||||||
kernelArgs->arch_args.plat_args.atari.nat_feat.nf_page;
|
kernelArgs->arch_args.plat_args.atari.nat_feat.nf_page;
|
||||||
@@ -338,7 +338,7 @@ M68KAtari::Init(struct kernel_args *kernelArgs)
|
|||||||
} else
|
} else
|
||||||
// won't really work anyway from here
|
// won't really work anyway from here
|
||||||
panic("You MUST have an ST MFP! Wait, is that *really* an Atari ???");
|
panic("You MUST have an ST MFP! Wait, is that *really* an Atari ???");
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -395,7 +395,7 @@ M68KAtari::InitRTC(struct kernel_args *kernelArgs,
|
|||||||
status_t
|
status_t
|
||||||
M68KAtari::InitTimer(struct kernel_args *kernelArgs)
|
M68KAtari::InitTimer(struct kernel_args *kernelArgs)
|
||||||
{
|
{
|
||||||
|
|
||||||
fMFP[0]->WriteReg(MFP_TACR, 0); // stop it
|
fMFP[0]->WriteReg(MFP_TACR, 0); // stop it
|
||||||
install_io_interrupt_handler(fMFP[0]->Vector()+13, &MFPTimerInterrupt, this, 0);
|
install_io_interrupt_handler(fMFP[0]->Vector()+13, &MFPTimerInterrupt, this, 0);
|
||||||
return B_OK;
|
return B_OK;
|
||||||
@@ -553,7 +553,7 @@ M68KAtari::SerialDebugPutChar(char c)
|
|||||||
#if 0
|
#if 0
|
||||||
static char buffer[2] = { '\0', '\0' };
|
static char buffer[2] = { '\0', '\0' };
|
||||||
buffer[0] = c;
|
buffer[0] = c;
|
||||||
|
|
||||||
nfCall(nfDebugPrintfID /*| 0*/, buffer);
|
nfCall(nfDebugPrintfID /*| 0*/, buffer);
|
||||||
#endif
|
#endif
|
||||||
nfPage[0] = c;
|
nfPage[0] = c;
|
||||||
@@ -568,7 +568,7 @@ M68KAtari::SerialDebugPutChar(char c)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
M68KAtari::EnableIOInterrupt(int irq)
|
M68KAtari::EnableIOInterrupt(int32 irq)
|
||||||
{
|
{
|
||||||
MFP *mfp = MFPForIrq(irq);
|
MFP *mfp = MFPForIrq(irq);
|
||||||
|
|
||||||
@@ -578,7 +578,7 @@ M68KAtari::EnableIOInterrupt(int irq)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
M68KAtari::DisableIOInterrupt(int irq)
|
M68KAtari::DisableIOInterrupt(int32 irq)
|
||||||
{
|
{
|
||||||
MFP *mfp = MFPForIrq(irq);
|
MFP *mfp = MFPForIrq(irq);
|
||||||
|
|
||||||
@@ -588,7 +588,7 @@ M68KAtari::DisableIOInterrupt(int irq)
|
|||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
M68KAtari::AcknowledgeIOInterrupt(int irq)
|
M68KAtari::AcknowledgeIOInterrupt(int32 irq)
|
||||||
{
|
{
|
||||||
MFP *mfp = MFPForIrq(irq);
|
MFP *mfp = MFPForIrq(irq);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user