Subversion Repositories Kolibri OS

Rev

Rev 2967 | Rev 3243 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2967 Rev 3031
Line 37... Line 37...
37
addr_t STDCALL AllocPage(void)__asm__("AllocPage");
37
addr_t STDCALL AllocPage(void)__asm__("AllocPage");
38
addr_t STDCALL AllocPages(count_t count)__asm__("AllocPages");
38
addr_t STDCALL AllocPages(count_t count)__asm__("AllocPages");
39
void   IMPORT  __attribute__((regparm(1)))
39
void   IMPORT  __attribute__((regparm(1)))
40
               FreePage(addr_t page)__asm__("FreePage");
40
               FreePage(addr_t page)__asm__("FreePage");
-
 
41
void   STDCALL MapPage(void *vaddr, addr_t paddr, u32_t flags)__asm__("MapPage");
Line 41... Line 42...
41
 
42
 
Line 42... Line 43...
42
 
43
 
Line 89... Line 90...
89
 
90
 
Line 90... Line 91...
90
#define pciWriteLong(tag, reg, val) \
91
#define pciWriteLong(tag, reg, val) \
91
        PciWrite32(PCI_BUS_FROM_TAG(tag),PCI_DFN_FROM_TAG(tag),(reg),(val))
92
        PciWrite32(PCI_BUS_FROM_TAG(tag),PCI_DFN_FROM_TAG(tag),(reg),(val))
Line -... Line 93...
-
 
93
 
-
 
94
static inline int pci_read_config_byte(struct pci_dev *dev, int where,
-
 
95
                    u8 *val)
-
 
96
{
-
 
97
    *val = PciRead8(dev->busnr, dev->devfn, where);
-
 
98
    return 1;
-
 
99
}
-
 
100
 
-
 
101
static inline int pci_read_config_word(struct pci_dev *dev, int where,
-
 
102
                    u16 *val)
-
 
103
{
-
 
104
    *val = PciRead16(dev->busnr, dev->devfn, where);
-
 
105
    return 1;
-
 
106
}
-
 
107
 
-
 
108
static inline int pci_read_config_dword(struct pci_dev *dev, int where,
-
 
109
                    u32 *val)
-
 
110
{
-
 
111
    *val = PciRead32(dev->busnr, dev->devfn, where);
-
 
112
    return 1;
-
 
113
}
-
 
114
 
-
 
115
static inline int pci_write_config_byte(struct pci_dev *dev, int where,
-
 
116
                    u8 val)
-
 
117
{
-
 
118
    PciWrite8(dev->busnr, dev->devfn, where, val);
-
 
119
    return 1;
-
 
120
}
-
 
121
 
-
 
122
static inline int pci_write_config_word(struct pci_dev *dev, int where,
-
 
123
                    u16 val)
-
 
124
{
-
 
125
    PciWrite16(dev->busnr, dev->devfn, where, val);
-
 
126
    return 1;
-
 
127
}
-
 
128
 
-
 
129
static inline int pci_write_config_dword(struct pci_dev *dev, int where,
-
 
130
                    u32 val)
-
 
131
{
-
 
132
    PciWrite32(dev->busnr, dev->devfn, where, val);
-
 
133
    return 1;
-
 
134
}
92
 
135
 
Line 93... Line 136...
93
///////////////////////////////////////////////////////////////////////////////
136
///////////////////////////////////////////////////////////////////////////////
94
 
137
 
Line 445... Line 488...
445
};
488
};
446
 
489
 
Line 447... Line 490...
447
#define rmb()   asm volatile("lfence":::"memory")
490
#define rmb()   asm volatile("lfence":::"memory")
Line -... Line 491...
-
 
491
 
-
 
492
static inline void *vzalloc(unsigned long size)
-
 
493
{
-
 
494
    void *mem;
-
 
495
 
-
 
496
    mem = KernelAlloc(size);
-
 
497
    if(mem)
-
 
498
        memset(mem, 0, size);
-
 
499
 
-
 
500
   return mem;
-
 
501
};
-
 
502
 
-
 
503
static inline void vfree(void *addr)
-
 
504
{
-
 
505
    KernelFree(addr);
-
 
506
}
-
 
507
 
-
 
508
static inline int power_supply_is_system_supplied(void) { return -1; }
-
 
509
 
-
 
510
#define RWSEM_UNLOCKED_VALUE            0x00000000
-
 
511
#define RWSEM_ACTIVE_BIAS               0x00000001
-
 
512
#define RWSEM_ACTIVE_MASK               0x0000ffff
-
 
513
#define RWSEM_WAITING_BIAS              (-0x00010000)
-
 
514
#define RWSEM_ACTIVE_READ_BIAS          RWSEM_ACTIVE_BIAS
-
 
515
#define RWSEM_ACTIVE_WRITE_BIAS         (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS)
-
 
516
 
-
 
517
 
-
 
518
static void init_rwsem(struct rw_semaphore *sem)
-
 
519
{
-
 
520
    sem->count = RWSEM_UNLOCKED_VALUE;
-
 
521
    spin_lock_init(&sem->wait_lock);
-
 
522
    INIT_LIST_HEAD(&sem->wait_list);
-
 
523
}
448
 
524