1 /* 2 * Copyright 2006-2008, Haiku, Inc. All Rights Reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Axel Dörfler, axeld@pinc-software.de 7 */ 8 #ifndef INTEL_EXTREME_PRIVATE_H 9 #define INTEL_EXTREME_PRIVATE_H 10 11 12 #include <AGP.h> 13 #include <KernelExport.h> 14 #include <PCI.h> 15 #include <PCI_x86.h> 16 17 #include "intel_extreme.h" 18 #include "lock.h" 19 20 21 struct intel_info { 22 int32 open_count; 23 status_t init_status; 24 int32 id; 25 pci_info* pci; 26 addr_t aperture_base; 27 aperture_id aperture; 28 29 addr_t registers; 30 31 area_id registers_area; 32 struct intel_shared_info* shared_info; 33 area_id shared_area; 34 35 struct overlay_registers* overlay_registers; 36 37 bool fake_interrupts; 38 uint8 irq; 39 bool use_msi; 40 41 const char* device_identifier; 42 DeviceType device_type; 43 }; 44 45 46 static inline uint32 47 find_reg(const intel_info& info, uint32 target) 48 { 49 if (REGISTER_BLOCK(target) != REGS_FLAT) { 50 panic("find_reg is only supposed to be used for unrouped registers\n"); 51 return target; 52 } 53 54 if (!info.device_type.HasPlatformControlHub()) 55 return target; 56 57 #define RETURN_REG(x) case INTEL_##x: return PCH_##x; 58 59 switch (target) { 60 RETURN_REG(INTERRUPT_ENABLED) 61 RETURN_REG(INTERRUPT_IDENTITY) 62 RETURN_REG(INTERRUPT_MASK) 63 RETURN_REG(INTERRUPT_STATUS) 64 } 65 66 #undef RETURN_REG 67 68 panic("find_reg didn't have any matching register\n"); 69 return target; 70 } 71 72 73 extern status_t intel_free_memory(intel_info& info, addr_t offset); 74 extern status_t intel_allocate_memory(intel_info& info, size_t size, 75 size_t alignment, uint32 flags, addr_t* _offset, 76 phys_addr_t* _physicalBase = NULL); 77 extern status_t intel_extreme_init(intel_info& info); 78 extern void intel_extreme_uninit(intel_info& info); 79 80 #endif /* INTEL_EXTREME_PRIVATE_H */ 81