USB driver, terminal enhancements, sdhost fix and nullptr replacement - #70
Draft
Dreaded-Gnu wants to merge 201 commits into
Draft
USB driver, terminal enhancements, sdhost fix and nullptr replacement#70Dreaded-Gnu wants to merge 201 commits into
Dreaded-Gnu wants to merge 201 commits into
Conversation
- Removed test code at the end of init_stage2 - Added call to configuration_handle in init_stage3 - Added libhcd defines - Added peripheral usb defines - Fixed dynamic link flags - Changed usb servers to link statically - Replaced early startup print in usb servers by startup print - Moved debug output in iomem dma into defined checks - Started with error response for hcd
- Extended response enum by einval - Added call to dwhci_init within main - Created dwhci init and query vendor
- Added function to power on usb device - Added call to power on usb device in dwhci init - Added rpc init and rpc handle interrupt to dwhci - Added bind of interrupt within rpc init - Added call to rpc init before setup of hcd interface - Added function to disable and enable interrupts - Added empty functions to init core and init host - Replaced magic interrupt numbers by defines - Added whitelist of usb interrupt to raspi target in kernel
- Added new generic libhcd and libusb to server folder - Adjusted include guards of raspi platform lib files - Added new empty submit control message rpc to hcd server later used by usbd - Added enable rpc, send of device file and wait for rpc to hcd server
- Added hct_submit_control_message_t type for hcd rpc - Filled submit_control_message rpc with a bit of logic to at least read message from mailbox
…init - Generated usb device structure used by usbd
…force cache drain - some ongoing const changes - Added define for hcd device path - Replaced magic string in hcd server by define - Adjusted message for hcd submit control message to expect it put into shared area - Created helpers to transfer packet size from number into type and vice versa - Created helper to translate usb speed into strings - Added hub structures to libusb - Extended libhcd by power registers and completed host port registers - Temporarily commented out dma for usb - Made fd_iomem non static since it is required in new root hub function - Added new dwhci function to write host port - Added dwhciroothub function necessary for root hub init - Revised submit_control_message rpc to map shared memory and perform root hub process if set - First iteration of usbd yet without enumeration of connected devices
…bit up during testin
- Added populate of device path, yet without any rpc bound to it
- Added some newlines where it was missing in STARTUP_PRINT - Started working on hub driver while working on usbd necessary for enumeration
- Added rpc structures for register and unregister device handler - Added rpc handler for register and unregister device handler
- Added new libusb library to abstract communication with usbd a bit - Added two new rpcs, one for performing control message and one to get description - Added init of usb library to hub driver - Started implementing usb hub init
- Cleaned up usb library to reduce the message sizes - Replaced pass of libusb_device_t by pass of necessary stuff - Created new usbd endpoints for fetching endpoint and interface - Revised startup to startup usbd and all related daemons before starting hcd -
- Added sleep to stage 3 init - Added documentation to dwhci functions - Encapsulated all startup prints by dwhci enable debug define in dwhci - Cleaned up dwhci include - Temporarily enabled data abort exception printing - Fixed usbd_read_string to use wctob to translate wide char to char
…orted - Updated readme regarding qemu commands - Added qemu cdc lan to usbd_get_description - Splitted up usb server related stuff from libusb into libusbd
- Added hub rpc defines - Updated device_info of hub main used for registering path - Created empty rpc for check change, check connection, child detach, child reset and detach - Adjusted hub init to bind rpc handlers - Added new hid device acting as connector between usbd and keyboard and mouse
- Reokaced device driver hub define by enum - Added hid, keyboard and mouse to device driver enum
- Extended image.nim to generate home user directory
- Added plain kasan library with minimum necessary functions doing nothing right now - Added sanitize option kernel-address when building with debug symbols
- Added own heap implementation for kasan
- Added extra linker scripts when sanitizer is active with fixed sanitizer memory - Added new has sanitizer conditional to kernel configure.ac - Revised raspi Makefile.am to link kasan and ubsan only when sanitizer is set - Added switch between linker script with and without sanitizer depending on conditional
- Added __bootstrap to firmware_startup_init and initrd_startup_init - Adjusted map temporary to perform startup map when virtual memory wasn't yet initialized - Removed unnecessary kasan heap and list code - Removed also unnecessary sanitizer linker scripts
- Updated raspi memory map by area for kasan - Implemented kasan functions for detecting issues - Remove automatic memset from alloc and added memset where it was missing - Added new helper to get heap state - Added init of kasan within normal heap init - Added call to kasan poison shadow when extending the heap - Fixed kasan read error within strlen implementation - Fixed memset issue and added call to kasan_check_memory - Added call to kasan_check_memory within memcpy - Revised aligned_alloc and free to call kasan hooks if activated - Integrated unmap of initrd in kernel after control has been passed to boot - Introduced new helper to get file handler of a server
- Added libusb dependency and ldadd to hid Makefile.am - Ported global header from hub - Finished main of hid server - Added printing of surrounding memory to kasan with respect of mapped areas - Removed sanitizer defines from heap header and move last remaining into kasan - Added plain rpc to keyboard and mouse - Added main logic to keyboard and mouse - Created new libhid abstracting away hid operations - Removed usb storage from stage3 until hid, mouse and keyboard are done and a basic stack is there
- Created handler management functions - Implemented register and unregister handler - Fixed defined checks in libhid - Fixed register of usbd handler in hid
…o debug symbols - Started working on hid attach logic - Added new rpc call to get configuration data from usbd by device number - Added new rpc call to get device status from usbd by device number - Created usb wrapper to fetch configuration data - Created usb wrapper to fetch device status
- Replaced libhid_interface_type_t by libusb_hid_usage_page_desktop_t - Continued working on hid attach - Added handler_call_attach helper to hid handler logic - Replaced RPC_CUSTOM_START within usbd call.c by GENERIC_ATTACH - Fixed tree usage in hid handler logic - Started adding logic to keyboard attach - Started adding logic to mouse attach - Added store of hub device to attach into a hub list
…of heap - Added defines for kernel area process replace start and end - Updated memory map
- Moved typedefs from hid attach into header hid of process hid - Moved hid destroy device into hid.c and added removal from hid list - Added save of device_number within hid device and hub device - Added documentation to attach hub functions before moving them - Added cache of descriptor in hub device instance - Added free of descriptor on error within hub attach - Added structures and enums for keyboard and mouse - Implemented list of keyboard and list of mouse to specific driver with append method
- Moved static hub attach functions into hub.c
- Extended attach context destroy by destroy parameter - Adjusted attach context destroy calls with new parameter - Replaced static destroy_device in deallocate by new usbd_destroy_device
- Added simple handler logic to mouse containing a list of registered listeners - Fixed population of mouse x, y and wheel properties - Implement push to listeners in mouse poll callback with cleanup and no wait for return
- Added basic generic rpc functions to hid, keyboard, mouse, hub and usbd server
- Changed to_attach to set to max_children - Changed check for attach_count to check for not EAGAIN - Replaced USBD_ENABLE_ERROR by USBD_ENABLE_DEBUG - Commented out debug defines for hid and hub - Encapsulated output by defined checks
- Changed rpc parameter to const since they are not modified
- Replaced set to 0 by memset calls
…AGAIN - Commented in outcommented defined checks - Removed unnecessary rpc wait block call
- Revised output of authentication server to be surrounded by defined checks - Changed sd storage server to EARLY_STARTUP_PRINT and surrounded remaining debug output by defined checks - Fixed peripheral defines for dma channels - Fixed mmio server in terms of peripheral dma read and write - Enabled debug output of usb servers as preparation for hardware test
- Surrounded terminal output by defined checks
- Surrounded iomem output by defined checks - Surrounded random output by defined checks - Surrounded hcd output by defined checks
- Added call to isb barrier after enabling dma start - Temporarily switched sd server to raspi 3 for sdhost dma testing - Removed copy_to_raspi_sd.h since complete images need to be flashed onto sd card - Extended readme by example on how to flash generated image to sdcard
- Enabled default output of sd server - Dropped non dma related sdhost code - Removed obsoleted SDHOST_ENABLE_DMA define
- Added instruction barrier to task_thread_switch_to - Some const adjustments - Reworked rpc_data_queue_add to use virtual address if it's current process - Reworked rpc_data_queue_add evaluation of next free space - Added some debug output to roothub attach rpc - Enabled debug output in hcd server
…nvalidate_save to root cache header - Changed data sync barrier to perform a dsb sy - Added barrier calls to invalidate instruction cache - Slight rework and cleanup of rpc handler macro - Added new macro for svc interrupt handler - Fixed cache invalidations in set context, flush complete and destroy context - Changed dsb call in clear cache to sy - Added switch to svc mode before branching to kernel main - Reworked task_thread_switch_to to use lr as register and rfeia for return to user mode - Added platform interrupt init method - Moved kernel main prototype into own header - Reworked timer to use arm core0 timer for rpi2 - Reworked interrupt_get_pending to check local peripheral - Dropped not working code to switch to secure world and stick to non secure svc mode - Added cache invalidation in fork - Added cache invalidation in process replace
- Adjusted stage1 of boot to wait for vfs to be ready - Fixed dhci fifo defines to work on real hardware - Various fixes in dwhci implementation - Reworked hcd interrupt handler to treat xfer size as remaining size - Fixed hid set report rpc to pass correct length to set request - Reworked call attach of usbd to return ENOSYS when no handler is bound - Added handling in attach when nosys is returned ( no handler is set )
…h to - Added call to cache invalidation in syscall memory shared detach
- Dropped sync usbd_control_message since it is unused - Reworked get descriptor in usbd to work async - Adjusted and simplified usages of get descriptor - Reworked dwhci code to support ssplit and csplit request handling - Reworked handling of control commands to use multiple data requests
- Dropped wrong interval define for character and its usage - Fixed interval calculation to consifer high speed correctly - Added set of poll timer after submitting a channel - Added call to dwhci continue next in dwhci channel send async done - Added timer handling for polls - Adjusted timer handler to handle poll timers and poll wait status correctly - Extended toggle_split_phase helper for handling polls correctly - Readded handling for data pollings to treat data pollings with transfer complete or nack as done
- Moved usb peripheral defines to hcd server - Revised iomem server handling to map peripherals until dwhci - Ported barrier functions from iomem to hcd server - Ported mmio functions from iomem to hcd server
- Replaced dwhci_write_port by mmio_write - Surrounded dwhci constants by parenthesis and added usb offset mapping define - Dropped unused transmit sequence function
- Adjusted timer_get_by_process_id to consider only interruptable timers - Added manual delay_us to hcd server - Reworked dwhci to use mmio mapping instead of iomem server due to timings
- Added write back of channel interrupts to clear them directly - Commented back in some defined checks - Added free of entry in dwhci_queue_remove_entry when free_up is true - Moved prepare of channel dma stuff into own function - Changed allocations in dwhci functions that might be used during interrupt to mmap / munmap - Replaced malloc / free in dwhci by mmap / munmap - Surrounded set of task_thread_try_switch_to by not set check - Added new helper to get next active rpc - Restricted rpc_backup_get_active to check for active / data id and thread - Revised rpc invoke to be able to handle interrupts which are squeezed in when there is an active rpc - Added second check for try to switch to within halt loop when irq happens in kernel
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull request to add initial usb support
Closes #54
Closes #67
Closes #58
Closes #61
Closes #57
Things to be addressed:
hcd_control_message_tandusb_control_message_t