[haiku-commits] BRANCH mmu_man-github.sam460ex - in src: system/kernel/arch/ppc add-ons/kernel/bus_managers/pci/arch/ppc/u-boot add-ons/kernel/bus_managers/pci/arch/ppc

  • From: mmu_man-github.sam460ex <community@xxxxxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sat, 22 Sep 2012 22:49:39 +0200 (CEST)

added 3 changesets to branch 'refs/remotes/mmu_man-github/sam460ex'
old head: 9a713d9417fb71a8679d792eb174b3cee59dbda7
new head: 3b8d5dc824d3db9e48fe91827296ebf1a397242f

----------------------------------------------------------------------------

f812331: PPC: Add a platform field to the arch_kernel_args
  
  * We need to know which platform we are booted from

0e5f979: PPC: Add a stub PPCUBoot platform class
  
  * use the platform field in arch_kernel_args to determine which platform to 
instanciate

3b8d5dc: PPC: Add stub u-boot version of the PCI controller.
  
  * Add a switch on the platform type

                                          [ François Revol <revol@xxxxxxx> ]

----------------------------------------------------------------------------

6 files changed, 173 insertions(+), 5 deletions(-)
headers/private/kernel/arch/ppc/arch_kernel_args.h |    3 +
.../kernel/bus_managers/pci/arch/ppc/Jamfile       |    4 +
.../bus_managers/pci/arch/ppc/pci_controller.cpp   |    8 +-
.../pci/arch/ppc/u-boot/pci_u-boot.cpp             |   24 +++
.../bus_managers/pci/arch/ppc/u-boot/pci_u-boot.h  |   13 ++
src/system/kernel/arch/ppc/arch_platform.cpp       |  126 +++++++++++++++-

############################################################################

Commit:      f81233185780da21480331028eed220022e2d0b2

Author:      François Revol <revol@xxxxxxx>
Date:        Sat Sep 22 20:10:02 2012 UTC

PPC: Add a platform field to the arch_kernel_args

* We need to know which platform we are booted from

----------------------------------------------------------------------------

diff --git a/headers/private/kernel/arch/ppc/arch_kernel_args.h 
b/headers/private/kernel/arch/ppc/arch_kernel_args.h
index 7780bfe..26370d0 100644
--- a/headers/private/kernel/arch/ppc/arch_kernel_args.h
+++ b/headers/private/kernel/arch/ppc/arch_kernel_args.h
@@ -29,6 +29,9 @@ typedef struct {
        // to the Open Firmware.
        uint32          num_virtual_ranges_to_keep;
        addr_range      virtual_ranges_to_keep[MAX_VIRTUAL_RANGES_TO_KEEP];
+
+       // platform type we booted from
+       int                     platform;
 } arch_kernel_args;
 
 #endif /* KERNEL_ARCH_PPC_KERNEL_ARGS_H */

############################################################################

Commit:      0e5f9797201b006636c70a95a9664c19c85a24d0

Author:      François Revol <revol@xxxxxxx>
Date:        Sat Sep 22 20:12:56 2012 UTC

PPC: Add a stub PPCUBoot platform class

* use the platform field in arch_kernel_args to determine which platform to 
instanciate

----------------------------------------------------------------------------

diff --git a/src/system/kernel/arch/ppc/arch_platform.cpp 
b/src/system/kernel/arch/ppc/arch_platform.cpp
index 2e2d95f..35e92ad 100644
--- a/src/system/kernel/arch/ppc/arch_platform.cpp
+++ b/src/system/kernel/arch/ppc/arch_platform.cpp
@@ -225,18 +225,138 @@ PPCOpenFirmware::ShutDown(bool reboot)
 }
 
 
