commit d81db8cae5a76791fc0ce05ea92db74b96522e8e
parent 9b195c65bde947d415ef0528444ade3ff48e58ae
Author: Matsuda Kenji <info@mtkn.jp>
Date: Mon, 6 May 2024 07:54:34 +0900
use BIR
Diffstat:
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/sys/src/kernel/main.c b/sys/src/kernel/main.c
@@ -143,16 +143,15 @@ kernel_main(EFI_GRAPHICS_OUTPUT_PROTOCOL *gop)
// enable msi-x
msix_cap->message_control |= 1 << 15;
cons_printf(&con0, "message control: %x\n", msix_cap->message_control);
- MSIXTab msixtab = (MSIXTab)(xhc.base + (msix_cap->table_offset&~0x3));
- // TODO: select which BAR to use by the lower bits of table_offset.
+ int bir = (int) msix_cap->table_offset&0x3;
+ uintptr bar = ((uintptr) pci_xhc->t0.base_address_register[bir+1]) << 32 |
+ (pci_xhc->t0.base_address_register[bir]&0xfffffff0);
+ MSIXTab msixtab = (MSIXTab)(bar + (msix_cap->table_offset&~0x3));
+
cons_printf(&con0, "capability_id: %x\n", msix_cap->capability_id);
cons_printf(&con0, "next_pointer: %x\n", msix_cap->next_pointer);
cons_printf(&con0, "table_offset: %x\n", msix_cap->table_offset);
cons_printf(&con0, "pba_offset: %x\n", msix_cap->pba_offset);
- for (int i = 0; i < (msix_cap->message_control&0xf) + 1; i++) {
- cons_printf(&con0, "msixtab[%d]:\n\tmsgaddr:\t%x\n\tvectorcontrol:\t%x\n",
- i, msixtab[i], msixtab[i].VectorControl);
- }
cons_printf(&con0, "msgaddr:\t%x\nmsgupperaddr:\t%x\nmsgdata:\t%x\nvectorcontrol:\t%x\n",
msixtab[0].MsgAddr, msixtab[0].MsgUpperAddr,
msixtab[0].MsgData, msixtab[0].VectorControl);