aboutsummaryrefslogtreecommitdiffstats
path: root/com32/lib/pci/readbios.c
blob: f8ff3bff94698ed60f73e60c40b13789d716b315 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <com32.h>
#include <string.h>
#include "pci/pci.h"

uint32_t __pci_read_bios(uint32_t call, pciaddr_t a)
{
    com32sys_t rs;
    memset(&rs, 0, sizeof rs);
    rs.eax.w[0] = call;
    rs.ebx.w[0] = a >> 8;	/* bus:device:function */
    rs.edi.b[0] = a;		/* address:reg */
    __intcall(0x1a, &rs, &rs);

    return (rs.eflags.l & EFLAGS_CF) ? ~(uint32_t) 0 : rs.ecx.l;
}