+// #pragma mark - U-Boot + FDT
+
+
+namespace BPrivate {
+
+class PPCUBoot : public PPCPlatform {
+public:
+       PPCUBoot();
+       virtual ~PPCUBoot();
+
+       virtual status_t Init(struct kernel_args *kernelArgs);
+       virtual status_t InitSerialDebug(struct kernel_args *kernelArgs);
+       virtual status_t InitPostVM(struct kernel_args *kernelArgs);
+       virtual status_t InitRTC(struct kernel_args *kernelArgs,
+               struct real_time_data *data);
+
+       virtual char SerialDebugGetChar();
+       virtual void SerialDebugPutChar(char c);
+
+       virtual void SetHardwareRTC(uint32 seconds);
+       virtual uint32 GetHardwareRTC();
+
+       virtual void ShutDown(bool reboot);
+
+private:
+       int     fInput;
+       int     fOutput;
+       int     fRTC;
+};
+
+}      // namespace BPrivate
+
+using BPrivate::PPCUBoot;
+
+
+// constructor
+PPCUBoot::PPCUBoot()
+       : PPCPlatform(PPC_PLATFORM_U_BOOT),
+         fInput(-1),
+         fOutput(-1),
+         fRTC(-1)
+{
+}
+
+// destructor
+PPCUBoot::~PPCUBoot()
+{
+}
+
+// Init
+status_t
+PPCUBoot::Init(struct kernel_args *kernelArgs)
+{
+       return B_ERROR;
+}
+
+// InitSerialDebug
+status_t
+PPCUBoot::InitSerialDebug(struct kernel_args *kernelArgs)
+{
+       return B_ERROR;
+}
+
+// InitPostVM
+status_t
+PPCUBoot::InitPostVM(struct kernel_args *kernelArgs)
+{
+       return B_ERROR;
+}
+
+// InitRTC
+status_t
+PPCUBoot::InitRTC(struct kernel_args *kernelArgs,
+       struct real_time_data *data)
+{
+       return B_ERROR;
+}
+
+// DebugSerialGetChar
+char
+PPCUBoot::SerialDebugGetChar()
+{
+       return 0;
+}
+
+// DebugSerialPutChar
+void
+PPCUBoot::SerialDebugPutChar(char c)
+{
+}
+
+// SetHardwareRTC
+void
+PPCUBoot::SetHardwareRTC(uint32 seconds)
+{
+}
+
+// GetHardwareRTC
+uint32
+PPCUBoot::GetHardwareRTC()
+{
+       return 0;
+}
+
+// ShutDown
+void
+PPCUBoot::ShutDown(bool reboot)
+{
+}
+
+
 // # pragma mark -
 
 
+#define PLATFORM_BUFFER_SIZE MAX(sizeof(PPCOpenFirmware),sizeof(PPCUBoot))
 // static buffer for constructing the actual PPCPlatform
-static char *sPPCPlatformBuffer[sizeof(PPCOpenFirmware)];
+static char *sPPCPlatformBuffer[PLATFORM_BUFFER_SIZE];
 
 status_t
 arch_platform_init(struct kernel_args *kernelArgs)
 {
        // only OpenFirmware supported for now
-       if (true)
-               sPPCPlatform = new(sPPCPlatformBuffer) PPCOpenFirmware;
+       switch (kernelArgs->arch_args.platform) {
+               case PPC_PLATFORM_OPEN_FIRMWARE:
+                       sPPCPlatform = new(sPPCPlatformBuffer) PPCOpenFirmware;
+                       break;
+               case PPC_PLATFORM_U_BOOT:
+                       sPPCPlatform = new(sPPCPlatformBuffer) PPCUBoot;
+                       break;
+               default:
+                       return B_ERROR;
+       }
 
        return sPPCPlatform->Init(kernelArgs);
 }

############################################################################

Commit:      3b8d5dc824d3db9e48fe91827296ebf1a397242f

Author:      François Revol <revol@xxxxxxx>
Date:        Sat Sep 22 20:23:00 2012 UTC

PPC: Add stub u-boot version of the PCI controller.

* Add a switch on the platform type

----------------------------------------------------------------------------

diff --git a/src/add-ons/kernel/bus_managers/pci/arch/ppc/Jamfile 
b/src/add-ons/kernel/bus_managers/pci/arch/ppc/Jamfile
index 99e0413..2f81efb 100644
--- a/src/add-ons/kernel/bus_managers/pci/arch/ppc/Jamfile
+++ b/src/add-ons/kernel/bus_managers/pci/arch/ppc/Jamfile
@@ -5,6 +5,7 @@ UsePrivateHeaders kernel [ FDirName kernel arch $(TARGET_ARCH) ]
        [ FDirName kernel boot platform $(HAIKU_BOOT_PLATFORM) ] ;
 
 SEARCH_SOURCE += [ FDirName $(SUBDIR) openfirmware ] ;
