modified to expose the PCI "native" driver interface (this is different
from the PCIBIOS) to TOS
This commit is contained in:
@@ -124,6 +124,19 @@ static struct pci_bios_interface pci_interface =
|
||||
.phys_to_virt = wrapper_phys_to_virt,
|
||||
};
|
||||
|
||||
static struct pci_native_driver_interface pci_native_interface =
|
||||
{
|
||||
.pci_read_config_longword = pci_read_config_longword,
|
||||
.pci_read_config_word = pci_read_config_longword,
|
||||
.pci_read_config_byte = pci_read_config_byte,
|
||||
.pci_write_config_longword = pci_write_config_longword,
|
||||
.pci_write_config_word = pci_write_config_word,
|
||||
.pci_write_config_byte = pci_write_config_byte,
|
||||
.pci_hook_interrupt = pci_hook_interrupt,
|
||||
.pci_unhook_interrupt = pci_unhook_interrupt,
|
||||
.pci_get_resource = pci_get_resource,
|
||||
};
|
||||
|
||||
/*
|
||||
* driver interface struct for the BaS framebuffer video driver
|
||||
*/
|
||||
@@ -187,6 +200,14 @@ static struct generic_interface interfaces[] =
|
||||
.revision = 1,
|
||||
.interface.mmu = &mmu_interface,
|
||||
},
|
||||
{
|
||||
.type = PCI_NATIVE_DRIVER,
|
||||
.name = "PCI_N",
|
||||
.description = "BaS PCI native",
|
||||
.version = 0,
|
||||
.revision = 1,
|
||||
.interface.pci_native = &pci_native_interface,
|
||||
},
|
||||
/* insert new drivers here */
|
||||
|
||||
{
|
||||
|
||||
@@ -38,6 +38,7 @@ enum driver_type
|
||||
VIDEO_DRIVER,
|
||||
PCI_DRIVER,
|
||||
MMU_DRIVER,
|
||||
PCI_NATIVE_DRIVER,
|
||||
END_OF_DRIVERS = 0xffffffff, /* marks end of driver list */
|
||||
};
|
||||
|
||||
@@ -270,6 +271,21 @@ struct mmu_driver_interface
|
||||
uint32_t (*report_pagesize)(void);
|
||||
};
|
||||
|
||||
struct pci_native_driver_interface
|
||||
{
|
||||
uint32_t (*pci_read_config_longword)(int32_t handle, int offset);
|
||||
uint16_t (*pci_read_config_word)(int32_t handle, int offset);
|
||||
uint8_t (*pci_read_config_byte)(int32_t handle, int offset);
|
||||
|
||||
int32_t (*pci_write_config_longword)(int32_t handle, int offset, uint32_t value);
|
||||
int32_t (*pci_write_config_word)(int32_t handle, int offset, uint16_t value);
|
||||
int32_t (*pci_write_config_byte)(int32_t handle, int offset, uint8_t value);
|
||||
int32_t (*pci_hook_interrupt)(int32_t handle, void *handler, void *parameter);
|
||||
int32_t (*pci_unhook_interrupt)(int32_t handle);
|
||||
|
||||
struct pci_rd (*pci_get_resource)(int32_t handle);
|
||||
};
|
||||
|
||||
union interface
|
||||
{
|
||||
struct generic_driver_interface *gdi;
|
||||
@@ -278,6 +294,7 @@ union interface
|
||||
struct framebuffer_driver_interface *fb;
|
||||
struct pci_bios_interface *pci;
|
||||
struct mmu_driver_interface *mmu;
|
||||
struct pci_native_driver_interface *pci_native;
|
||||
};
|
||||
|
||||
struct generic_interface
|
||||
|
||||
@@ -86,6 +86,7 @@ void setcookie(uint32_t cookie, uint32_t value)
|
||||
}
|
||||
|
||||
#define COOKIE_DMAC 0x444d4143L /* FireTOS DMA API */
|
||||
#define COOKIE_BAS_ 0x4241535fL /* BAS_ cookie (points to driver table struct */
|
||||
|
||||
static char *dt_to_str(enum driver_type dt)
|
||||
{
|
||||
@@ -98,6 +99,7 @@ static char *dt_to_str(enum driver_type dt)
|
||||
case MCD_DRIVER: return "multichannel DMA driver";
|
||||
case PCI_DRIVER: return "PCI interface driver";
|
||||
case MMU_DRIVER: return "MMU lock/unlock pages driver";
|
||||
case PCI_NATIVE_DRIVER: return "PCI interface native driver";
|
||||
default: return "unknown driver type";
|
||||
}
|
||||
}
|
||||
@@ -114,6 +116,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
ssp = (void *) Super(0L); /* go to supervisor mode, we are doing dirty tricks */
|
||||
sig = * (long *)((*sysbase) + 0x2c);
|
||||
|
||||
/*
|
||||
* first check if we are on EmuTOS, FireTOS want's to do everything itself
|
||||
*/
|
||||
@@ -144,6 +147,12 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
ifc++;
|
||||
}
|
||||
|
||||
/*
|
||||
* set cookie to be able to find the driver table later on
|
||||
*/
|
||||
setcookie(COOKIE_BAS_, (uint32_t) dt);
|
||||
printf("BAS_ cookie set to %p\r\n", dt);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user