I can't get interrupt from PCI devices after boot from UEFI

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
nifanfa
Member
Member
Posts: 104
Joined: Tue Aug 17, 2021 10:40 am
Libera.chat IRC: visitor
Location: CN
Contact:

I can't get interrupt from PCI devices after boot from UEFI

Post 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?
Ethin
Member
Member
Posts: 625
Joined: Sun Jun 23, 2019 5:36 pm
Location: North Dakota, United States

Re: I can't get interrupt from PCI devices after boot from U

Post 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.
Octocontrabass
Member
Member
Posts: 5563
Joined: Mon Mar 25, 2013 7:01 pm

Re: I can't get interrupt from PCI devices after boot from U

Post 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?
nifanfa
Member
Member
Posts: 104
Joined: Tue Aug 17, 2021 10:40 am
Libera.chat IRC: visitor
Location: CN
Contact:

Re: I can't get interrupt from PCI devices after boot from U

Post 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
Octocontrabass
Member
Member
Posts: 5563
Joined: Mon Mar 25, 2013 7:01 pm

Re: I can't get interrupt from PCI devices after boot from U

Post 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?
nifanfa
Member
Member
Posts: 104
Joined: Tue Aug 17, 2021 10:40 am
Libera.chat IRC: visitor
Location: CN
Contact:

Re: I can't get interrupt from PCI devices after boot from U

Post 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.
nifanfa
Member
Member
Posts: 104
Joined: Tue Aug 17, 2021 10:40 am
Libera.chat IRC: visitor
Location: CN
Contact:

Re: I can't get interrupt from PCI devices after boot from U

Post 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.
nifanfa
Member
Member
Posts: 104
Joined: Tue Aug 17, 2021 10:40 am
Libera.chat IRC: visitor
Location: CN
Contact:

Re: I can't get interrupt from PCI devices after boot from U

Post 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?
Image
nifanfa
Member
Member
Posts: 104
Joined: Tue Aug 17, 2021 10:40 am
Libera.chat IRC: visitor
Location: CN
Contact:

Re: I can't get interrupt from PCI devices after boot from U

Post by nifanfa »

nvm 11 = B
Ethin
Member
Member
Posts: 625
Joined: Sun Jun 23, 2019 5:36 pm
Location: North Dakota, United States

Re: I can't get interrupt from PCI devices after boot from U

Post by Ethin »

Did you enable interrupts in the network adaptor?
nifanfa
Member
Member
Posts: 104
Joined: Tue Aug 17, 2021 10:40 am
Libera.chat IRC: visitor
Location: CN
Contact:

Re: I can't get interrupt from PCI devices after boot from U

Post 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.
nifanfa
Member
Member
Posts: 104
Joined: Tue Aug 17, 2021 10:40 am
Libera.chat IRC: visitor
Location: CN
Contact:

Re: I can't get interrupt from PCI devices after boot from U

Post by nifanfa »

and i also soft-reseted the device
nifanfa
Member
Member
Posts: 104
Joined: Tue Aug 17, 2021 10:40 am
Libera.chat IRC: visitor
Location: CN
Contact:

Re: I can't get interrupt from PCI devices after boot from U

Post by nifanfa »

nifanfa
Member
Member
Posts: 104
Joined: Tue Aug 17, 2021 10:40 am
Libera.chat IRC: visitor
Location: CN
Contact:

Re: I can't get interrupt from PCI devices after boot from U

Post 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.
Post Reply