+SEARCH_SOURCE += [ FDirName $(SUBDIR) u-boot ] ;
 
 KernelStaticLibrary pci_arch_bus_manager :
        pci_controller.cpp
@@ -14,4 +15,7 @@ KernelStaticLibrary pci_arch_bus_manager :
        pci_openfirmware.cpp
        uninorth.cpp
        grackle.cpp
+
+       # U-Boot
+       pci_u-boot.cpp
 ;
diff --git a/src/add-ons/kernel/bus_managers/pci/arch/ppc/pci_controller.cpp 
b/src/add-ons/kernel/bus_managers/pci/arch/ppc/pci_controller.cpp
index 8c0a6cd..50caa2b 100644
--- a/src/add-ons/kernel/bus_managers/pci/arch/ppc/pci_controller.cpp
+++ b/src/add-ons/kernel/bus_managers/pci/arch/ppc/pci_controller.cpp
@@ -11,6 +11,7 @@
 #include "pci_private.h"
 
 #include "openfirmware/pci_openfirmware.h"
+#include "u-boot/pci_u-boot.h"
 
 
 status_t
@@ -19,9 +20,12 @@ pci_controller_init(void)
        switch (PPCPlatform::Default()->PlatformType()) {
                case PPC_PLATFORM_OPEN_FIRMWARE:
                        return ppc_openfirmware_pci_controller_init();
-                       break;
+               case PPC_PLATFORM_U_BOOT:
+                       return ppc_uboot_pci_controller_init();
+               default:
+                       panic("pci: unknown platform");
        }
-       return B_OK;
+       return B_ERROR;
 }
 
 
diff --git a/src/add-ons/kernel/bus_managers/pci/arch/ppc/u-boot/pci_u-boot.cpp 
b/src/add-ons/kernel/bus_managers/pci/arch/ppc/u-boot/pci_u-boot.cpp
new file mode 100644
index 0000000..0f00491
--- /dev/null
+++ b/src/add-ons/kernel/bus_managers/pci/arch/ppc/u-boot/pci_u-boot.cpp
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2006, Ingo Weinhold <bonefish@xxxxxxxxxxxxxxx>.
+ * All rights reserved. Distributed under the terms of the MIT License.
+ */
+
+#include "pci_u-boot.h"
+
+#include <stdlib.h>
+#include <string.h>
+
+#include <KernelExport.h>
+
+//#include <platform/openfirmware/devices.h>
+//#include <platform/openfirmware/openfirmware.h>
+//#include <platform/openfirmware/pci.h>
+
+
+status_t
+ppc_uboot_pci_controller_init(void)
+{
+       return B_ERROR;
+}
+
+
diff --git a/src/add-ons/kernel/bus_managers/pci/arch/ppc/u-boot/pci_u-boot.h 
b/src/add-ons/kernel/bus_managers/pci/arch/ppc/u-boot/pci_u-boot.h
new file mode 100644
index 0000000..07a6a71
--- /dev/null
+++ b/src/add-ons/kernel/bus_managers/pci/arch/ppc/u-boot/pci_u-boot.h
@@ -0,0 +1,13 @@
+/*
+ * Copyright 2012, François Revol <revol@xxxxxxx>.
+ * All rights reserved. Distributed under the terms of the MIT License.
+ */
+
+#ifndef PCI_BUS_MANAGER_PPC_U_BOOT_H
+#define PCI_BUS_MANAGER_PPC_U_BOOT_H
+
+#include <SupportDefs.h>
+
+status_t       ppc_uboot_pci_controller_init(void);
+
+#endif // PCI_BUS_MANAGER_PPC_U_BOOT_H


Other related posts:

  • » [haiku-commits] BRANCH mmu_man-github.sam460ex - in src: system/kernel/arch/ppc add-ons/kernel/bus_managers/pci/arch/ppc/u-boot add-ons/kernel/bus_managers/pci/arch/ppc - mmu_man-github . sam460ex