Lines Matching +full:port +full:- +full:base

1 /*-
4 * SPDX-License-Identifier: BSD-2-Clause
6 * Copyright (C) 2005-2011 HighPoint Technologies, Inc. All Rights Reserved.
38 HPT_U8 os_inb (void *port) { return inb((unsigned)(HPT_UPTR)port); } in os_inb() argument
39 HPT_U16 os_inw (void *port) { return inw((unsigned)(HPT_UPTR)port); } in os_inw() argument
40 HPT_U32 os_inl (void *port) { return inl((unsigned)(HPT_UPTR)port); } in os_inl() argument
42 void os_outb (void *port, HPT_U8 value) { outb((unsigned)(HPT_UPTR)port, (value)); } in os_outb() argument
43 void os_outw (void *port, HPT_U16 value) { outw((unsigned)(HPT_UPTR)port, (value)); } in os_outw() argument
44 void os_outl (void *port, HPT_U32 value) { outl((unsigned)(HPT_UPTR)port, (value)); } in os_outl() argument
46 void os_insw (void *port, HPT_U16 *buffer, HPT_U32 count) in os_insw() argument
47 { insw((unsigned)(HPT_UPTR)port, (void *)buffer, count); } in os_insw()
49 void os_outsw(void *port, HPT_U16 *buffer, HPT_U32 count) in os_outsw() argument
50 { outsw((unsigned)(HPT_UPTR)port, (void *)buffer, count); } in os_outsw()
57 return pci_read_config(((PHBA)osext)->pcidev, offset, 1); in os_pci_readb()
62 return pci_read_config(((PHBA)osext)->pcidev, offset, 2); in os_pci_readw()
67 return pci_read_config(((PHBA)osext)->pcidev, offset, 4); in os_pci_readl()
72 pci_write_config(((PHBA)osext)->pcidev, offset, value, 1); in os_pci_writeb()
77 pci_write_config(((PHBA)osext)->pcidev, offset, value, 2); in os_pci_writew()
82 pci_write_config(((PHBA)osext)->pcidev, offset, value, 4); in os_pci_writel()
116 HPT_U32 base; in os_map_pci_bar() local
118 hba->pcibar[index].rid = 0x10 + index * 4; in os_map_pci_bar()
119 base = pci_read_config(hba->pcidev, hba->pcibar[index].rid, 4); in os_map_pci_bar()
121 if (base & 1) { in os_map_pci_bar()
122 hba->pcibar[index].type = SYS_RES_IOPORT; in os_map_pci_bar()
123 hba->pcibar[index].res = bus_alloc_resource_any(hba->pcidev, in os_map_pci_bar()
124 hba->pcibar[index].type, &hba->pcibar[index].rid, RF_ACTIVE); in os_map_pci_bar()
125 hba->pcibar[index].base = (void *)(unsigned long)(base & ~0x1); in os_map_pci_bar()
127 hba->pcibar[index].type = SYS_RES_MEMORY; in os_map_pci_bar()
128 hba->pcibar[index].res = bus_alloc_resource_any(hba->pcidev, in os_map_pci_bar()
129 hba->pcibar[index].type, &hba->pcibar[index].rid, RF_ACTIVE); in os_map_pci_bar()
130 hba->pcibar[index].base = (char *)rman_get_virtual(hba->pcibar[index].res) + offset; in os_map_pci_bar()
133 return hba->pcibar[index].base; in os_map_pci_bar()
136 void os_unmap_pci_bar(void *osext, void *base) in os_unmap_pci_bar() argument
142 if (hba->pcibar[index].base==base) { in os_unmap_pci_bar()
143 bus_release_resource(hba->pcidev, hba->pcibar[index].type, in os_unmap_pci_bar()
144 hba->pcibar[index].rid, hba->pcibar[index].res); in os_unmap_pci_bar()
145 hba->pcibar[index].base = 0; in os_unmap_pci_bar()
155 if (vbus_ext->ext_type!=EXT_TYPE_VBUS) in freelist_reserve()
156 vbus_ext = ((PHBA)osext)->vbus_ext; in freelist_reserve()
158 list->next = vbus_ext->freelist_head; in freelist_reserve()
159 vbus_ext->freelist_head = list; in freelist_reserve()
160 list->dma = 0; in freelist_reserve()
161 list->size = size; in freelist_reserve()
162 list->head = 0; in freelist_reserve()
164 list->reserved_count = in freelist_reserve()
166 list->count = count; in freelist_reserve()
172 if (list->count) { in freelist_get()
173 HPT_ASSERT(list->head); in freelist_get()
174 result = list->head; in freelist_get()
175 list->head = *(void **)result; in freelist_get()
176 list->count--; in freelist_get()
184 HPT_ASSERT(list->dma==0); in freelist_put()
185 list->count++; in freelist_put()
186 *(void **)p = list->head; in freelist_put()
187 list->head = p; in freelist_put()
194 if (vbus_ext->ext_type!=EXT_TYPE_VBUS) in freelist_reserve_dma()
195 vbus_ext = ((PHBA)osext)->vbus_ext; in freelist_reserve_dma()
197 list->next = vbus_ext->freelist_dma_head; in freelist_reserve_dma()
198 vbus_ext->freelist_dma_head = list; in freelist_reserve_dma()
199 list->dma = 1; in freelist_reserve_dma()
200 list->alignment = alignment; in freelist_reserve_dma()
201 list->size = size; in freelist_reserve_dma()
202 list->head = 0; in freelist_reserve_dma()
204 list->reserved_count = in freelist_reserve_dma()
206 list->count = count; in freelist_reserve_dma()
212 HPT_ASSERT(list->dma); in freelist_get_dma()
221 HPT_ASSERT(list->dma); in freelist_put_dma()
222 list->count++; in freelist_put_dma()
223 *(void **)p = list->head; in freelist_put_dma()
225 list->head = p; in freelist_put_dma()
243 ldm_on_timer((PVBUS)vbus_ext->vbus); in os_timer_for_ldm()
250 HPT_ASSERT(vbus_ext->ext_type==EXT_TYPE_VBUS); in os_request_timer()
251 callout_reset_sbt(&vbus_ext->timer, SBT_1US * interval, 0, in os_request_timer()
264 HPT_ASSERT(task->next==0); in os_schedule_task()
266 if (vbus_ext->tasks==0) in os_schedule_task()
267 vbus_ext->tasks = task; in os_schedule_task()
269 OSM_TASK *t = vbus_ext->tasks; in os_schedule_task()
270 while (t->next) t = t->next; in os_schedule_task()
271 t->next = task; in os_schedule_task()
274 if (vbus_ext->worker.ta_context) in os_schedule_task()
275 TASK_ENQUEUE(&vbus_ext->worker); in os_schedule_task()
291 return ((PVBUS_EXT)osext)->sim->path_id; in os_get_vbus_seq()