Lines Matching +full:port +full:- +full:base
2 /*-
3 * SPDX-License-Identifier: BSD-2-Clause
6 * Copyright (C) 2005-2011 HighPoint Technologies, Inc. All Rights Reserved.
37 HPT_U8 os_inb (void *port) { return inb((unsigned)(HPT_UPTR)port); } in os_inb() argument
38 HPT_U16 os_inw (void *port) { return inw((unsigned)(HPT_UPTR)port); } in os_inw() argument
39 HPT_U32 os_inl (void *port) { return inl((unsigned)(HPT_UPTR)port); } in os_inl() argument
41 void os_outb (void *port, HPT_U8 value) { outb((unsigned)(HPT_UPTR)port, (value)); } in os_outb() argument
42 void os_outw (void *port, HPT_U16 value) { outw((unsigned)(HPT_UPTR)port, (value)); } in os_outw() argument
43 void os_outl (void *port, HPT_U32 value) { outl((unsigned)(HPT_UPTR)port, (value)); } in os_outl() argument
45 void os_insw (void *port, HPT_U16 *buffer, HPT_U32 count) in os_insw() argument
46 { insw((unsigned)(HPT_UPTR)port, (void *)buffer, count); } in os_insw()
48 void os_outsw(void *port, HPT_U16 *buffer, HPT_U32 count) in os_outsw() argument
49 { outsw((unsigned)(HPT_UPTR)port, (void *)buffer, count); } in os_outsw()
56 return pci_read_config(((PHBA)osext)->pcidev, offset, 1); in os_pci_readb()
61 return pci_read_config(((PHBA)osext)->pcidev, offset, 2); in os_pci_readw()
66 return pci_read_config(((PHBA)osext)->pcidev, offset, 4); in os_pci_readl()
71 pci_write_config(((PHBA)osext)->pcidev, offset, value, 1); in os_pci_writeb()
76 pci_write_config(((PHBA)osext)->pcidev, offset, value, 2); in os_pci_writew()
81 pci_write_config(((PHBA)osext)->pcidev, offset, value, 4); in os_pci_writel()
102 HPT_U32 base; in os_map_pci_bar() local
104 hba->pcibar[index].rid = 0x10 + index * 4; in os_map_pci_bar()
105 base = pci_read_config(hba->pcidev, hba->pcibar[index].rid, 4); in os_map_pci_bar()
107 if (base & 1) { in os_map_pci_bar()
108 hba->pcibar[index].type = SYS_RES_IOPORT; in os_map_pci_bar()
109 hba->pcibar[index].res = bus_alloc_resource_any(hba->pcidev, in os_map_pci_bar()
110 hba->pcibar[index].type, &hba->pcibar[index].rid, RF_ACTIVE); in os_map_pci_bar()
111 hba->pcibar[index].base = (void *)(unsigned long)(base & ~0x1); in os_map_pci_bar()
113 hba->pcibar[index].type = SYS_RES_MEMORY; in os_map_pci_bar()
114 hba->pcibar[index].res = bus_alloc_resource_any(hba->pcidev, in os_map_pci_bar()
115 hba->pcibar[index].type, &hba->pcibar[index].rid, RF_ACTIVE); in os_map_pci_bar()
116 hba->pcibar[index].base = (char *)rman_get_virtual(hba->pcibar[index].res) + offset; in os_map_pci_bar()
119 return hba->pcibar[index].base; in os_map_pci_bar()
122 void os_unmap_pci_bar(void *osext, void *base) in os_unmap_pci_bar() argument
128 if (hba->pcibar[index].base==base) { in os_unmap_pci_bar()
129 bus_release_resource(hba->pcidev, hba->pcibar[index].type, in os_unmap_pci_bar()
130 hba->pcibar[index].rid, hba->pcibar[index].res); in os_unmap_pci_bar()
131 hba->pcibar[index].base = 0; in os_unmap_pci_bar()
141 if (vbus_ext->ext_type!=EXT_TYPE_VBUS) in freelist_reserve()
142 vbus_ext = ((PHBA)osext)->vbus_ext; in freelist_reserve()
144 list->next = vbus_ext->freelist_head; in freelist_reserve()
145 vbus_ext->freelist_head = list; in freelist_reserve()
146 list->dma = 0; in freelist_reserve()
147 list->size = size; in freelist_reserve()
148 list->head = 0; in freelist_reserve()
150 list->reserved_count = in freelist_reserve()
152 list->count = count; in freelist_reserve()
158 if (list->count) { in freelist_get()
159 HPT_ASSERT(list->head); in freelist_get()
160 result = list->head; in freelist_get()
161 list->head = *(void **)result; in freelist_get()
162 list->count--; in freelist_get()
170 HPT_ASSERT(list->dma==0); in freelist_put()
171 list->count++; in freelist_put()
172 *(void **)p = list->head; in freelist_put()
173 list->head = p; in freelist_put()
180 if (vbus_ext->ext_type!=EXT_TYPE_VBUS) in freelist_reserve_dma()
181 vbus_ext = ((PHBA)osext)->vbus_ext; in freelist_reserve_dma()
183 list->next = vbus_ext->freelist_dma_head; in freelist_reserve_dma()
184 vbus_ext->freelist_dma_head = list; in freelist_reserve_dma()
185 list->dma = 1; in freelist_reserve_dma()
186 list->alignment = alignment; in freelist_reserve_dma()
187 list->size = size; in freelist_reserve_dma()
188 list->head = 0; in freelist_reserve_dma()
190 list->reserved_count = in freelist_reserve_dma()
192 list->count = count; in freelist_reserve_dma()
198 HPT_ASSERT(list->dma); in freelist_get_dma()
207 HPT_ASSERT(list->dma); in freelist_put_dma()
208 list->count++; in freelist_put_dma()
209 *(void **)p = list->head; in freelist_put_dma()
211 list->head = p; in freelist_put_dma()
229 ldm_on_timer((PVBUS)vbus_ext->vbus); in os_timer_for_ldm()
236 HPT_ASSERT(vbus_ext->ext_type==EXT_TYPE_VBUS); in os_request_timer()
238 callout_reset_sbt(&vbus_ext->timer, SBT_1US * interval, 0, in os_request_timer()
251 HPT_ASSERT(task->next==0); in os_schedule_task()
253 if (vbus_ext->tasks==0) in os_schedule_task()
254 vbus_ext->tasks = task; in os_schedule_task()
256 OSM_TASK *t = vbus_ext->tasks; in os_schedule_task()
257 while (t->next) t = t->next; in os_schedule_task()
258 t->next = task; in os_schedule_task()
261 if (vbus_ext->worker.ta_context) in os_schedule_task()
262 TASK_ENQUEUE(&vbus_ext->worker); in os_schedule_task()
278 return ((PVBUS_EXT)osext)->sim->path_id; in os_get_vbus_seq()