Skip to content

Commit

Permalink
fix: bug on dma alloc buffer & ahci driver
Browse files Browse the repository at this point in the history
  • Loading branch information
hzcx998 committed Mar 1, 2021
1 parent 3f90449 commit 30ba958
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,11 @@ QEMU_KVM := # no virutal
QEMU_ARGUMENT = -m 1024M $(QEMU_KVM) \
-name "XBOOK Development Platform for x86" \
-fda $(FLOPPYA_IMG) \
-hda $(HDA_IMG) -hdb $(HDB_IMG) \
-drive id=disk0,file=$(HDA_IMG),if=none \
-drive id=disk1,file=$(HDB_IMG),if=none \
-device ahci,id=ahci \
-device ide-drive,drive=disk0,bus=ahci.0 \
-device ide-drive,drive=disk1,bus=ahci.1 \
-boot a \
-soundhw sb16 \
-serial stdio \
Expand Down
2 changes: 1 addition & 1 deletion TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
* 2021/2/22
* 移植bash,把缺少的函数补上,不做具体实现。
{
接口:sys/times, unistd/id.c,tcgetattr, tcsetattr,pwd.c
接口:unistd/id.c,tcgetattr, tcsetattr,pwd.c
gethostname, umask, termios.c,mkfifo
修改:signames.h改成bookos的,
处理:SIGTSTP
Expand Down
3 changes: 2 additions & 1 deletion src/arch/x86/mach-i386/drivers/ahci.c
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,8 @@ int ahci_initialize_device(struct hba_memory *abar, device_extension_t *dev)
for(i=0;i<HBA_COMMAND_HEADER_NUM;i++) {
dev->ch_dmas[i].p.size = 0x1000;
dev->ch_dmas[i].p.alignment = 0x1000;
dma_alloc_buffer(&dev->ch_dmas[i]);
dev->ch_dmas[i].flags = DMA_REGION_SPECIAL;
dma_alloc_buffer(&dev->ch_dmas[i]);
dev->ch[i] = (void *)dev->ch_dmas[i].v;
memset(h, 0, sizeof(*h));
h->command_table_base_l = low32(dev->ch_dmas[i].p.address);
Expand Down
2 changes: 1 addition & 1 deletion src/vmm/dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ int dma_alloc_buffer(struct dma_region *d)
return -1;
vaddr = (addr_t) kern_phy_addr2vir_addr(d->p.address);
} else { // normal
d->p.address = page_alloc_user(npages);
d->p.address = page_alloc_normal(npages);
if(d->p.address == 0)
return -1;

Expand Down

0 comments on commit 30ba958

Please sign in to comment.