Unix Technical Forum

make sk(4) use pci_mapreg_type()

This is a discussion on make sk(4) use pci_mapreg_type() within the mailing.openbsd.tech forums, part of the OpenBSD category; --> Some systems will fail to attach sk(4) with pci_mapreg_map() failing with "can't map mem space". This should resolve that. ...


Go Back   Unix Technical Forum > Unix Operating Systems > OpenBSD > mailing.openbsd.tech

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-18-2008, 08:01 AM
Brad
 
Posts: n/a
Default make sk(4) use pci_mapreg_type()

Some systems will fail to attach sk(4) with pci_mapreg_map() failing
with "can't map mem space". This should resolve that. Also adds a
missing newline when pci_intr_establish() fails.

Index: if_sk.c
================================================== =================
RCS file: /cvs/src/sys/dev/pci/if_sk.c,v
retrieving revision 1.77
diff -u -p -r1.77 if_sk.c
--- if_sk.c 25 Jul 2005 00:49:43 -0000 1.77
+++ if_sk.c 28 Aug 2005 02:54:32 -0000
@@ -1431,11 +1431,11 @@ skc_attach(struct device *parent, struct
struct pci_attach_args *pa = aux;
struct skc_attach_args skca;
pci_chipset_tag_t pc = pa->pa_pc;
+ pcireg_t command, memtype;
pci_intr_handle_t ih;
const char *intrstr = NULL;
bus_size_t size;
u_int8_t skrs;
- u_int32_t command;
char *revstr = NULL;

DPRINTFN(2, ("begin skc_attach\n"));
@@ -1481,11 +1481,18 @@ skc_attach(struct device *parent, struct
return;
}
#else
- if (pci_mapreg_map(pa, SK_PCI_LOMEM, PCI_MAPREG_TYPE_MEM, 0,
- &sc->sk_btag, &sc->sk_bhandle, NULL, &size, 0)) {
- printf(": can't map mem space\n");
+ memtype = pci_mapreg_type(pc, pa->pa_tag, SK_PCI_LOMEM);
+ switch (memtype) {
+ case PCI_MAPREG_TYPE_MEM | PCI_MAPREG_MEM_TYPE_32BIT:
+ case PCI_MAPREG_TYPE_MEM | PCI_MAPREG_MEM_TYPE_64BIT:
+ if (pci_mapreg_map(pa, SK_PCI_LOMEM,
+ memtype, 0, &sc->sk_btag, &sc->sk_bhandle,
+ NULL, &size, 0) == 0)
+ break;
+ default:
+ printf(": can't map mem space\n");
return;
- }
+ }
#endif
sc->sc_dmatag = pa->pa_dmat;

@@ -1512,6 +1519,7 @@ skc_attach(struct device *parent, struct
printf(": couldn't establish interrupt");
if (intrstr != NULL)
printf(" at %s", intrstr);
+ printf("\n");
goto fail_1;
}
printf(": %s\n", intrstr);

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 02:45 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com