Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pcibios_enable_memmap_set_master_all, fix PCI command register width #74

Merged
merged 3 commits into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions mpxplay/au_cards/pcibios.c
Original file line number Diff line number Diff line change
Expand Up @@ -317,26 +317,34 @@ void pcibios_WriteConfig_Dword(pci_config_s * ppkey, uint16_t wAdr, uint32_t dwD
void pcibios_set_master(pci_config_s *ppkey)
{
unsigned int cmd;
cmd=pcibios_ReadConfig_Byte(ppkey, PCIR_PCICMD);
cmd=pcibios_ReadConfig_Word(ppkey, PCIR_PCICMD);
cmd|=0x01|0x04;
pcibios_WriteConfig_Byte(ppkey, PCIR_PCICMD, cmd);
pcibios_WriteConfig_Word(ppkey, PCIR_PCICMD, cmd);
}

void pcibios_enable_memmap_set_master(pci_config_s *ppkey)
{
unsigned int cmd;
cmd=pcibios_ReadConfig_Byte(ppkey, PCIR_PCICMD);
cmd=pcibios_ReadConfig_Word(ppkey, PCIR_PCICMD);
cmd&=~0x01; // disable io-port mapping
cmd|=0x02|0x04; // enable memory mapping and set master
pcibios_WriteConfig_Byte(ppkey, PCIR_PCICMD, cmd);
pcibios_WriteConfig_Word(ppkey, PCIR_PCICMD, cmd);
}

void pcibios_enable_memmap_set_master_all(pci_config_s *ppkey)
{
unsigned int cmd;
cmd=pcibios_ReadConfig_Word(ppkey, PCIR_PCICMD);
cmd|=0x01|0x02|0x04; // enable io-port mapping and memory mapping and set master
pcibios_WriteConfig_Word(ppkey, PCIR_PCICMD, cmd);
}

void pcibios_enable_interrupt(pci_config_s* ppkey)
{
unsigned int cmd;
cmd=pcibios_ReadConfig_Byte(ppkey, PCIR_PCICMD);
cmd=pcibios_ReadConfig_Word(ppkey, PCIR_PCICMD);
cmd &= ~(1<<10);
pcibios_WriteConfig_Byte(ppkey, PCIR_PCICMD, cmd);
pcibios_WriteConfig_Word(ppkey, PCIR_PCICMD, cmd);
}

typedef struct
Expand Down Expand Up @@ -611,4 +619,4 @@ uint8_t pcibios_AssignIRQ(pci_config_s* ppkey)
free(table);
return irq;
}
#undef BUFSIZE
#undef BUFSIZE
1 change: 1 addition & 0 deletions mpxplay/au_cards/pcibios.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ void pcibios_WriteConfig_Dword(pci_config_s *, uint16_t, uint32_t);
void pcibios_set_master(pci_config_s *);
void pcibios_enable_interrupt(pci_config_s*);
void pcibios_enable_memmap_set_master(pci_config_s *);
void pcibios_enable_memmap_set_master_all(pci_config_s *);

uint8_t pcibios_AssignIRQ(pci_config_s*); //try to assign IRQ from PCI IRQ routing options.

Expand Down
2 changes: 1 addition & 1 deletion sbemu/serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ ser_setup(int stype, unsigned int sdev)

if (iobase == 0) {
if (sdev != 0) {
printf("Invalid COM port %d", sdev);
printf("Invalid COM port %d\n", sdev);
return 1;
} else {
return 0;
Expand Down