/*  *********************************************************************
 *  ASTRIS - Remote JTAG probe
 *
 *  Apple SoC Component Base Classes Declaration
 *
 *  File: astris_soc_comp_base.h
 *
 ***********************************************************************
 *
 *  Copyright (C) 2023 Apple Inc. All rights reserved.
 *
 *  This document is the property of Apple Inc.
 *  It is considered confidential and proprietary.
 *
 *  This document may not be reproduced or transmitted in any form,
 *  in whole or in part, without the express written permission of
 *  Apple Inc.
 ********************************************************************* */

#ifndef astris_soc_comp_base_h
#define astris_soc_comp_base_h

#include <stdio.h>
#include <string>
#include <map>
#include <Astris/astris_api.h>

class SoCBaseComponent {
    
public:
    
    typedef enum SoCComponentType_e {
        kPMGR,
        kMaxComponent
    } SoCComponentType;
    
    virtual ~SoCBaseComponent();
    SoCComponentType getComponentType();
    
protected:
    SoCBaseComponent(SoCComponentType comp);
    SoCComponentType m_compType;
};

class SoCPmgrComponentV1: public SoCBaseComponent {

public:
    SoCPmgrComponentV1(AXchip_t *chip, AXap_t *ap);
    virtual ~SoCPmgrComponentV1();
    
    void setOfflineAddress(AXmemaddr_t addr);
    void setOfflineDecodeForCore(std::string coreName, uint32_t mask);
    virtual int isCoreOffline(AXcpu_t *cpu, bool *offline_or_not);
    virtual int coreStatus(AXcpu_t *cpu, AXcpu_status_t *detailed);

protected:
    std::map<std::string, uint32_t> m_offlineDecode;
    AXmemaddr_t m_offline_address = 0;
    
    AXap_t *m_sysap = NULL;
    AXchip_t *m_chip = NULL;
    
    
};

#endif /* astris_soc_comp_base_h */
