1: /*
2:
3: File: WiFiControllerPCI.h
4: Program: GTDriver
5: Author: Michael Roßberg
6: mick@binaervarianz.de
7: Description: GTDriver is a free driver for PrismGT based cards under OS X.
8:
9: This file is part of GTDriver.
10:
11: GTDriver is free software; you can redistribute it and/or modify
12: it under the terms of the GNU General Public License as published by
13: the Free Software Foundation; either version 2 of the License, or
14: (at your option) any later version.
15:
16: GTDriver is distributed in the hope that it will be useful,
17: but WITHOUT ANY WARRANTY; without even the implied warranty of
18: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19: GNU General Public License for more details.
20:
21: You should have received a copy of the GNU General Public License
22: along with GTDriver; if not, write to the Free Software
23: Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24: */
25:
26: #include "WiFiController.h"
27: #include <IOKit/pci/IOPCIDevice.h>
28:
29: #define CACHE_ALIGNMENT 32
30: #define MAX_FRAGMENT_SIZE 1600
31:
32: /*
33: * Type: pageBlock_t
34: *
35: * Purpose:
36: * Track a page sized memory block.
37: */
38: typedef struct {
39: IOBufferMemoryDescriptor *memory;
40: void * freeStart;
41: UInt32 freeBytes;
42: } pageBlock_t;
43:
44:
45: class WiFiControllerPCI : public WiFiController {
46: OSDeclareDefaultStructors(WiFiControllerPCI)
47:
48: public:
49: virtual bool startProvider(IOService *provider);
50: virtual bool openProvider();
51: virtual bool closeProvider();
52: virtual bool freeProvider();
53:
54: //memory functions for convinience
55: bool allocatePageBlock(pageBlock_t * p);
56: void freePageBlock(pageBlock_t * p);
57: bool getPhysAddress(pageBlock_t * p, void * va, IOPhysicalAddress * pa);
58: void *allocateMemoryFrom(pageBlock_t * p, UInt32 size, UInt32 align,
59: IOPhysicalAddress * paddr = 0);
60: protected:
61: virtual bool pciConfigInit(IOPCIDevice * provider);
62:
63: IOPCIDevice *_nub;
64: UInt8 _pmPCICapPtr;
65: IOMemoryMap *_map;
66: IOVirtualAddress _ioBase;
67:
68: IOMbufLittleMemoryCursor *_mbufCursor;
69: };
70: