From 2baa2d6adf2fc9bddb9b4bf439b42ac3bd4906ba Mon Sep 17 00:00:00 2001 From: John Hodge Date: Sat, 5 Oct 2013 17:21:19 +0800 Subject: [PATCH] Modules/UDI - Minor tweaks --- .../Modules/Interfaces/UDI/include/udi_physio.h | 4 ++++ KernelLand/Modules/Interfaces/UDI/trans/bus_pci.c | 14 +++++++++++++- .../Modules/Interfaces/UDI/udi_lib/physio/pio.c | 4 ++-- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/KernelLand/Modules/Interfaces/UDI/include/udi_physio.h b/KernelLand/Modules/Interfaces/UDI/include/udi_physio.h index 74fd34c1..f5c3ab15 100644 --- a/KernelLand/Modules/Interfaces/UDI/include/udi_physio.h +++ b/KernelLand/Modules/Interfaces/UDI/include/udi_physio.h @@ -6,6 +6,10 @@ #include +//#ifndef UDI_PHYSIO_VERSION +//# error "UDI_PHYSIO_VERSION must be defined" +//#endif + // === TYPEDEFS === // DMA Core typedef _udi_handle_t udi_dma_handle_t; diff --git a/KernelLand/Modules/Interfaces/UDI/trans/bus_pci.c b/KernelLand/Modules/Interfaces/UDI/trans/bus_pci.c index 0dac0c2b..32f2eea7 100644 --- a/KernelLand/Modules/Interfaces/UDI/trans/bus_pci.c +++ b/KernelLand/Modules/Interfaces/UDI/trans/bus_pci.c @@ -7,6 +7,7 @@ */ #include #include +#include #include #include // acess @@ -103,7 +104,16 @@ void pci_enumerate_req(udi_enumerate_cb_t *cb, udi_ubit8_t enumeration_level) Uint16 ven, dev; Uint32 class; PCI_GetDeviceInfo(rdata->cur_iter, &ven, &dev, &class); - + Uint8 revision; + PCI_GetDeviceVersion(rdata->cur_iter, &revision); + Uint16 sven, sdev; + PCI_GetDeviceSubsys(rdata->cur_iter, &sven, &sdev); + + udi_strcpy(attr_list->attr_name, "identifier"); + attr_list->attr_length = snprintf(attr_list->attr_value, + "%04x%04x%02x%04x%04x", + ven, dev, revision, sven, sdev); + attr_list ++; DPT_SET_ATTR_STRING(attr_list, "bus_type", "pci", 3); attr_list ++; DPT_SET_ATTR32(attr_list, "pci_vendor_id", ven); @@ -133,6 +143,8 @@ void pci_bridge_ch_event_ind(udi_channel_event_cb_t *cb) } void pci_bind_req(udi_bus_bind_cb_t *cb) { + // TODO: "Lock" PCI device + // TODO: DMA constraints udi_bus_bind_ack(cb, 0, UDI_DMA_LITTLE_ENDIAN, UDI_OK); } diff --git a/KernelLand/Modules/Interfaces/UDI/udi_lib/physio/pio.c b/KernelLand/Modules/Interfaces/UDI/udi_lib/physio/pio.c index a4825909..b70861bd 100644 --- a/KernelLand/Modules/Interfaces/UDI/udi_lib/physio/pio.c +++ b/KernelLand/Modules/Interfaces/UDI/udi_lib/physio/pio.c @@ -24,7 +24,7 @@ void udi_pio_map(udi_pio_map_call_t *callback, udi_cb_t *gcb, udi_instance_attr_type_t type; type = udi_instance_attr_get_internal(gcb, "bus_type", 0, bus_type, sizeof(bus_type), NULL); if(type != UDI_ATTR_STRING) { - callback(gcb, UDI_NULL_HANDLE); + callback(gcb, UDI_NULL_PIO_HANDLE); return ; } @@ -33,7 +33,7 @@ void udi_pio_map(udi_pio_map_call_t *callback, udi_cb_t *gcb, } else { // Oops, unknown - callback(gcb, UDI_NULL_HANDLE); + callback(gcb, UDI_NULL_PIO_HANDLE); return ; } } -- 2.20.1