Page 1 of 2
I can't get interrupt from PCI devices after boot from UEFI
Posted: Mon Feb 07, 2022 12:00 pm
by nifanfa
HI. i moved my os bootloader from multiboot to UEFI. but since i use UEFI as bootloader and booted to my os i can't get any interrupt from PCI devices (PIT and ps2 keyboard/mouse still work).
And i have already cleared PIC mask and cleared bits10 of PCI command register. i'm still using i8259 pic controller. will that a problem of APIC? if so how can i disable it?
Re: I can't get interrupt from PCI devices after boot from U
Posted: Mon Feb 07, 2022 12:04 pm
by nifanfa
Re: I can't get interrupt from PCI devices after boot from U
Posted: Mon Feb 07, 2022 7:02 pm
by Ethin
You shouldn't be using the PIC or PIT if your booting from UEFI. You should use the LAPIC or X2APIC in that case.
Re: I can't get interrupt from PCI devices after boot from U
Posted: Mon Feb 07, 2022 7:31 pm
by Octocontrabass
The PIC and PIT should still work, even if using them isn't a good idea. Future PCs will most likely get rid of them, so you need to use ACPI to determine whether they exist.
Does UEFI program the correct values into the interrupt line field in the PCI configuration space? If it doesn't, you'll have to use some other method (ACPI?) to track down the correct interrupt vectors.
The firmware will initialize the network adapter for booting over the network. Does your initialization code properly reset the network adapter? Have you tried any other PCI devices?
Re: I can't get interrupt from PCI devices after boot from U
Posted: Mon Feb 07, 2022 7:54 pm
by nifanfa
Octocontrabass wrote:The PIC and PIT should still work, even if using them isn't a good idea. Future PCs will most likely get rid of them, so you need to use ACPI to determine whether they exist.
Does UEFI program the correct values into the interrupt line field in the PCI configuration space? If it doesn't, you'll have to use some other method (ACPI?) to track down the correct interrupt vectors.
The firmware will initialize the network adapter for booting over the network. Does your initialization code properly reset the network adapter? Have you tried any other PCI devices?
yeah. i have tried two devices. rtl 8139 and e1000. both of them not work
Re: I can't get interrupt from PCI devices after boot from U
Posted: Mon Feb 07, 2022 8:09 pm
by Octocontrabass
nifanfa wrote:rtl 8139 and e1000
Have you tried any PCI devices that are not network adapters?
Does UEFI program the correct values into the interrupt line field in the PCI configuration space?
Re: I can't get interrupt from PCI devices after boot from U
Posted: Tue Feb 08, 2022 2:45 am
by nifanfa
Octocontrabass wrote:nifanfa wrote:rtl 8139 and e1000
Have you tried any PCI devices that are not network adapters?
Does UEFI program the correct values into the interrupt line field in the PCI configuration space?
idk. i just use uefi to load the os and get gop. i didn't use anything of PCI in uefi.
i also read device's pci configuration space. the value are the same nomatter i use multiboot or uefi. but it just can't get any interrupt.
and i tried to use APIC too. but it still can't get any interrupt.
Re: I can't get interrupt from PCI devices after boot from U
Posted: Tue Feb 08, 2022 2:45 am
by nifanfa
Octocontrabass wrote:nifanfa wrote:rtl 8139 and e1000
Have you tried any PCI devices that are not network adapters?
Does UEFI program the correct values into the interrupt line field in the PCI configuration space?
and i don't have any other driver which use PCI and have interrupt.
Re: I can't get interrupt from PCI devices after boot from U
Posted: Tue Feb 08, 2022 4:13 am
by nifanfa
Octocontrabass wrote:nifanfa wrote:rtl 8139 and e1000
Have you tried any PCI devices that are not network adapters?
Does UEFI program the correct values into the interrupt line field in the PCI configuration space?
i also noticed that irq 0x2B seemed to be overritten. and in that case what should be the real interrupt for 0x2B?
Re: I can't get interrupt from PCI devices after boot from U
Posted: Tue Feb 08, 2022 4:16 am
by nifanfa
nvm 11 = B
Re: I can't get interrupt from PCI devices after boot from U
Posted: Tue Feb 08, 2022 6:17 am
by Ethin
Did you enable interrupts in the network adaptor?
Re: I can't get interrupt from PCI devices after boot from U
Posted: Tue Feb 08, 2022 6:29 am
by nifanfa
Ethin wrote:Did you enable interrupts in the network adaptor?
yes. by clearing interrupt mask(legacy pic). by setting entry(io apic). by writting device register to enable device. enable bus mastering in pci,enable device io,memory but still no interrupt can be triggered. like i said. it works fine if i boot it using multiboot.
Re: I can't get interrupt from PCI devices after boot from U
Posted: Tue Feb 08, 2022 6:33 am
by nifanfa
and i also soft-reseted the device
Re: I can't get interrupt from PCI devices after boot from U
Posted: Wed Feb 09, 2022 12:49 am
by nifanfa
Re: I can't get interrupt from PCI devices after boot from U
Posted: Wed Feb 09, 2022 2:07 am
by nifanfa
Ethin wrote:Did you enable interrupts in the network adaptor?
and it works if i use PIT's interrupt. but i just can't get the interrupt from the device.