Adding upstream version 4.00~pre54+dfsg.
[syslinux-debian/hramrach.git] / com32 / lib / pci / bios.c
blobb3c2c57dc9949d37eae1cac0fbede4f791958037
1 #include <com32.h>
2 #include <string.h>
3 #include "pci/pci.h"
5 uint32_t __pci_read_write_bios(uint32_t call, uint32_t v, pciaddr_t a)
7 com32sys_t rs;
8 memset(&rs, 0, sizeof rs);
9 rs.eax.w[0] = call;
10 rs.ebx.w[0] = a >> 8; /* bus:device:function */
11 rs.edi.b[0] = a; /* address:reg */
12 rs.ecx.l = v;
13 rs.eflags.l = EFLAGS_CF;
14 __intcall(0x1a, &rs, &rs);
16 return (rs.eflags.l & EFLAGS_CF) ? ~(uint32_t) 0 : rs.ecx.l;