Pronađite pravu stvar za sebe, kupujte uz popust!
Top Shop Još samo 10 dana super letnja ponuda samo za ljubitelje šopinga i fudbala ! Šoping uz 40% popusta! Dry Cooker Quelle letnja garderoba uz ekstra popust! Majice, tunike, pantalone, suknje, haljine, košulje, pidE>ame - sve 40% jeftinije! Sjajan izbor E>enske letnje garderobe... Udobno navijanje uz ekstra popust! Air Sofa Bed Air Sofa Bed - 5 u 1 sofa na naduvavanje PoE>urite, još samo 10 dana moE>ete obezbediti sebi sofu uz 10% popusta! Vaša cena: 6.741 rsd Obraduj sebe ili nekog dragog proizvodima na letnjem SUPER POPUSTU - klikni i odaberi! Ovu elektronsku poštu primate, ukoliko ste svojevoljno ostavili svoju e-mail adresu na nekom od sajtova Top Shop-a, uD estvovali u našoj poklon igri ili nagradnom kvizu ili se prijavili za e-D asopis Top Shop-a ili nekog od nasih brendova. Ponude date u ovom e-mailu vaE>e iskljuD ivo za porudE>bine upuDene putem Interneta ili broja telefona 021 489 26 60. Ukoliko ne E>elite više da primate naše elektronske poruke, za odjavljivanje sa naše e-mailing liste, kliknite ovde. Studio Moderna d.o.o., Bulevar vojvode Stepe 30, 21000 Novi Sad, Tel: 021 489 26 60, Fax: 021 489 29 08, E-mail: i...@news.e-topshop.tv [IMAGE]If you would no longer like to receive our emails please unsubscribe by clicking here.
Re: [resend] Please test this ACPI panic check diff
yeah. someone checked something in. just take that out for now, the test will work fine unless you're suspending > Date: Thu, 1 Jul 2010 18:16:23 -0400 > Subject: Re: [resend] Please test this ACPI panic check diff > From: ted.unan...@gmail.com > To: jor...@cvs.openbsd.org > CC: jhar...@gmail.com; tech@openbsd.org > > On Thu, Jul 1, 2010 at 2:53 PM, Jordan Hargrave wrote: >> Index: dev/acpi/acpi.c >> === >> RCS file: /cvs/src/sys/dev/acpi/acpi.c,v >> retrieving revision 1.169 >> diff -u -p -u -p -b -r1.169 acpi.c >> --- dev/acpi/acpi.c 1 Jul 2010 16:23:46 - 1.169 >> +++ dev/acpi/acpi.c 1 Jul 2010 18:36:00 - >> @@ -18,7 +18,6 @@ >> >> #include >> #include >> -#include >> #include >> #include >> #include > > This part is wrong, as it won't compile against current with it. _ Hotmail has tools for the New Busy. Search, chat and e-mail from your inbox. http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL :en-US:WM_HMP:042010_1
Re: [resend] Please test this ACPI panic check diff
On Thu, Jul 1, 2010 at 2:53 PM, Jordan Hargrave wrote: > Index: dev/acpi/acpi.c > === > RCS file: /cvs/src/sys/dev/acpi/acpi.c,v > retrieving revision 1.169 > diff -u -p -u -p -b -r1.169 acpi.c > --- dev/acpi/acpi.c 1 Jul 2010 16:23:46 - 1.169 > +++ dev/acpi/acpi.c 1 Jul 2010 18:36:00 - > @@ -18,7 +18,6 @@ > > #include > #include > -#include > #include > #include > #include This part is wrong, as it won't compile against current with it.
Re: About the bug #6409 -got some informations (Erratum)
Le 01/07/2010 22:49, Kenneth R Westerback a icrit : > On Thu, Jul 01, 2010 at 09:45:48PM +0200, Fr?d?ric URBAN wrote: > >> My bad !!! It was the bug #6408 - Initialization of "Intel PRO/1000ET >> (82576)" failed sometimes. >> >> And this mail address is prefered for reply ! >> >> Sad FWD is taboo :( >> >> Fred... >> >> Message original >> Sujet: About the bug #6409 -got some informations >> Date : Thu, 01 Jul 2010 21:40:14 +0200 >> De : Fridiric URBAN >> Pour : b...@openbsd.org >> >> >> >> Hello, >> >> I've some informations about the bug #6409, I fixed a part of it and i >> think what i did could be helpfull for thoses who'll try to fix it. Who >> can I contact ? Where can I put those informations ? >> >> Fred... >> >> > Send your diff to tech@openbsd.org > > Ken > I've no diff to send, i made to much change in the code to get enough debug verbosity but i've the analysis of the problem from the post i made on misc: Form misc ML: Message original Sujet: Re: Intel PRO/1000 QP on Dell R610 and OpenBSD 4.7 Date : Thu, 01 Jul 2010 22:18:42 +0200 De :Fridiric URBAN Pour : m...@openbsd.org > Le 29/06/2010 20:46, Fridiric URBAN a icrit : > ... Useless blabla from meh... > > PS: I'll have fiber card soon, we'll see they have the same problem. > > Fred > Ok it's confirmed, the PHY used on the card has a strange behavior. Each time that the function em_read_phy_reg() is used there is a risk of failure, The PHY is more often busy than useall. I added some debug information in the code which show the return code of em_read_phy_reg() and sometimes E1000_ERR_PHY is returned. This function is called very very often (which is obvious). When it happends the interface won't work. I partially fixed the hardware initialization by adding a timed retry when the PHY is busy (in em_setup_copper_link()), but there is still lots of occurrence of em_read_phy_reg() that need to be modified (ie: I already had error in em_copper_link_autoneg()) and it's the first time I put my finger inside a device driver :E So maybe there is a better way to fix it ! We need a kernel guru !!! :D Fred Btw, I took the idea of the timed retry of em_read_phy_reg() from FreeBSD igb driver, in their equivalent of em_setup_copper_link(), they use it.
Fix Carpdemote in sasyncd
This diff fixes some issues around sasyncd's handling of the carpdemote flag, fixing some signal handling, cleanup, and logging issues. Here's the problem I am seeing. Some background: # ifconfig -g carp carp: carp demote count 0 This is the normal case. If I poke the demote counter (essentially, forcing the machine to be a backup), I see this: # ifconfig -g carp carpdemote 1 carp: carp demote count 1 this is normal. But if I start sasyncd, then kill it, the demote flag is raised, but never lowered afterwards: # sasyncd -vv # pkill sasyncd # ifconfig -g carp carp: carp demote count 2 The reason is that if sasyncd sees a nonzero demote, it raises the demote flag by 1, and schedules a demotion a minute later. This is presumably to allow time for whatever caused the demotion to finish before sasync lets the machine take over as master. BUT, if this scheduled demote doesn't happen, the machine is left hanging. This problem also occasionally happens if carp is misconfigured. (e.g. if carp_init fails) To fix, i tried to ensure that whatever sasyncd does to demote, it undoes on exit (both in the parent, and child). Anyway, on this box, this fixes all cases of demote getting set, but not unset. This incorporates feedback and suggestions by hshoexer@, Please, anyone who actually uses sasyncd, give this a whirl and report whether everything works (or ideally, gets better): diff is against -current, obviously Index: carp.c === RCS file: /cvs/src/usr.sbin/sasyncd/carp.c,v retrieving revision 1.12 diff -u -r1.12 carp.c --- carp.c 29 Jun 2010 21:25:37 - 1.12 +++ carp.c 1 Jul 2010 19:07:36 - @@ -147,6 +147,13 @@ close(s); } +void +carp_undemote(void) +{ + if (carp_demoted) + carp_demote(-carp_demoted, 1); +} + const char* carp_state_name(enum RUNSTATE state) { Index: log.c === RCS file: /cvs/src/usr.sbin/sasyncd/log.c,v retrieving revision 1.6 diff -u -r1.6 log.c --- log.c 11 Nov 2009 23:05:28 - 1.6 +++ log.c 1 Jul 2010 19:07:36 - @@ -37,6 +37,7 @@ #include #include #include +#include #include "sasyncd.h" @@ -52,10 +53,17 @@ static void log_output(char *msg) { + char*prefix; + + if (getuid()) + prefix = ""; + else + prefix = "[priv]"; + if (cfgstate.debug) - fprintf(stderr, "%s\n", msg); + fprintf(stderr, "%s %s\n", prefix, msg); else - syslog(LOG_CRIT, "%s", msg); + syslog(LOG_CRIT, "%s %s", prefix, msg); } void Index: monitor.c === RCS file: /cvs/src/usr.sbin/sasyncd/monitor.c,v retrieving revision 1.14 diff -u -r1.14 monitor.c --- monitor.c 29 Jun 2010 18:10:04 - 1.14 +++ monitor.c 1 Jul 2010 19:07:36 - @@ -56,6 +56,7 @@ volatile sig_atomic_t sigchld = 0; +static voidset_monitor_signals(void); static voidgot_sigchld(int); static voidsig_to_child(int); static voidm_priv_pfkey_snap(int); @@ -86,10 +87,7 @@ strlcpy(root, pw->pw_dir, sizeof root); endpwent(); - signal(SIGCHLD, got_sigchld); - signal(SIGTERM, sig_to_child); - signal(SIGHUP, sig_to_child); - signal(SIGINT, sig_to_child); + set_monitor_signals(); m_state.pid = fork(); @@ -98,6 +96,8 @@ exit(1); } else if (m_state.pid == 0) { /* Child */ + set_slave_signals(); + m_state.s = p[0]; close(p[1]); @@ -122,6 +122,22 @@ } static void +set_monitor_signals(void) +{ + int n; + + for (n = 1; n < _NSIG; n++) + signal(n, SIG_DFL); + + signal(SIGCHLD, got_sigchld); + + /* Forward some signals to the child. */ + signal(SIGTERM, sig_to_child); + signal(SIGINT, sig_to_child); + signal(SIGHUP, sig_to_child); +} + +static void got_sigchld(int s) { sigchld = 1; @@ -130,8 +146,11 @@ static void sig_to_child(int s) { - if (m_state.pid != -1) + int oerrno = errno; + + if (m_state.pid > 0) kill(m_state.pid, s); + errno = oerrno; } static void @@ -228,7 +247,7 @@ } } - monitor_carpundemote(NULL); + carp_undemote(); if (!sigchld) log_msg(0, "monitor_loop: priv process exiting abnormally"); Index: sasyncd.c === RCS file: /cvs/src/usr.sbin/sasyncd/sasyncd.c,v retrieving revision 1.20 diff -u -r1.20 sasyncd.c --- sasyncd.c 16 Jun 2010 17:39:05 - 1.20 +++ sasyncd.c 1 Jul 2010 19:07:36 - @@ -52,6 +52,18 @@ daemon_shutdown++; } +void +set_slave_signals(void) +{ + int
[resend] Please test this ACPI panic check diff
Index: arch/i386/pci/pci_machdep.c === RCS file: /cvs/src/sys/arch/i386/pci/pci_machdep.c,v retrieving revision 1.52 diff -u -p -u -p -b -r1.52 pci_machdep.c --- arch/i386/pci/pci_machdep.c 1 Jul 2010 06:29:32 - 1.52 +++ arch/i386/pci/pci_machdep.c 1 Jul 2010 18:36:00 - @@ -667,6 +667,6 @@ void pci_dev_postattach(struct device *dev, struct pci_attach_args *pa) { #if NACPI > 0 - //acpi_pci_match(dev, pa); + acpi_pci_match(dev, pa); #endif } Index: arch/amd64/pci/pci_machdep.c === RCS file: /cvs/src/sys/arch/amd64/pci/pci_machdep.c,v retrieving revision 1.34 diff -u -p -u -p -b -r1.34 pci_machdep.c --- arch/amd64/pci/pci_machdep.c1 Jul 2010 06:29:32 - 1.34 +++ arch/amd64/pci/pci_machdep.c1 Jul 2010 18:36:00 - @@ -428,6 +428,6 @@ void pci_dev_postattach(struct device *dev, struct pci_attach_args *pa) { #if NACPI > 0 - //acpi_pci_match(dev, pa); + acpi_pci_match(dev, pa); #endif } Index: dev/acpi/acpi.c === RCS file: /cvs/src/sys/dev/acpi/acpi.c,v retrieving revision 1.169 diff -u -p -u -p -b -r1.169 acpi.c --- dev/acpi/acpi.c 1 Jul 2010 16:23:46 - 1.169 +++ dev/acpi/acpi.c 1 Jul 2010 18:36:00 - @@ -1,4 +1,4 @@ -/* $OpenBSD: acpi.c,v 1.169 2010/07/01 16:23:46 thib Exp $ */ +/* $OpenBSD: acpi.c,v 1.167 2010/07/01 01:39:39 jordan Exp $ */ /* * Copyright (c) 2005 Thorsten Lockert * Copyright (c) 2005 Jordan Hargrave @@ -18,7 +18,6 @@ #include #include -#include #include #include #include @@ -42,6 +41,10 @@ #include #include +#include +#include +#include + #include #include @@ -67,6 +70,8 @@ int acpi_saved_spl; void acpi_isr_thread(void *); void acpi_create_thread(void *); +void acpi_pci_match(struct device *, struct pci_attach_args *); + intacpi_match(struct device *, void *, void *); void acpi_attach(struct device *, struct device *, void *); intacpi_submatch(struct device *, void *, void *); @@ -95,12 +100,15 @@ int acpi_foundide(struct aml_node *node, int acpiide_notify(struct aml_node *, int, void *); int_acpi_matchhids(const char *, const char *[]); +intacpi_matchhids(struct acpi_attach_args *aa, const char *hids[], + const char *driver); + +struct acpi_q *acpi_maptable(struct acpi_softc *, paddr_t, const char *, + const char *, const char *, int); void wdcattach(struct channel_softc *); int wdcdetach(struct channel_softc *, int); -struct acpi_q *acpi_maptable(struct acpi_softc *, paddr_t, const char *, const char *, const char *, int); - struct idechnl { struct acpi_softc *sc; @@ -493,6 +501,150 @@ acpi_match(struct device *parent, void * return (1); } +TAILQ_HEAD(, acpi_pci) acpi_pcidevs = +TAILQ_HEAD_INITIALIZER(acpi_pcidevs); + +int acpi_getpci(struct aml_node *node, void *arg); +int acpi_getminbus(union acpi_resource *crs, void *arg); + +int +acpi_getminbus(union acpi_resource *crs, void *arg) +{ + int *bbn = arg; + int typ = AML_CRSTYPE(crs); + + /* Check for embedded bus number */ + if (typ == LR_WORD && crs->lr_word.type == 2) + *bbn = crs->lr_word._min; + return 0; +} + +int +_acpi_matchhids(const char *hid, const char *hids[]) +{ + int i; + + for (i = 0; hids[i]; i++) + if (!strcmp(hid, hids[i])) + return (1); + return (0); +} + +int +acpi_matchhids(struct acpi_attach_args *aa, const char *hids[], +const char *driver) +{ + + if (aa->aaa_dev == NULL || aa->aaa_node == NULL) + return (0); + if (_acpi_matchhids(aa->aaa_dev, hids)) { + dnprintf(5, "driver %s matches %s\n", driver, hids[i]); + return (1); + } + return (0); +} + +/* Map ACPI device node to PCI */ +int +acpi_getpci(struct aml_node *node, void *arg) +{ + const char *pcihid[] = { ACPI_DEV_PCIB, ACPI_DEV_PCIEB, "HWP0002", 0 }; + struct acpi_pci *pci, *ppci; + struct aml_value res; + struct acpi_softc *sc = arg; + pci_chipset_tag_t pc = NULL; + pcitag_t tag; + uint64_t val; + uint32_t reg; + + if (!node->value || node->value->type != AML_OBJTYPE_DEVICE) + return 0; + if (!aml_evalhid(node, &res)) { + /* Check if this is a PCI Root node */ + if (_acpi_matchhids(res.v_string, pcihid)) { + aml_freevalue(&res); + + pci = malloc(sizeof(*pci), M_DEVBUF, M_WAITOK|M_ZERO); + + if (!aml_evalinteger(sc, node, "_SEG", 0, NULL, &val)) + pci->seg = val; + if (!aml_evalinteger(sc, node, "_BBN", 0, NULL, &val)) + pci->bus = val; +
ACPI panic check, please test
This is the latest ACPI pci mapping revision diff, please test this and report if your system generates a panic. Looking to test mainly on Dell PE or Rxxx systems, but also any server-class hardware (HP, etc). If you see a panic, please send the files generated by acpidump -o and pcidump -vv > .pci Also interested in successful dmesg. Index: arch/i386/pci/pci_machdep.c === RCS file: /cvs/src/sys/arch/i386/pci/pci_machdep.c,v retrieving revision 1.52 diff -u -p -u -p -b -r1.52 pci_machdep.c --- arch/i386/pci/pci_machdep.c 1 Jul 2010 06:29:32 - 1.52 +++ arch/i386/pci/pci_machdep.c 1 Jul 2010 18:36:00 - @@ -667,6 +667,6 @@ void pci_dev_postattach(struct device *dev, struct pci_attach_args *pa) { #if NACPI > 0 - //acpi_pci_match(dev, pa); + acpi_pci_match(dev, pa); #endif } Index: arch/amd64/pci/pci_machdep.c === RCS file: /cvs/src/sys/arch/amd64/pci/pci_machdep.c,v retrieving revision 1.34 diff -u -p -u -p -b -r1.34 pci_machdep.c --- arch/amd64/pci/pci_machdep.c1 Jul 2010 06:29:32 - 1.34 +++ arch/amd64/pci/pci_machdep.c1 Jul 2010 18:36:00 - @@ -428,6 +428,6 @@ void pci_dev_postattach(struct device *dev, struct pci_attach_args *pa) { #if NACPI > 0 - //acpi_pci_match(dev, pa); + acpi_pci_match(dev, pa); #endif } Index: dev/acpi/acpi.c === RCS file: /cvs/src/sys/dev/acpi/acpi.c,v retrieving revision 1.169 diff -u -p -u -p -b -r1.169 acpi.c --- dev/acpi/acpi.c 1 Jul 2010 16:23:46 - 1.169 +++ dev/acpi/acpi.c 1 Jul 2010 18:36:00 - @@ -1,4 +1,4 @@ -/* $OpenBSD: acpi.c,v 1.169 2010/07/01 16:23:46 thib Exp $ */ +/* $OpenBSD: acpi.c,v 1.167 2010/07/01 01:39:39 jordan Exp $ */ /* * Copyright (c) 2005 Thorsten Lockert * Copyright (c) 2005 Jordan Hargrave @@ -18,7 +18,6 @@ #include #include -#include #include #include #include @@ -42,6 +41,10 @@ #include #include +#include +#include +#include + #include #include @@ -67,6 +70,8 @@ int acpi_saved_spl; void acpi_isr_thread(void *); void acpi_create_thread(void *); +void acpi_pci_match(struct device *, struct pci_attach_args *); + intacpi_match(struct device *, void *, void *); void acpi_attach(struct device *, struct device *, void *); intacpi_submatch(struct device *, void *, void *); @@ -95,12 +100,15 @@ int acpi_foundide(struct aml_node *node, int acpiide_notify(struct aml_node *, int, void *); int_acpi_matchhids(const char *, const char *[]); +intacpi_matchhids(struct acpi_attach_args *aa, const char *hids[], + const char *driver); + +struct acpi_q *acpi_maptable(struct acpi_softc *, paddr_t, const char *, + const char *, const char *, int); void wdcattach(struct channel_softc *); int wdcdetach(struct channel_softc *, int); -struct acpi_q *acpi_maptable(struct acpi_softc *, paddr_t, const char *, const char *, const char *, int); - struct idechnl { struct acpi_softc *sc; @@ -493,6 +501,150 @@ acpi_match(struct device *parent, void * return (1); } +TAILQ_HEAD(, acpi_pci) acpi_pcidevs = +TAILQ_HEAD_INITIALIZER(acpi_pcidevs); + +int acpi_getpci(struct aml_node *node, void *arg); +int acpi_getminbus(union acpi_resource *crs, void *arg); + +int +acpi_getminbus(union acpi_resource *crs, void *arg) +{ + int *bbn = arg; + int typ = AML_CRSTYPE(crs); + + /* Check for embedded bus number */ + if (typ == LR_WORD && crs->lr_word.type == 2) + *bbn = crs->lr_word._min; + return 0; +} + +int +_acpi_matchhids(const char *hid, const char *hids[]) +{ + int i; + + for (i = 0; hids[i]; i++) + if (!strcmp(hid, hids[i])) + return (1); + return (0); +} + +int +acpi_matchhids(struct acpi_attach_args *aa, const char *hids[], +const char *driver) +{ + + if (aa->aaa_dev == NULL || aa->aaa_node == NULL) + return (0); + if (_acpi_matchhids(aa->aaa_dev, hids)) { + dnprintf(5, "driver %s matches %s\n", driver, hids[i]); + return (1); + } + return (0); +} + +/* Map ACPI device node to PCI */ +int +acpi_getpci(struct aml_node *node, void *arg) +{ + const char *pcihid[] = { ACPI_DEV_PCIB, ACPI_DEV_PCIEB, "HWP0002", 0 }; + struct acpi_pci *pci, *ppci; + struct aml_value res; + struct acpi_softc *sc = arg; + pci_chipset_tag_t pc = NULL; + pcitag_t tag; + uint64_t val; + uint32_t reg; + + if (!node->value || node->value->type != AML_OBJTYPE_DEVICE) + return 0; + if (!aml_evalhid(node, &res)) { + /* Check if this is a PCI Root node */ + if (_acpi_matchhids(res.v_string, pcihid)) { + aml_freevalue(&res); + +
Re: Enable speedstep on nehalem (i3/5/7) cpus
> Date: Sat, 26 Jun 2010 23:48:15 -0600 (MDT) > From: g...@gwk.ca (Gordon Willem Klok) > > Hello this should make speedstep work on nehalem cpu's (i3, i5, i7s) where > est uses acpi to get the available states. Please let me know of any > issues Seems to work fine on; I get different md5 -t speeds for different hw.setperf values. OpenBSD 4.7-current (GENERIC.MP) #3: Thu Jul 1 18:52:04 CEST 2010 r...@sfxc-d2.sfxc.jive.nl:/usr/src/sys/arch/amd64/compile/GENERIC.MP real mem = 3211264000 (3062MB) avail mem = 3111936000 (2967MB) mainbus0 at root bios0 at mainbus0: SMBIOS rev. 2.6 @ 0x9bc00 (44 entries) bios0: vendor American Megatrends Inc. version "080015" date 09/23/2009 bios0: Supermicro X8DTT acpi0 at bios0: rev 2 acpi0: tables DSDT FACP APIC MCFG OEMB SRAT DMAR SSDT EINJ BERT ERST HEST acpi0: wakeup devices P0P1(S4) USB0(S4) USB1(S4) USB2(S4) USB5(S4) EUSB(S4) USB3(S4) USB4(S4) USB6(S4) USBE(S4) GBE_(S4) P0P4(S4) P0P5(S4) P0P6(S4) P0P7(S4) P0P8(S4) P0P9(S4) NPE1(S4) NPE2(S4) NPE7(S4) NPE8(S4) NPE9(S4) NPEA(S4) SLPB(S4) acpitimer0 at acpi0: 3579545 Hz, 24 bits acpimadt0 at acpi0 addr 0xfee0: PC-AT compat cpu0 at mainbus0: apid 0 (boot processor) cpu0: Intel(R) Xeon(R) CPU E5520 @ 2.27GHz, 2267.02 MHz cpu0: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,SBF,SSE3,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,DCA,SSE4.1,SSE4.2,POPCNT,NXE,LONG cpu0: 256KB 64b/line 8-way L2 cache cpu0: apic clock running at 133MHz cpu1 at mainbus0: apid 2 (application processor) cpu1: Intel(R) Xeon(R) CPU E5520 @ 2.27GHz, 2266.75 MHz cpu1: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,SBF,SSE3,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,DCA,SSE4.1,SSE4.2,POPCNT,NXE,LONG cpu1: 256KB 64b/line 8-way L2 cache cpu2 at mainbus0: apid 4 (application processor) cpu2: Intel(R) Xeon(R) CPU E5520 @ 2.27GHz, 2266.75 MHz cpu2: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,SBF,SSE3,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,DCA,SSE4.1,SSE4.2,POPCNT,NXE,LONG cpu2: 256KB 64b/line 8-way L2 cache cpu3 at mainbus0: apid 6 (application processor) cpu3: Intel(R) Xeon(R) CPU E5520 @ 2.27GHz, 2266.75 MHz cpu3: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,SBF,SSE3,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,DCA,SSE4.1,SSE4.2,POPCNT,NXE,LONG cpu3: 256KB 64b/line 8-way L2 cache cpu4 at mainbus0: apid 16 (application processor) cpu4: Intel(R) Xeon(R) CPU E5520 @ 2.27GHz, 2266.75 MHz cpu4: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,SBF,SSE3,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,DCA,SSE4.1,SSE4.2,POPCNT,NXE,LONG cpu4: 256KB 64b/line 8-way L2 cache cpu5 at mainbus0: apid 18 (application processor) cpu5: Intel(R) Xeon(R) CPU E5520 @ 2.27GHz, 2266.75 MHz cpu5: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,SBF,SSE3,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,DCA,SSE4.1,SSE4.2,POPCNT,NXE,LONG cpu5: 256KB 64b/line 8-way L2 cache cpu6 at mainbus0: apid 20 (application processor) cpu6: Intel(R) Xeon(R) CPU E5520 @ 2.27GHz, 2266.75 MHz cpu6: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,SBF,SSE3,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,DCA,SSE4.1,SSE4.2,POPCNT,NXE,LONG cpu6: 256KB 64b/line 8-way L2 cache cpu7 at mainbus0: apid 22 (application processor) cpu7: Intel(R) Xeon(R) CPU E5520 @ 2.27GHz, 2266.75 MHz cpu7: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,SBF,SSE3,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,DCA,SSE4.1,SSE4.2,POPCNT,NXE,LONG cpu7: 256KB 64b/line 8-way L2 cache ioapic0 at mainbus0: apid 1 pa 0xfec0, version 20, 24 pins ioapic0: misconfigured as apic 8, remapped to apid 1 acpiprt0 at acpi0: bus 0 (PCI0) acpiprt1 at acpi0: bus 5 (P0P1) acpiprt2 at acpi0: bus 1 (NPE1) acpiprt3 at acpi0: bus -1 (NPE2) acpiprt4 at acpi0: bus 4 (NPE7) acpiprt5 at acpi0: bus -1 (NPE8) acpiprt6 at acpi0: bus -1 (NPE9) acpiprt7 at acpi0: bus -1 (NPEA) acpiprt8 at acpi0: bus 2 (NPE3) acpicpu0 at acpi0: C3, C3, C1, PSS acpicpu1 at acpi0: C3, C3, C1, PSS acpicpu2 at acpi0: C3, C3, C1, PSS acpicpu3 at acpi0: C3, C3, C1, PSS acpicpu4 at acpi0: C3, C3, C1, PSS acpicpu5 at acpi0: C3, C3, C1, PSS acpicpu6 at acpi0: C3, C3, C1, PSS acpicpu7 at acpi0: C3, C3, C1, PSS acpibtn0 at acpi0: SLPB acpibtn1 at acpi0: PWRB ipmi at mainbus0 not configured cpu0: Enhanced SpeedStep 2266 MHz: speeds: 2268, 2267, 2133, 2000, 1867, 1733, 1600 MHz pci0 at mainbus0 bus 0 pchb0 at pci0 dev 0 function 0 "Intel 5520 Host" rev 0x13 ppb0 at pci0 dev 1 function 0 "Intel X58 PCIE" rev 0x13 pci1 at ppb0 bus 1 em
Re: ACPI PCI mapping revert diff
On 2010/07/01 11:27, jordan hargrave wrote: > Hmm.. this should work off -current (the reverted stuff). > rm *.c *.h in dev/acpi > cvs xxx -q up -PAd > patch < revert.diff Oh I see what it is, your mail got mangled with format=flowed: Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII > Essentially, it's a backout of the backout, plus the _HID change.. > The hid diff alone (makes R210 work on pre-revert) is: Thanks, from those instructions I have been able to assemble this diff. I will run it on some machines soon Index: acpi.c === RCS file: /cvs/src/sys/dev/acpi/acpi.c,v retrieving revision 1.168 diff -u -p -r1.168 acpi.c --- acpi.c 1 Jul 2010 06:29:32 - 1.168 +++ acpi.c 1 Jul 2010 16:04:10 - @@ -1,4 +1,4 @@ -/* $OpenBSD: acpi.c,v 1.168 2010/07/01 06:29:32 jordan Exp $ */ +/* $OpenBSD: acpi.c,v 1.167 2010/07/01 01:39:39 jordan Exp $ */ /* * Copyright (c) 2005 Thorsten Lockert * Copyright (c) 2005 Jordan Hargrave @@ -18,6 +18,7 @@ #include #include +#include #include #include #include @@ -41,6 +42,10 @@ #include #include +#include +#include +#include + #include #include @@ -66,6 +71,8 @@ int acpi_saved_spl; void acpi_isr_thread(void *); void acpi_create_thread(void *); +void acpi_pci_match(struct device *, struct pci_attach_args *); + intacpi_match(struct device *, void *, void *); void acpi_attach(struct device *, struct device *, void *); intacpi_submatch(struct device *, void *, void *); @@ -94,12 +101,15 @@ int acpi_foundide(struct aml_node *node, int acpiide_notify(struct aml_node *, int, void *); int_acpi_matchhids(const char *, const char *[]); +intacpi_matchhids(struct acpi_attach_args *aa, const char *hids[], + const char *driver); + +struct acpi_q *acpi_maptable(struct acpi_softc *, paddr_t, const char *, + const char *, const char *, int); void wdcattach(struct channel_softc *); int wdcdetach(struct channel_softc *, int); -struct acpi_q *acpi_maptable(struct acpi_softc *, paddr_t, const char *, const char *, const char *, int); - struct idechnl { struct acpi_softc *sc; @@ -492,6 +502,150 @@ acpi_match(struct device *parent, void * return (1); } +TAILQ_HEAD(, acpi_pci) acpi_pcidevs = +TAILQ_HEAD_INITIALIZER(acpi_pcidevs); + +int acpi_getpci(struct aml_node *node, void *arg); +int acpi_getminbus(union acpi_resource *crs, void *arg); + +int +acpi_getminbus(union acpi_resource *crs, void *arg) +{ + int *bbn = arg; + int typ = AML_CRSTYPE(crs); + + /* Check for embedded bus number */ + if (typ == LR_WORD && crs->lr_word.type == 2) + *bbn = crs->lr_word._min; + return 0; +} + +int +_acpi_matchhids(const char *hid, const char *hids[]) +{ + int i; + + for (i = 0; hids[i]; i++) + if (!strcmp(hid, hids[i])) + return (1); + return (0); +} + +int +acpi_matchhids(struct acpi_attach_args *aa, const char *hids[], +const char *driver) +{ + + if (aa->aaa_dev == NULL || aa->aaa_node == NULL) + return (0); + if (_acpi_matchhids(aa->aaa_dev, hids)) { + dnprintf(5, "driver %s matches %s\n", driver, hids[i]); + return (1); + } + return (0); +} + +/* Map ACPI device node to PCI */ +int +acpi_getpci(struct aml_node *node, void *arg) +{ + const char *pcihid[] = { ACPI_DEV_PCIB, ACPI_DEV_PCIEB, "HWP0002", 0 }; + struct acpi_pci *pci, *ppci; + struct aml_value res; + struct acpi_softc *sc = arg; + pci_chipset_tag_t pc = NULL; + pcitag_t tag; + uint64_t val; + uint32_t reg; + + if (!node->value || node->value->type != AML_OBJTYPE_DEVICE) + return 0; + if (!aml_evalhid(node, &res)) { + /* Check if this is a PCI Root node */ + if (_acpi_matchhids(res.v_string, pcihid)) { + aml_freevalue(&res); + + pci = malloc(sizeof(*pci), M_DEVBUF, M_WAITOK|M_ZERO); + + if (!aml_evalinteger(sc, node, "_SEG", 0, NULL, &val)) + pci->seg = val; + if (!aml_evalinteger(sc, node, "_BBN", 0, NULL, &val)) + pci->bus = val; + else if (!aml_evalname(sc, node, "_CRS", 0, NULL, &res)) { + aml_parse_resource(&res, acpi_getminbus, + &pci->bus); + } + pci->sub = pci->bus; + node->pci = pci; + dnprintf(10, "found PCI root: %s %d\n", + aml_nodename(node), pci->bus); + } + aml_freevalue(&res); + return 0; + } + + /* If parent is not PCI, or device does not have _ADR, return
Re: better cpu throttling
On Wed, Jun 30, 2010 at 03:34:14PM -0400, Ted Unangst wrote: > On Wed, Jun 30, 2010 at 3:23 PM, Luis Henriques > wrote: > > Probably, a silly question, but here it goes: > > > > With this patch, I will not be able to set the perflevel to, say, 50% and > > keep the system using that performance level forever. Is this correct? > > I guess that with current apmd we are able to do this. > > > > If both of these two statements are true (maybe they are not!), we should > > also have a mechanism to disable this code (either at runtime or compile > > time). > > You are correct, but I wonder why you would ever want a machine only > running at 50% all the time. When it is busy, it's still slow, and > when it's not, it's still using power. In my X31 it scales between 600 and 1600 MHz, or something like that. And when I keep it around setperf 40 it avoids turning the fan on. Which is handy when for example you're compiling something and leave it by bed ;) I didn't say it was a very good reason ;) > We are thinking that states > other than 0 and 100 are not very useful. But this is not the final > diff. It will probably have some means of control eventually, until > then, it'd be nice if people evaluated if this meets their needs. -- viq [demime 1.01d removed an attachment of type application/pgp-signature]
Re: ACPI PCI mapping revert diff
Hmm.. this should work off -current (the reverted stuff). rm *.c *.h in dev/acpi cvs xxx -q up -PAd patch < revert.diff Essentially, it's a backout of the backout, plus the _HID change.. The hid diff alone (makes R210 work on pre-revert) is: Index: dsdt.c === RCS file: /cvs/src/sys/dev/acpi/dsdt.c,v retrieving revision 1.163 diff -u -p -u -p -b -r1.163 dsdt.c --- dsdt.c 1 Jul 2010 01:39:39 - 1.163 +++ dsdt.c 1 Jul 2010 15:25:48 - @@ -3745,12 +3745,7 @@ aml_xparse(struct aml_scope *scope, int /* Name: Nt */ rv = opargs[0]; aml_freevalue(rv); - if (!strcmp(rv->node->name, "_HID") && opargs[1]->type == AML_OBJTYPE_INTEGER) { - /* Shortcut for _HID: autoconvert to string */ - _aml_setvalue(rv, AML_OBJTYPE_STRING, -1, aml_eisaid(opargs[1]->v_integer)); - } else { aml_copyvalue(rv, opargs[1]); - } break; case AMLOP_ALIAS: /* Alias: nN */ On Thu, Jul 1, 2010 at 8:27 AM, Stuart Henderson wrote: > On 2010/07/01 03:37, Jordan Hargrave wrote: >> So found the problem; on the R210 the AML code CHANGES the _HID for >> the PCI Root Bus depending on the _OSI OS running.. UGH >> >> I'd had code in dsdt.c for ages that converted the _HID integer value >> to its PNP-string equivalent at create time. However with the >> dynamic _HID changing code in the AML, the store tried to convert an >> integer value to a string, eg. storing integer HID 0x12345 became >> "12345" instead of PNP0A03. >> >> I took out the default _HID conversion code in dsdt.c and reverted >> back to the original code, this does work on the R210 but would like >> to test on other systems as well. >> >> The old acpiprt code worked because it searched for ANY _HID value.. the >> new code explicitly looks for PNP0A03 or PNP0A08. >> >> @tech, please test this diff and report any issues with panic > > What code is this diff meant to apply to? There are many conflicts when > attempting to apply it to -current (acpi.c 1.168, acpiprt.c 1.38, etc).
Re: better cpu throttling
On Wed, Jun 30, 2010 at 07:59:00PM -0600, Tobias Weingartner wrote: > On Wednesday, June 30, Darrin Chandler wrote: > > > > What you're saying is true, but that's not the only use case. Streaming > > media may not benefit from 100% cpu but may not be able to work properly > > at 0%. The same goes for other common tasks as well. Running at 30% or > > 50% will indeed save power for those cases where running at 100% won't > > make what you're doing finish faster and running at 0% won't work. > > You're assuming that the switch is so slow that running at a constant > average factor (of whatever) is better than simply switching to "high" > mode when there are things to do (not in idle loop), and going back to > "low" mode when there is nothing left to do (in idle loop/etc). The > system could litteraly be switching high/low several thousand times a > second... > > Try the diff, see if it works for you. It's been pointed out to me off list. Of course I should have tested first and then came with issues as I found them. -- Darrin Chandler| Phoenix BSD User Group | MetaBUG dwchand...@stilyagin.com | http://phxbug.org/ | http://metabug.org/ http://www.stilyagin.com/ | Daemons in the Desert | Global BUG Federation
Re: ACPI PCI mapping revert diff
On 2010/07/01 03:37, Jordan Hargrave wrote: > So found the problem; on the R210 the AML code CHANGES the _HID for > the PCI Root Bus depending on the _OSI OS running.. UGH > > I'd had code in dsdt.c for ages that converted the _HID integer value > to its PNP-string equivalent at create time. However with the > dynamic _HID changing code in the AML, the store tried to convert an > integer value to a string, eg. storing integer HID 0x12345 became > "12345" instead of PNP0A03. > > I took out the default _HID conversion code in dsdt.c and reverted > back to the original code, this does work on the R210 but would like > to test on other systems as well. > > The old acpiprt code worked because it searched for ANY _HID value.. the > new code explicitly looks for PNP0A03 or PNP0A08. > > @tech, please test this diff and report any issues with panic What code is this diff meant to apply to? There are many conflicts when attempting to apply it to -current (acpi.c 1.168, acpiprt.c 1.38, etc).
Re: better cpu throttling
On Wed, Jun 30, 2010 at 02:32:26PM -0400, Ted Unangst wrote: > I like this one better. Slow down the poll interval just a little so > it's not so hysterical, but also go straight to 100. If you need CPU, > you need CPU. It still backs down slowly, but that's just to prevent > getting caught in slow mode again. Me too - my laptop is (as expected) more responsive than with the other diff. Playing a video, however, results in going up 100 going down 90 going down 80 going up 100 going down 90 going down 80 going down 70 going up 100 going down 90 going down 80 going up 100 going down 90 going up 100 going down 90 going down 80 going down 70 going down 60 ... which is not exactly bad (the video is played just fine), but I wonder whether it is as efficient battery-wise as converging to e.g. 60-70 over time. It is a hard one to wrap one's head around, and I tend to believe that the automatic throttling is better than fixing/converging the performance. When there is work to be done, it needs to be done. Doing it fast with higher power usage should be roughly the same as doing it slow with less power usage, however, the former case seems more responsive to the user (not relevant for the video example). My two cents. Thanks again. Martin
ACPI PCI mapping revert diff
So found the problem; on the R210 the AML code CHANGES the _HID for the PCI Root Bus depending on the _OSI OS running.. UGH I'd had code in dsdt.c for ages that converted the _HID integer value to its PNP-string equivalent at create time. However with the dynamic _HID changing code in the AML, the store tried to convert an integer value to a string, eg. storing integer HID 0x12345 became "12345" instead of PNP0A03. I took out the default _HID conversion code in dsdt.c and reverted back to the original code, this does work on the R210 but would like to test on other systems as well. The old acpiprt code worked because it searched for ANY _HID value.. the new code explicitly looks for PNP0A03 or PNP0A08. @tech, please test this diff and report any issues with panic Index: acpi.c === RCS file: /cvs/src/sys/dev/acpi/acpi.c,v retrieving revision 1.168 diff -u -p -u -p -r1.168 acpi.c --- acpi.c 1 Jul 2010 06:29:32 - 1.168 +++ acpi.c 1 Jul 2010 09:02:54 - @@ -1,4 +1,4 @@ -/* $OpenBSD: acpi.c,v 1.168 2010/07/01 06:29:32 jordan Exp $ */ +/* $OpenBSD: acpi.c,v 1.167 2010/07/01 01:39:39 jordan Exp $ */ /* * Copyright (c) 2005 Thorsten Lockert * Copyright (c) 2005 Jordan Hargrave @@ -18,6 +18,7 @@ #include #include +#include #include #include #include @@ -41,6 +42,10 @@ #include #include +#include +#include +#include + #include #include @@ -66,6 +71,8 @@ int acpi_saved_spl; void acpi_isr_thread(void *); void acpi_create_thread(void *); +void acpi_pci_match(struct device *, struct pci_attach_args *); + intacpi_match(struct device *, void *, void *); void acpi_attach(struct device *, struct device *, void *); intacpi_submatch(struct device *, void *, void *); @@ -94,12 +101,15 @@ int acpi_foundide(struct aml_node *node, int acpiide_notify(struct aml_node *, int, void *); int_acpi_matchhids(const char *, const char *[]); +intacpi_matchhids(struct acpi_attach_args *aa, const char *hids[], + const char *driver); + +struct acpi_q *acpi_maptable(struct acpi_softc *, paddr_t, const char *, + const char *, const char *, int); void wdcattach(struct channel_softc *); int wdcdetach(struct channel_softc *, int); -struct acpi_q *acpi_maptable(struct acpi_softc *, paddr_t, const char *, const char *, const char *, int); - struct idechnl { struct acpi_softc *sc; @@ -492,6 +502,150 @@ acpi_match(struct device *parent, void * return (1); } +TAILQ_HEAD(, acpi_pci) acpi_pcidevs = +TAILQ_HEAD_INITIALIZER(acpi_pcidevs); + +int acpi_getpci(struct aml_node *node, void *arg); +int acpi_getminbus(union acpi_resource *crs, void *arg); + +int +acpi_getminbus(union acpi_resource *crs, void *arg) +{ + int *bbn = arg; + int typ = AML_CRSTYPE(crs); + + /* Check for embedded bus number */ + if (typ == LR_WORD && crs->lr_word.type == 2) + *bbn = crs->lr_word._min; + return 0; +} + +int +_acpi_matchhids(const char *hid, const char *hids[]) +{ + int i; + + for (i = 0; hids[i]; i++) + if (!strcmp(hid, hids[i])) + return (1); + return (0); +} + +int +acpi_matchhids(struct acpi_attach_args *aa, const char *hids[], +const char *driver) +{ + + if (aa->aaa_dev == NULL || aa->aaa_node == NULL) + return (0); + if (_acpi_matchhids(aa->aaa_dev, hids)) { + dnprintf(5, "driver %s matches %s\n", driver, hids[i]); + return (1); + } + return (0); +} + +/* Map ACPI device node to PCI */ +int +acpi_getpci(struct aml_node *node, void *arg) +{ + const char *pcihid[] = { ACPI_DEV_PCIB, ACPI_DEV_PCIEB, "HWP0002", 0 }; + struct acpi_pci *pci, *ppci; + struct aml_value res; + struct acpi_softc *sc = arg; + pci_chipset_tag_t pc = NULL; + pcitag_t tag; + uint64_t val; + uint32_t reg; + + if (!node->value || node->value->type != AML_OBJTYPE_DEVICE) + return 0; + if (!aml_evalhid(node, &res)) { + /* Check if this is a PCI Root node */ + if (_acpi_matchhids(res.v_string, pcihid)) { + aml_freevalue(&res); + + pci = malloc(sizeof(*pci), M_DEVBUF, M_WAITOK|M_ZERO); + + if (!aml_evalinteger(sc, node, "_SEG", 0, NULL, &val)) + pci->seg = val; + if (!aml_evalinteger(sc, node, "_BBN", 0, NULL, &val)) + pci->bus = val; + else if (!aml_evalname(sc, node, "_CRS", 0, NULL, &res)) { +aml_parse_resource(&res, acpi_getminbus, +&pci->bus); + } + pci->sub = pci->bus; + node->pci = pci; + dnprintf(10, "found PCI root: %s %d\n", + aml_nodename(node), pci->bus); +
ΚΑΛΟΚΑΙΡΙΝΗ ΠΡΟΣΦΟΡΑ - ΣΥΝΕΧΙΖΕΤΑΙ!
Acapgto_ v_koi jai v_ker, Lar to fgt^sate! Sar to pqosv]qoule! Let\ ap| pokkapk\ ait^lat\ sar, g pqosvoq\ Ioum_ou paqate_metai cia k_cer l]qer aj|lg!
ACPI PCI Mapping diff
This diff will attempt to match up ACPI PCI devices with their BDF. This will replace code currently used in acpiprt, but need to test this on many machines to make sure the bus numbers match. Code will panic if bus numbers do not match, please report dmesg if you see a panic, along with pcidump -vv output on booted kernel. Index: acpi.c === RCS file: /cvs/src/sys/dev/acpi/acpi.c,v retrieving revision 1.168 diff -u -p -u -p -b -r1.168 acpi.c --- acpi.c 1 Jul 2010 06:29:32 - 1.168 +++ acpi.c 1 Jul 2010 06:56:15 - @@ -1,4 +1,4 @@ -/* $OpenBSD: acpi.c,v 1.168 2010/07/01 06:29:32 jordan Exp $ */ +/* $OpenBSD: acpi.c,v 1.167 2010/07/01 01:39:39 jordan Exp $ */ /* * Copyright (c) 2005 Thorsten Lockert * Copyright (c) 2005 Jordan Hargrave @@ -18,6 +18,7 @@ #include #include +#include #include #include #include @@ -41,6 +42,10 @@ #include #include +#include +#include +#include + #include #include @@ -66,6 +71,8 @@ int acpi_saved_spl; void acpi_isr_thread(void *); void acpi_create_thread(void *); +void acpi_pci_match(struct device *, struct pci_attach_args *); + intacpi_match(struct device *, void *, void *); void acpi_attach(struct device *, struct device *, void *); intacpi_submatch(struct device *, void *, void *); @@ -94,12 +101,15 @@ int acpi_foundide(struct aml_node *node, int acpiide_notify(struct aml_node *, int, void *); int_acpi_matchhids(const char *, const char *[]); +intacpi_matchhids(struct acpi_attach_args *aa, const char *hids[], + const char *driver); + +struct acpi_q *acpi_maptable(struct acpi_softc *, paddr_t, const char *, + const char *, const char *, int); void wdcattach(struct channel_softc *); int wdcdetach(struct channel_softc *, int); -struct acpi_q *acpi_maptable(struct acpi_softc *, paddr_t, const char *, const char *, const char *, int); - struct idechnl { struct acpi_softc *sc; @@ -492,6 +502,150 @@ acpi_match(struct device *parent, void * return (1); } +TAILQ_HEAD(, acpi_pci) acpi_pcidevs = +TAILQ_HEAD_INITIALIZER(acpi_pcidevs); + +int acpi_getpci(struct aml_node *node, void *arg); +int acpi_getminbus(union acpi_resource *crs, void *arg); + +int +acpi_getminbus(union acpi_resource *crs, void *arg) +{ + int *bbn = arg; + int typ = AML_CRSTYPE(crs); + + /* Check for embedded bus number */ + if (typ == LR_WORD && crs->lr_word.type == 2) + *bbn = crs->lr_word._min; + return 0; +} + +int +_acpi_matchhids(const char *hid, const char *hids[]) +{ + int i; + + for (i = 0; hids[i]; i++) + if (!strcmp(hid, hids[i])) + return (1); + return (0); +} + +int +acpi_matchhids(struct acpi_attach_args *aa, const char *hids[], +const char *driver) +{ + + if (aa->aaa_dev == NULL || aa->aaa_node == NULL) + return (0); + if (_acpi_matchhids(aa->aaa_dev, hids)) { + dnprintf(5, "driver %s matches %s\n", driver, hids[i]); + return (1); + } + return (0); +} + +/* Map ACPI device node to PCI */ +int +acpi_getpci(struct aml_node *node, void *arg) +{ + const char *pcihid[] = { ACPI_DEV_PCIB, ACPI_DEV_PCIEB, "HWP0002", 0 }; + struct acpi_pci *pci, *ppci; + struct aml_value res; + struct acpi_softc *sc = arg; + pci_chipset_tag_t pc = NULL; + pcitag_t tag; + uint64_t val; + uint32_t reg; + + if (!node->value || node->value->type != AML_OBJTYPE_DEVICE) + return 0; + if (!aml_evalhid(node, &res)) { + /* Check if this is a PCI Root node */ + if (_acpi_matchhids(res.v_string, pcihid)) { + aml_freevalue(&res); + + pci = malloc(sizeof(*pci), M_DEVBUF, M_WAITOK|M_ZERO); + + if (!aml_evalinteger(sc, node, "_SEG", 0, NULL, &val)) + pci->seg = val; + if (!aml_evalinteger(sc, node, "_BBN", 0, NULL, &val)) + pci->bus = val; + else if (!aml_evalname(sc, node, "_CRS", 0, NULL, &res)) { + aml_parse_resource(res.length, res.v_buffer, + acpi_getminbus, &pci->bus); + } + pci->sub = pci->bus; + node->pci = pci; + printf("found PCI root: %s %d\n", + aml_nodename(node), pci->bus); + } + aml_freevalue(&res); + return 0; + } + + /* If parent is not PCI, or device does not have _ADR, return */ + if (!node->parent || (ppci = node->parent->pci) == NULL) + return 0; + if (aml_evalinteger(sc, node, "_ADR", 0, NULL, &val)) + return 0; + + pci = malloc(sizeof(*pci), M_DEVBUF, M_WAITOK|M_Z