OSDev.org

The Place to Start for Operating System Developers
It is currently Tue Apr 16, 2024 2:10 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: UEFI :: PIC problems
PostPosted: Sat Mar 09, 2024 2:59 pm 
Offline
Member
Member

Joined: Tue Aug 30, 2016 1:31 pm
Posts: 69
Hello everyone,

I have a question about UEFI and PIC.
I have 6 testing computers, where 3 of them have UEFI.
I test UEFI with qemu too.

On QEMU and 2 of me real hardware,
Code:
    #define PIC1      0x20      /* IO base address for master PIC */
    #define PIC2      0xA0      /* IO base address for slave PIC */
    #define PIC1_COMMAND   PIC1
    #define PIC1_DATA   (PIC1+1)
    #define PIC2_COMMAND   PIC2
    #define PIC2_DATA   (PIC2+1)

    #define ICW1_ICW4   0x01      /* ICW4 (not) needed */
    #define ICW1_SINGLE   0x02      /* Single (cascade) mode */
    #define ICW1_INTERVAL4   0x04      /* Call address interval 4 (8) */
    #define ICW1_LEVEL   0x08      /* Level triggered (edge) mode */
    #define ICW1_INIT   0x10      /* Initialization - required! */

    #define ICW4_8086   0x01      /* 8086/88 (MCS-80/85) mode */
    #define ICW4_AUTO   0x02      /* Auto (normal) EOI */
    #define ICW4_BUF_SLAVE   0x08      /* Buffered mode/slave */
    #define ICW4_BUF_MASTER   0x0C      /* Buffered mode/master */
    #define ICW4_SFNM   0x10      /* Special fully nested (not) */

    uint8_t idtoffsetcode = 0x20;

    uint8_t oldpic1 = inportb(PIC1_DATA);
    uint8_t oldpic2 = inportb(PIC2_DATA);
   
    outportb(PIC1, 0x11);
    outportb(PIC2, 0x11);
    outportb(PIC1_DATA, idtoffsetcode);
    outportb(PIC2_DATA, idtoffsetcode + 8);
    outportb(PIC1_DATA, ICW1_INTERVAL4);
    outportb(PIC2_DATA, ICW1_SINGLE);
    outportb(PIC1_DATA, ICW1_ICW4);
    outportb(PIC2_DATA, ICW1_ICW4);
    outportb(PIC1_DATA, 0x0);
    outportb(PIC2_DATA, 0x0);
    outportb(PIC1_DATA,oldpic1);
    outportb(PIC2_DATA,oldpic2);

works perfectly. but on one hardware it does trigger a tripple fault and resets.
Does anyone have a idea how this is possible?


Top
 Profile  
 
 Post subject: Re: UEFI :: PIC problems
PostPosted: Sat Mar 09, 2024 3:16 pm 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5134
If you haven't called ExitBootServices(), you can't touch the PIC because the firmware might be using it.

If ACPI says there isn't a PIC, you can't touch the PIC because it doesn't exist.

SanderR wrote:
Code:
    outportb(PIC1_DATA,oldpic1);
    outportb(PIC2_DATA,oldpic2);

You're reusing the firmware's interrupt mask instead of setting your own. You might receive an interrupt that you're not prepared to handle.


Top
 Profile  
 
 Post subject: Re: UEFI :: PIC problems
PostPosted: Sun Mar 10, 2024 2:06 am 
Offline
Member
Member

Joined: Tue Aug 30, 2016 1:31 pm
Posts: 69
Yes!
The reusing of the firmwares interrupt mask was the problem!
Thanks allot!

I set them all to 0 and enable it whenever I use it, and its working now!
Code:
outportb(PIC1_DATA, 0);
outportb(PIC2_DATA, 0);


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 422 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group