#ifndef _KERNEL_MM_PMM_H
#define _KERNEL_MM_PMM_H

#include <libk/bm.h>
#include <libk/std.h>
#include <mm/types.h>
#include <sync/spin_lock.h>

#define PMM_ALLOC_ERR ((physaddr_t) - 1)

#define PMM_REGIONS_MAX 32

#define PMM_REGION_ACTIVE (1 << 0)

struct pmm_region {
  spin_lock_t lock;
  struct bm bm;
  physaddr_t membase;
  size_t size;
  uint32_t flags;
};

struct pmm {
  struct pmm_region regions[PMM_REGIONS_MAX];
};

void pmm_init (void);
physaddr_t pmm_alloc (size_t nblks);
void pmm_free (physaddr_t p_addr, size_t nblks);

#endif // _KERNEL_MM_PMM_H
