Move some code from platform/ to drivers/