Make UEFI boot-platform build again
[haiku.git] / headers / private / graphics / radeon_hd / AreaKeeper.h
blobd604bb45cb9e2e82a7f156b953188c4b810a1fec
1 /*
2 * Copyright 2006-2008, Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
5 * Authors:
6 * Axel Dörfler, axeld@pinc-software.de
7 */
8 #ifndef AREA_KEEPER_H
9 #define AREA_KEEPER_H
12 #include <KernelExport.h>
13 #include <OS.h>
15 #include <util/kernel_cpp.h>
18 class AreaKeeper {
19 public:
20 AreaKeeper();
21 ~AreaKeeper();
23 area_id Create(const char *name, void **_virtualAddress, uint32 spec,
24 size_t size, uint32 lock, uint32 protection);
25 area_id Map(const char *name, addr_t physicalAddress, size_t numBytes,
26 uint32 spec, uint32 protection, void **_virtualAddress);
28 status_t InitCheck() { return fArea < B_OK ? (status_t)fArea : B_OK; }
29 void Detach();
31 private:
32 area_id fArea;
36 AreaKeeper::AreaKeeper()
38 fArea(-1)
43 AreaKeeper::~AreaKeeper()
45 if (fArea >= B_OK)
46 delete_area(fArea);
50 area_id
51 AreaKeeper::Create(const char *name, void **_virtualAddress, uint32 spec,
52 size_t size, uint32 lock, uint32 protection)
54 fArea = create_area(name, _virtualAddress, spec, size, lock, protection);
55 return fArea;
59 area_id
60 AreaKeeper::Map(const char *name, addr_t physicalAddress, size_t numBytes,
61 uint32 spec, uint32 protection, void **_virtualAddress)
63 fArea = map_physical_memory(name, physicalAddress, numBytes, spec,
64 protection, _virtualAddress);
65 return fArea;
69 void
70 AreaKeeper::Detach()
72 fArea = -1;
75 #endif // AREA_KEEPER_H