Skip to content

Commit

Permalink
Merge pull request #74 from jiyunomegami/forupstream2
Browse files Browse the repository at this point in the history
pcibios_enable_memmap_set_master_all, fix PCI command register width
  • Loading branch information
crazii authored Jan 18, 2024
2 parents 9078db6 + aff3651 commit 6327014
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
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

0 comments on commit 6327014

Please sign in to comment.