git://scm.lunaixsky.com
/
lunaix-os.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
1d99ee6
)
make irq specifier to be provided when assigining irq
nov/intr-tree
author
Lunaixsky
<lunaixsky@qq.com>
Sun, 15 Dec 2024 01:36:31 +0000
(
01:36
+0000)
committer
Lunaixsky
<lunaixsky@qq.com>
Sun, 15 Dec 2024 01:36:31 +0000
(
01:36
+0000)
* general fix around.
15 files changed:
lunaix-os/arch/x86/hal/apic_timer.c
patch
|
blob
|
history
lunaix-os/arch/x86/hal/mc146818a.c
patch
|
blob
|
history
lunaix-os/arch/x86/hal/ps2kbd.c
patch
|
blob
|
history
lunaix-os/hal/ahci/ahci_pci.c
patch
|
blob
|
history
lunaix-os/hal/bus/pci.c
patch
|
blob
|
history
lunaix-os/hal/char/uart/16x50_isa.c
patch
|
blob
|
history
lunaix-os/hal/char/uart/16x50_pci.c
patch
|
blob
|
history
lunaix-os/hal/devtree/LBuild
patch
|
blob
|
history
lunaix-os/hal/devtree/devtree.h
patch
|
blob
|
history
lunaix-os/hal/devtree/dt.c
patch
|
blob
|
history
lunaix-os/hal/irq.c
patch
|
blob
|
history
lunaix-os/includes/hal/devtree.h
patch
|
blob
|
history
lunaix-os/includes/hal/irq.h
patch
|
blob
|
history
lunaix-os/includes/hal/pci.h
patch
|
blob
|
history
lunaix-os/tests/units/device-tree/makefile
patch
|
blob
|
history
diff --git
a/lunaix-os/arch/x86/hal/apic_timer.c
b/lunaix-os/arch/x86/hal/apic_timer.c
index 9a42e82480637a88df66ebf5fac3f7d89227bc0d..178928cae3f205d51599d1a788a4fcf2d0883a18 100644
(file)
--- a/
lunaix-os/arch/x86/hal/apic_timer.c
+++ b/
lunaix-os/arch/x86/hal/apic_timer.c
@@
-46,7
+46,7
@@
__apic_timer_calibrate(struct hwtimer_pot* pot, u32_t hertz)
irq = irq_declare_direct(apic_timer_count_stop);
irq_set_payload(irq, pot);
irq = irq_declare_direct(apic_timer_count_stop);
irq_set_payload(irq, pot);
- irq_assign(irq_get_default_domain(), irq);
+ irq_assign(irq_get_default_domain(), irq
, NULL
);
// Setup a one-shot timer, we will use this to measure the bus speed. So we
// can then calibrate apic timer to work at *nearly* accurate hz
// Setup a one-shot timer, we will use this to measure the bus speed. So we
// can then calibrate apic timer to work at *nearly* accurate hz
diff --git
a/lunaix-os/arch/x86/hal/mc146818a.c
b/lunaix-os/arch/x86/hal/mc146818a.c
index d6d931d78081a3ec60348748af80a9e7acac19c1..fcb5d7f77f293dbe6f1115ee2dfa56b24bf354cc 100644
(file)
--- a/
lunaix-os/arch/x86/hal/mc146818a.c
+++ b/
lunaix-os/arch/x86/hal/mc146818a.c
@@
-184,10
+184,10
@@
__rtc_calibrate(struct hwrtc_potens* pot)
state = (struct mc146818*)rtc_dev->underlay;
state = (struct mc146818*)rtc_dev->underlay;
- state->irq = irq_declare_line(__rtc_tick, PC_AT_IRQ_RTC
, NULL
);
+ state->irq = irq_declare_line(__rtc_tick, PC_AT_IRQ_RTC);
irq_set_payload(state->irq, state);
irq_set_payload(state->irq, state);
- irq_assign(irq_owning_domain(rtc_dev), state->irq);
+ irq_assign(irq_owning_domain(rtc_dev), state->irq
, NULL
);
return 0;
}
return 0;
}
diff --git
a/lunaix-os/arch/x86/hal/ps2kbd.c
b/lunaix-os/arch/x86/hal/ps2kbd.c
index 44602919d697216aee22507d54de6357e6c62a2d..1df42bdb59ec0af1a1f4e34ebd39216241612227 100644
(file)
--- a/
lunaix-os/arch/x86/hal/ps2kbd.c
+++ b/
lunaix-os/arch/x86/hal/ps2kbd.c
@@
-311,8
+311,8
@@
ps2_kbd_create(struct device_def* devdef, morph_t* obj)
* 所以,保险的方法是:在初始化后才去设置ioapic,这样一来我们就能有一个稳定的IRQ#1以放心使用。
*/
* 所以,保险的方法是:在初始化后才去设置ioapic,这样一来我们就能有一个稳定的IRQ#1以放心使用。
*/
- irq_t irq = irq_declare_line(intr_ps2_kbd_handler, PC_AT_IRQ_KBD
, NULL
);
- irq_assign(irq_owning_domain(kbd_idev->dev_if), irq);
+ irq_t irq = irq_declare_line(intr_ps2_kbd_handler, PC_AT_IRQ_KBD);
+ irq_assign(irq_owning_domain(kbd_idev->dev_if), irq
, NULL
);
return 0;
return 0;
diff --git
a/lunaix-os/hal/ahci/ahci_pci.c
b/lunaix-os/hal/ahci/ahci_pci.c
index 6c4fddebaf18a681c92faa6533d68e02e1cca06b..2bc0ad979dcdb04a15d3b132b293cb5606053830 100644
(file)
--- a/
lunaix-os/hal/ahci/ahci_pci.c
+++ b/
lunaix-os/hal/ahci/ahci_pci.c
@@
-29,8
+29,8
@@
ahci_pci_create(struct device_def* def, morph_t* morphed)
assert(pci_capability_msi(probe));
assert(pci_capability_msi(probe));
- irq = pci_declare_msi_irq(ahci_hba_isr, probe
, NULL
);
- pci_assign_msi(probe, irq);
+ irq = pci_declare_msi_irq(ahci_hba_isr, probe);
+ pci_assign_msi(probe, irq
, NULL
);
struct ahci_driver_param param = {
.mmio_base = bar6->start,
struct ahci_driver_param param = {
.mmio_base = bar6->start,
diff --git
a/lunaix-os/hal/bus/pci.c
b/lunaix-os/hal/bus/pci.c
index 3e940e0b006a6a7e7c4a1f0c95e1add6ac3a6536..0543d0aef8e9ba943e58845b5ab8d1ab1ac22c0e 100644
(file)
--- a/
lunaix-os/hal/bus/pci.c
+++ b/
lunaix-os/hal/bus/pci.c
@@
-308,20
+308,19
@@
__pci_config_msi(struct pci_probe* probe, irq_t irq)
}
irq_t
}
irq_t
-pci_declare_msi_irq(irq_servant callback,
- struct pci_probe* probe, void *irq_extra)
+pci_declare_msi_irq(irq_servant callback, struct pci_probe* probe)
{
{
- return irq_declare_msg(callback, probe->loc, probe->loc
, irq_extra
);
+ return irq_declare_msg(callback, probe->loc, probe->loc);
}
int
}
int
-pci_assign_msi(struct pci_probe* probe, irq_t irq)
+pci_assign_msi(struct pci_probe* probe, irq_t irq
, void* irq_spec
)
{
int err = 0;
assert(irq->type == IRQ_MESSAGE);
{
int err = 0;
assert(irq->type == IRQ_MESSAGE);
- err = irq_assign(probe->irq_domain, irq);
+ err = irq_assign(probe->irq_domain, irq
, irq_spec
);
if (err) {
return err;
}
if (err) {
return err;
}
diff --git
a/lunaix-os/hal/char/uart/16x50_isa.c
b/lunaix-os/hal/char/uart/16x50_isa.c
index 7c82367e2d18f8625d0d074d6d9e533b406dfb1d..152317a5cdeb71dc97eace2d0c49287263b612cb 100644
(file)
--- a/
lunaix-os/hal/char/uart/16x50_isa.c
+++ b/
lunaix-os/hal/char/uart/16x50_isa.c
@@
-44,8
+44,8
@@
isa16x50_create_once(struct device_def* def)
* Since these irqs are overlapped, this particular setup is needed
* to avoid double-bind
*/
* Since these irqs are overlapped, this particular setup is needed
* to avoid double-bind
*/
- uart->irq = irq_declare_line(com_irq_handler, irq
, NULL
);
- irq_assign(irq_owning_domain(sdev->dev), uart->irq);
+ uart->irq = irq_declare_line(com_irq_handler, irq);
+ irq_assign(irq_owning_domain(sdev->dev), uart->irq
, NULL
);
*((volatile int*)irqs[i]) = 0;
}
*((volatile int*)irqs[i]) = 0;
}
diff --git
a/lunaix-os/hal/char/uart/16x50_pci.c
b/lunaix-os/hal/char/uart/16x50_pci.c
index 43e5326aa28bf1b115294b8e87eaa5b7fcc1dfab..bba016fd09959ec5994d183a1651b05838245569 100644
(file)
--- a/
lunaix-os/hal/char/uart/16x50_pci.c
+++ b/
lunaix-os/hal/char/uart/16x50_pci.c
@@
-92,9
+92,9
@@
pci16x50_pci_create(struct device_def* def, morph_t* obj)
sdev = uart_create_serial(uart, &def->class, &pci_ports, "PCI");
sdev = uart_create_serial(uart, &def->class, &pci_ports, "PCI");
- irq = pci_declare_msi_irq(uart_msi_irq_handler, probe
, NULL
);
+ irq = pci_declare_msi_irq(uart_msi_irq_handler, probe);
irq_set_payload(irq, uart);
irq_set_payload(irq, uart);
- pci_assign_msi(probe, irq);
+ pci_assign_msi(probe, irq
, NULL
);
INFO("base: 0x%x (%s), %s",
bar->start,
INFO("base: 0x%x (%s), %s",
bar->start,
diff --git
a/lunaix-os/hal/devtree/LBuild
b/lunaix-os/hal/devtree/LBuild
index 97f3109f78589eaa5b7cc2017f33fd0e349b0395..000d52b4ab085169fe27cb818476753cb1afd342 100644
(file)
--- a/
lunaix-os/hal/devtree/LBuild
+++ b/
lunaix-os/hal/devtree/LBuild
@@
-1,6
+1,6
@@
sources([
"dt_interrupt.c",
"dt.c",
sources([
"dt_interrupt.c",
"dt.c",
- "dtm.c"
+ "dtm.c"
,
"dtspec.c"
])
\ No newline at end of file
"dtspec.c"
])
\ No newline at end of file
diff --git
a/lunaix-os/hal/devtree/devtree.h
b/lunaix-os/hal/devtree/devtree.h
index 1bfe891b5b2540a3adcb9443bfde5a9560278f52..66fe7dc0c9bac28809f99607cc6e2caabc62475f 100644
(file)
--- a/
lunaix-os/hal/devtree/devtree.h
+++ b/
lunaix-os/hal/devtree/devtree.h
@@
-11,10
+11,16
@@
propeq(struct fdt_blob* fdt, fdt_loc_t loc, const char* key)
return streq(fdt_prop_key(fdt, loc), key);
}
return streq(fdt_prop_key(fdt, loc), key);
}
+static inline ptr_t
+__prop_val_ptr(struct fdt_prop* prop)
+{
+ return __ptr(prop) + sizeof(struct fdt_prop);
+}
+
static inline void
__mkprop_ptr(fdt_loc_t loc, struct dtp_val* val)
{
static inline void
__mkprop_ptr(fdt_loc_t loc, struct dtp_val* val)
{
- val->ptr_val = __p
tr(loc.prop->val
);
+ val->ptr_val = __p
rop_val_ptr(loc.prop
);
val->size = loc.prop->len;
}
val->size = loc.prop->len;
}
diff --git
a/lunaix-os/hal/devtree/dt.c
b/lunaix-os/hal/devtree/dt.c
index a4265512c5e7effc6d39f7a30821189e33239c4b..63286b10398f6aa714c3cc30d27da3d7378f8070 100644
(file)
--- a/
lunaix-os/hal/devtree/dt.c
+++ b/
lunaix-os/hal/devtree/dt.c
@@
-121,7
+121,7
@@
fdt_find_prop(const struct fdt_blob* fdt, fdt_loc_t loc,
}
if (likely(val)) {
}
if (likely(val)) {
- val->encoded = (dt_enc_t)
loc.prop->val
;
+ val->encoded = (dt_enc_t)
__prop_val_ptr(loc.prop)
;
val->size = loc.prop->len;
}
return true;
val->size = loc.prop->len;
}
return true;
@@
-152,6
+152,8
@@
fdt_memscan_begin(struct fdt_memscan* mscan, const struct fdt_blob* fdt)
mscan->loc = loc;
mscan->node_type = FDT_MEM_FREE;
mscan->loc = loc;
mscan->node_type = FDT_MEM_FREE;
+
+ return true;
}
#define get_size(mscan, val) \
}
#define get_size(mscan, val) \
diff --git
a/lunaix-os/hal/irq.c
b/lunaix-os/hal/irq.c
index 97bbb792c5379b9af8ab4c1e5c19a151f9bcdca7..cee67671070f8955cc8cf945daa9a1bbb4803e62 100644
(file)
--- a/
lunaix-os/hal/irq.c
+++ b/
lunaix-os/hal/irq.c
@@
-84,8
+84,7
@@
__irq_create_msi(irq_t irq, ptr_t message)
}
irq_t
}
irq_t
-irq_declare(enum irq_type type, irq_servant callback,
- ptr_t data, void* irq_extra)
+irq_declare(enum irq_type type, irq_servant callback, ptr_t data)
{
irq_t irq;
{
irq_t irq;
@@
-93,7
+92,6
@@
irq_declare(enum irq_type type, irq_servant callback,
*irq = (struct irq_object) {
.type = type,
.serve = callback ?: __default_servant,
*irq = (struct irq_object) {
.type = type,
.serve = callback ?: __default_servant,
- .irq_extra = irq_extra,
.vector = IRQ_VECTOR_UNSET
};
.vector = IRQ_VECTOR_UNSET
};
@@
-118,11
+116,11
@@
irq_revoke(irq_t irq)
}
int
}
int
-irq_assign(struct irq_domain* domain, irq_t irq)
+irq_assign(struct irq_domain* domain, irq_t irq
, void* irq_spec
)
{
int err = 0;
if (domain->ops->map_irq) {
{
int err = 0;
if (domain->ops->map_irq) {
- err = domain->ops->map_irq(domain, irq, irq
->irq_extra
);
+ err = domain->ops->map_irq(domain, irq, irq
_spec
);
if (err) {
return err;
}
if (err) {
return err;
}
diff --git
a/lunaix-os/includes/hal/devtree.h
b/lunaix-os/includes/hal/devtree.h
index ae18e31983e89011f06a72960d7b216bc850a2d9..111617e7626c786e3afa5c4af5780ab0da90b7b5 100644
(file)
--- a/
lunaix-os/includes/hal/devtree.h
+++ b/
lunaix-os/includes/hal/devtree.h
@@
-47,14
+47,14
@@
struct dtp_val
{
union
{
{
union
{
- union {
- const char* str_val;
- const char* str_lst;
- };
ptr_t ptr_val;
dt_enc_t encoded;
union dtp_baseval* ref;
ptr_t ptr_val;
dt_enc_t encoded;
union dtp_baseval* ref;
+ union {
+ const char* str_val;
+ const char* str_lst;
+ };
};
unsigned int size;
};
};
unsigned int size;
};
@@
-670,7
+670,7
@@
static inline void
dtpi_init_empty(struct dtpropi* dtpi)
{
*dtpi = (struct dtpropi) {
dtpi_init_empty(struct dtpropi* dtpi)
{
*dtpi = (struct dtpropi) {
- .prop = {
0
, 0 },
+ .prop = {
{0}
, 0 },
.loc = 0
};
}
.loc = 0
};
}
diff --git
a/lunaix-os/includes/hal/irq.h
b/lunaix-os/includes/hal/irq.h
index fc01e9438423cc4598dbd5a8f0b06bbdc3399920..41be4b07f9a758ce3ff39215ba8dda15d0810ab4 100644
(file)
--- a/
lunaix-os/includes/hal/irq.h
+++ b/
lunaix-os/includes/hal/irq.h
@@
-70,7
+70,6
@@
struct irq_object
void* payload;
struct irq_domain* domain;
void* payload;
struct irq_domain* domain;
- void* irq_extra;
int ref;
};
int ref;
};
@@
-84,13
+83,13
@@
int
irq_attach_domain(struct irq_domain* parent, struct irq_domain* child);
irq_t
irq_attach_domain(struct irq_domain* parent, struct irq_domain* child);
irq_t
-irq_declare(enum irq_type, irq_servant, ptr_t
, void*
);
+irq_declare(enum irq_type, irq_servant, ptr_t);
void
irq_revoke(irq_t);
int
void
irq_revoke(irq_t);
int
-irq_assign(struct irq_domain* domain, irq_t);
+irq_assign(struct irq_domain* domain, irq_t
, void*
);
irq_t
irq_find(struct irq_domain* domain, int local_irq);
irq_t
irq_find(struct irq_domain* domain, int local_irq);
@@
-141,17
+140,17
@@
irq_set_domain_object(struct irq_domain* domain, void* obj)
#define irq_domain_obj(domain, type) ((type*)(domain)->object)
static inline irq_t
#define irq_domain_obj(domain, type) ((type*)(domain)->object)
static inline irq_t
-irq_declare_line(irq_servant callback, int local_irq
, void* irq_extra
)
+irq_declare_line(irq_servant callback, int local_irq)
{
{
- return irq_declare(IRQ_LINE, callback, (int)local_irq
, irq_extra
);
+ return irq_declare(IRQ_LINE, callback, (int)local_irq);
}
static inline irq_t
irq_declare_msg(irq_servant callback,
}
static inline irq_t
irq_declare_msg(irq_servant callback,
- ptr_t message, ptr_t sideband
, void* irq_extra
)
+ ptr_t message, ptr_t sideband)
{
irq_t irq;
{
irq_t irq;
- irq = irq_declare(IRQ_MESSAGE, callback, message
, irq_extra
);
+ irq = irq_declare(IRQ_MESSAGE, callback, message);
irq->msi->sideband = sideband;
return irq;
irq->msi->sideband = sideband;
return irq;
@@
-160,7
+159,7
@@
irq_declare_msg(irq_servant callback,
static inline irq_t
irq_declare_direct(irq_servant callback)
{
static inline irq_t
irq_declare_direct(irq_servant callback)
{
- return irq_declare(IRQ_DIRECT, callback, 0
, NULL
);
+ return irq_declare(IRQ_DIRECT, callback, 0);
}
static inline struct irq_domain*
}
static inline struct irq_domain*
diff --git
a/lunaix-os/includes/hal/pci.h
b/lunaix-os/includes/hal/pci.h
index 81853c41678667a0b4633439ae518ba2fe7040d1..22b3dd918a5ff86c83bca5c29e8a707e8f86c691 100644
(file)
--- a/
lunaix-os/includes/hal/pci.h
+++ b/
lunaix-os/includes/hal/pci.h
@@
-117,11
+117,10
@@
size_t
pci_bar_sizing(struct pci_probe* probe, u32_t* bar_out, u32_t bar_num);
irq_t
pci_bar_sizing(struct pci_probe* probe, u32_t* bar_out, u32_t bar_num);
irq_t
-pci_declare_msi_irq(irq_servant callback,
- struct pci_probe* probe, void *irq_extra);
+pci_declare_msi_irq(irq_servant callback, struct pci_probe* probe);
int
int
-pci_assign_msi(struct pci_probe* probe, irq_t irq);
+pci_assign_msi(struct pci_probe* probe, irq_t irq
, void* irq_spec
);
/**
* @brief Bind an abstract device instance to the pci device
/**
* @brief Bind an abstract device instance to the pci device
diff --git
a/lunaix-os/tests/units/device-tree/makefile
b/lunaix-os/tests/units/device-tree/makefile
index c88c2f69ab53506f851017f84c8cdd1b45cf1a64..b008c5fb39ebeb32a18fe2f5513a8aaead9813ba 100644
(file)
--- a/
lunaix-os/tests/units/device-tree/makefile
+++ b/
lunaix-os/tests/units/device-tree/makefile
@@
-4,7
+4,7
@@
obj-dut := dut/dt_interrupt.o \
dut/changeling.o
BIN_DEPS += load.%.o
dut/changeling.o
BIN_DEPS += load.%.o
-CFLAGS += -DCONFIG_USE_DEVICETREE
+CFLAGS += -DCONFIG_USE_DEVICETREE
-Wp,-w
.PRECIOUS: %.dtb
%.dtb: %.dts
.PRECIOUS: %.dtb
%.dtb: %.dts