/*
 * Copyright (c) 2026, Chloe M.
 * Provided under the BSD-3 clause.
 *
 * Description:  Kernel processor control region
 * Author:       Chloe M.
 */

#ifndef _HAL_KPCR_H_
#define _HAL_KPCR_H_ 1

#include <stdef.h>
#include <machine/mcb.h>
#include <ex/pool.h>

/*
 * The kernel processor control region contains MI
 * information about the processor.
 *
 * @CoreId:     Processor core ID assigned by us
 * @Mcb:        Machine-core block
 * @AllocPool:  Memory-allocation pool
 */
typedef struct {
    USHORT CoreId;
    MCB Mcb;
    MEMORY_POOL AllocPool;
} KPCR;

/*
 * Phase 1 initialization of processor
 *
 * @Kpcr: KPCR to initialize
 */
VOID HalKpcrP1Init(KPCR *Kpcr);

/*
 * Phase 2 initialization of processor
 *
 * @Kpcr: KPCR to initialize
 */
VOID HalKpcrP2Init(KPCR *Kpcr);

/*
 * Phase 3 initialization of processor
 *
 * @Kpcr: KPCR to initialize
 */
VOID HalKpcrP3Init(KPCR *Kpcr);

/*
 * Obtain the KPCR for the current processor, it is never to
 * be of a NULL value.
 */
KPCR *HalKpcrCurrent(VOID);

#endif  /* !_HAL_KPCR_H_ */
