123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431 |
- /* pci_sun4v_asm: Hypervisor calls for PCI support.
- *
- * Copyright (C) 2006, 2008 David S. Miller <davem@davemloft.net>
- */
- #include <linux/linkage.h>
- #include <asm/hypervisor.h>
- /* %o0: devhandle
- * %o1: tsbid
- * %o2: num ttes
- * %o3: io_attributes
- * %o4: io_page_list phys address
- *
- * returns %o0: -status if status was non-zero, else
- * %o0: num pages mapped
- */
- ENTRY(pci_sun4v_iommu_map)
- mov %o5, %g1
- mov HV_FAST_PCI_IOMMU_MAP, %o5
- ta HV_FAST_TRAP
- brnz,pn %o0, 1f
- sub %g0, %o0, %o0
- mov %o1, %o0
- 1: retl
- nop
- ENDPROC(pci_sun4v_iommu_map)
- /* %o0: devhandle
- * %o1: tsbid
- * %o2: num ttes
- *
- * returns %o0: num ttes demapped
- */
- ENTRY(pci_sun4v_iommu_demap)
- mov HV_FAST_PCI_IOMMU_DEMAP, %o5
- ta HV_FAST_TRAP
- retl
- mov %o1, %o0
- ENDPROC(pci_sun4v_iommu_demap)
- /* %o0: devhandle
- * %o1: tsbid
- * %o2: &io_attributes
- * %o3: &real_address
- *
- * returns %o0: status
- */
- ENTRY(pci_sun4v_iommu_getmap)
- mov %o2, %o4
- mov HV_FAST_PCI_IOMMU_GETMAP, %o5
- ta HV_FAST_TRAP
- stx %o1, [%o4]
- stx %o2, [%o3]
- retl
- mov %o0, %o0
- ENDPROC(pci_sun4v_iommu_getmap)
- /* %o0: devhandle
- * %o1: pci_device
- * %o2: pci_config_offset
- * %o3: size
- *
- * returns %o0: data
- *
- * If there is an error, the data will be returned
- * as all 1's.
- */
- ENTRY(pci_sun4v_config_get)
- mov HV_FAST_PCI_CONFIG_GET, %o5
- ta HV_FAST_TRAP
- brnz,a,pn %o1, 1f
- mov -1, %o2
- 1: retl
- mov %o2, %o0
- ENDPROC(pci_sun4v_config_get)
- /* %o0: devhandle
- * %o1: pci_device
- * %o2: pci_config_offset
- * %o3: size
- * %o4: data
- *
- * returns %o0: status
- *
- * status will be zero if the operation completed
- * successfully, else -1 if not
- */
- ENTRY(pci_sun4v_config_put)
- mov HV_FAST_PCI_CONFIG_PUT, %o5
- ta HV_FAST_TRAP
- brnz,a,pn %o1, 1f
- mov -1, %o1
- 1: retl
- mov %o1, %o0
- ENDPROC(pci_sun4v_config_put)
- /* %o0: devhandle
- * %o1: msiqid
- * %o2: msiq phys address
- * %o3: num entries
- *
- * returns %o0: status
- *
- * status will be zero if the operation completed
- * successfully, else -1 if not
- */
- ENTRY(pci_sun4v_msiq_conf)
- mov HV_FAST_PCI_MSIQ_CONF, %o5
- ta HV_FAST_TRAP
- retl
- mov %o0, %o0
- ENDPROC(pci_sun4v_msiq_conf)
- /* %o0: devhandle
- * %o1: msiqid
- * %o2: &msiq_phys_addr
- * %o3: &msiq_num_entries
- *
- * returns %o0: status
- */
- ENTRY(pci_sun4v_msiq_info)
- mov %o2, %o4
- mov HV_FAST_PCI_MSIQ_INFO, %o5
- ta HV_FAST_TRAP
- stx %o1, [%o4]
- stx %o2, [%o3]
- retl
- mov %o0, %o0
- ENDPROC(pci_sun4v_msiq_info)
- /* %o0: devhandle
- * %o1: msiqid
- * %o2: &valid
- *
- * returns %o0: status
- */
- ENTRY(pci_sun4v_msiq_getvalid)
- mov HV_FAST_PCI_MSIQ_GETVALID, %o5
- ta HV_FAST_TRAP
- stx %o1, [%o2]
- retl
- mov %o0, %o0
- ENDPROC(pci_sun4v_msiq_getvalid)
- /* %o0: devhandle
- * %o1: msiqid
- * %o2: valid
- *
- * returns %o0: status
- */
- ENTRY(pci_sun4v_msiq_setvalid)
- mov HV_FAST_PCI_MSIQ_SETVALID, %o5
- ta HV_FAST_TRAP
- retl
- mov %o0, %o0
- ENDPROC(pci_sun4v_msiq_setvalid)
- /* %o0: devhandle
- * %o1: msiqid
- * %o2: &state
- *
- * returns %o0: status
- */
- ENTRY(pci_sun4v_msiq_getstate)
- mov HV_FAST_PCI_MSIQ_GETSTATE, %o5
- ta HV_FAST_TRAP
- stx %o1, [%o2]
- retl
- mov %o0, %o0
- ENDPROC(pci_sun4v_msiq_getstate)
- /* %o0: devhandle
- * %o1: msiqid
- * %o2: state
- *
- * returns %o0: status
- */
- ENTRY(pci_sun4v_msiq_setstate)
- mov HV_FAST_PCI_MSIQ_SETSTATE, %o5
- ta HV_FAST_TRAP
- retl
- mov %o0, %o0
- ENDPROC(pci_sun4v_msiq_setstate)
- /* %o0: devhandle
- * %o1: msiqid
- * %o2: &head
- *
- * returns %o0: status
- */
- ENTRY(pci_sun4v_msiq_gethead)
- mov HV_FAST_PCI_MSIQ_GETHEAD, %o5
- ta HV_FAST_TRAP
- stx %o1, [%o2]
- retl
- mov %o0, %o0
- ENDPROC(pci_sun4v_msiq_gethead)
- /* %o0: devhandle
- * %o1: msiqid
- * %o2: head
- *
- * returns %o0: status
- */
- ENTRY(pci_sun4v_msiq_sethead)
- mov HV_FAST_PCI_MSIQ_SETHEAD, %o5
- ta HV_FAST_TRAP
- retl
- mov %o0, %o0
- ENDPROC(pci_sun4v_msiq_sethead)
- /* %o0: devhandle
- * %o1: msiqid
- * %o2: &tail
- *
- * returns %o0: status
- */
- ENTRY(pci_sun4v_msiq_gettail)
- mov HV_FAST_PCI_MSIQ_GETTAIL, %o5
- ta HV_FAST_TRAP
- stx %o1, [%o2]
- retl
- mov %o0, %o0
- ENDPROC(pci_sun4v_msiq_gettail)
- /* %o0: devhandle
- * %o1: msinum
- * %o2: &valid
- *
- * returns %o0: status
- */
- ENTRY(pci_sun4v_msi_getvalid)
- mov HV_FAST_PCI_MSI_GETVALID, %o5
- ta HV_FAST_TRAP
- stx %o1, [%o2]
- retl
- mov %o0, %o0
- ENDPROC(pci_sun4v_msi_getvalid)
- /* %o0: devhandle
- * %o1: msinum
- * %o2: valid
- *
- * returns %o0: status
- */
- ENTRY(pci_sun4v_msi_setvalid)
- mov HV_FAST_PCI_MSI_SETVALID, %o5
- ta HV_FAST_TRAP
- retl
- mov %o0, %o0
- ENDPROC(pci_sun4v_msi_setvalid)
- /* %o0: devhandle
- * %o1: msinum
- * %o2: &msiq
- *
- * returns %o0: status
- */
- ENTRY(pci_sun4v_msi_getmsiq)
- mov HV_FAST_PCI_MSI_GETMSIQ, %o5
- ta HV_FAST_TRAP
- stx %o1, [%o2]
- retl
- mov %o0, %o0
- ENDPROC(pci_sun4v_msi_getmsiq)
- /* %o0: devhandle
- * %o1: msinum
- * %o2: msitype
- * %o3: msiq
- *
- * returns %o0: status
- */
- ENTRY(pci_sun4v_msi_setmsiq)
- mov HV_FAST_PCI_MSI_SETMSIQ, %o5
- ta HV_FAST_TRAP
- retl
- mov %o0, %o0
- ENDPROC(pci_sun4v_msi_setmsiq)
- /* %o0: devhandle
- * %o1: msinum
- * %o2: &state
- *
- * returns %o0: status
- */
- ENTRY(pci_sun4v_msi_getstate)
- mov HV_FAST_PCI_MSI_GETSTATE, %o5
- ta HV_FAST_TRAP
- stx %o1, [%o2]
- retl
- mov %o0, %o0
- ENDPROC(pci_sun4v_msi_getstate)
- /* %o0: devhandle
- * %o1: msinum
- * %o2: state
- *
- * returns %o0: status
- */
- ENTRY(pci_sun4v_msi_setstate)
- mov HV_FAST_PCI_MSI_SETSTATE, %o5
- ta HV_FAST_TRAP
- retl
- mov %o0, %o0
- ENDPROC(pci_sun4v_msi_setstate)
- /* %o0: devhandle
- * %o1: msinum
- * %o2: &msiq
- *
- * returns %o0: status
- */
- ENTRY(pci_sun4v_msg_getmsiq)
- mov HV_FAST_PCI_MSG_GETMSIQ, %o5
- ta HV_FAST_TRAP
- stx %o1, [%o2]
- retl
- mov %o0, %o0
- ENDPROC(pci_sun4v_msg_getmsiq)
- /* %o0: devhandle
- * %o1: msinum
- * %o2: msiq
- *
- * returns %o0: status
- */
- ENTRY(pci_sun4v_msg_setmsiq)
- mov HV_FAST_PCI_MSG_SETMSIQ, %o5
- ta HV_FAST_TRAP
- retl
- mov %o0, %o0
- ENDPROC(pci_sun4v_msg_setmsiq)
- /* %o0: devhandle
- * %o1: msinum
- * %o2: &valid
- *
- * returns %o0: status
- */
- ENTRY(pci_sun4v_msg_getvalid)
- mov HV_FAST_PCI_MSG_GETVALID, %o5
- ta HV_FAST_TRAP
- stx %o1, [%o2]
- retl
- mov %o0, %o0
- ENDPROC(pci_sun4v_msg_getvalid)
- /* %o0: devhandle
- * %o1: msinum
- * %o2: valid
- *
- * returns %o0: status
- */
- ENTRY(pci_sun4v_msg_setvalid)
- mov HV_FAST_PCI_MSG_SETVALID, %o5
- ta HV_FAST_TRAP
- retl
- mov %o0, %o0
- ENDPROC(pci_sun4v_msg_setvalid)
- /*
- * %o0: devhandle
- * %o1: r_addr
- * %o2: size
- * %o3: pagesize
- * %o4: virt
- * %o5: &iotsb_num/&iotsb_handle
- *
- * returns %o0: status
- * %o1: iotsb_num/iotsb_handle
- */
- ENTRY(pci_sun4v_iotsb_conf)
- mov %o5, %g1
- mov HV_FAST_PCI_IOTSB_CONF, %o5
- ta HV_FAST_TRAP
- retl
- stx %o1, [%g1]
- ENDPROC(pci_sun4v_iotsb_conf)
- /*
- * %o0: devhandle
- * %o1: iotsb_num/iotsb_handle
- * %o2: pci_device
- *
- * returns %o0: status
- */
- ENTRY(pci_sun4v_iotsb_bind)
- mov HV_FAST_PCI_IOTSB_BIND, %o5
- ta HV_FAST_TRAP
- retl
- nop
- ENDPROC(pci_sun4v_iotsb_bind)
- /*
- * %o0: devhandle
- * %o1: iotsb_num/iotsb_handle
- * %o2: index_count
- * %o3: iotte_attributes
- * %o4: io_page_list_p
- * %o5: &mapped
- *
- * returns %o0: status
- * %o1: #mapped
- */
- ENTRY(pci_sun4v_iotsb_map)
- mov %o5, %g1
- mov HV_FAST_PCI_IOTSB_MAP, %o5
- ta HV_FAST_TRAP
- retl
- stx %o1, [%g1]
- ENDPROC(pci_sun4v_iotsb_map)
- /*
- * %o0: devhandle
- * %o1: iotsb_num/iotsb_handle
- * %o2: iotsb_index
- * %o3: #iottes
- * %o4: &demapped
- *
- * returns %o0: status
- * %o1: #demapped
- */
- ENTRY(pci_sun4v_iotsb_demap)
- mov HV_FAST_PCI_IOTSB_DEMAP, %o5
- ta HV_FAST_TRAP
- retl
- stx %o1, [%o4]
- ENDPROC(pci_sun4v_iotsb_demap)
|