···442442 (u32) data->acpi_data.states[i].transition_latency);443443444444 cpufreq_frequency_table_get_attr(data->freq_table, policy->cpu);445445+446446+ /*447447+ * the first call to ->target() should result in us actually448448+ * writing something to the appropriate registers.449449+ */450450+ data->resume = 1;451451+445452 return (result);446453447454 err_freqfree:
···5959#define ACPI_EC_DELAY 50 /* Wait 50ms max. during EC ops */6060#define ACPI_EC_UDELAY_GLK 1000 /* Wait 1ms max. to get global lock */61616262+#define ACPI_EC_UDELAY 100 /* Poll @ 100us increments */6363+#define ACPI_EC_UDELAY_COUNT 1000 /* Wait 10ms max. during EC ops */6464+6265#define ACPI_EC_COMMAND_READ 0x806366#define ACPI_EC_COMMAND_WRITE 0x816467#define ACPI_EC_BURST_ENABLE 0x826568#define ACPI_EC_BURST_DISABLE 0x836669#define ACPI_EC_COMMAND_QUERY 0x8467706868-static int acpi_ec_add (struct acpi_device *device);7171+#define EC_POLLING 0xFF7272+#define EC_BURST 0x007373+7474+6975static int acpi_ec_remove (struct acpi_device *device, int type);7076static int acpi_ec_start (struct acpi_device *device);7177static int acpi_ec_stop (struct acpi_device *device, int type);7878+static int acpi_ec_burst_add ( struct acpi_device *device);72797380static struct acpi_driver acpi_ec_driver = {7481 .name = ACPI_EC_DRIVER_NAME,7582 .class = ACPI_EC_CLASS,7683 .ids = ACPI_EC_HID,7784 .ops = {7878- .add = acpi_ec_add,8585+ .add = acpi_ec_burst_add,7986 .remove = acpi_ec_remove,8087 .start = acpi_ec_start,8188 .stop = acpi_ec_stop,8289 },8390};9191+union acpi_ec {9292+ struct {9393+ u32 mode;9494+ acpi_handle handle;9595+ unsigned long uid;9696+ unsigned long gpe_bit;9797+ struct acpi_generic_address status_addr;9898+ struct acpi_generic_address command_addr;9999+ struct acpi_generic_address data_addr;100100+ unsigned long global_lock;101101+ } common;841028585-struct acpi_ec {8686- acpi_handle handle;8787- unsigned long uid;8888- unsigned long gpe_bit;8989- struct acpi_generic_address status_addr;9090- struct acpi_generic_address command_addr;9191- struct acpi_generic_address data_addr;9292- unsigned long global_lock;9393- unsigned int expect_event;9494- atomic_t leaving_burst; /* 0 : No, 1 : Yes, 2: abort*/9595- atomic_t pending_gpe;9696- struct semaphore sem;9797- wait_queue_head_t wait;103103+ struct {104104+ u32 mode;105105+ acpi_handle handle;106106+ unsigned long uid;107107+ unsigned long gpe_bit;108108+ struct acpi_generic_address status_addr;109109+ struct acpi_generic_address command_addr;110110+ struct acpi_generic_address data_addr;111111+ unsigned long global_lock;112112+ unsigned int expect_event;113113+ atomic_t leaving_burst; /* 0 : No, 1 : Yes, 2: abort*/114114+ atomic_t pending_gpe;115115+ struct semaphore sem;116116+ wait_queue_head_t wait;117117+ }burst;118118+119119+ struct {120120+ u32 mode;121121+ acpi_handle handle;122122+ unsigned long uid;123123+ unsigned long gpe_bit;124124+ struct acpi_generic_address status_addr;125125+ struct acpi_generic_address command_addr;126126+ struct acpi_generic_address data_addr;127127+ unsigned long global_lock;128128+ spinlock_t lock;129129+ }polling;98130};99131132132+static int acpi_ec_polling_wait ( union acpi_ec *ec, u8 event); 133133+static int acpi_ec_burst_wait(union acpi_ec *ec, unsigned int event);134134+static int acpi_ec_polling_read ( union acpi_ec *ec, u8 address, u32 *data);135135+static int acpi_ec_burst_read( union acpi_ec *ec, u8 address, u32 *data);136136+static int acpi_ec_polling_write ( union acpi_ec *ec, u8 address, u8 data);137137+static int acpi_ec_burst_write ( union acpi_ec *ec, u8 address, u8 data);138138+static int acpi_ec_polling_query ( union acpi_ec *ec, u32 *data);139139+static int acpi_ec_burst_query ( union acpi_ec *ec, u32 *data);140140+static void acpi_ec_gpe_polling_query ( void *ec_cxt);141141+static void acpi_ec_gpe_burst_query ( void *ec_cxt);142142+static u32 acpi_ec_gpe_polling_handler ( void *data);143143+static u32 acpi_ec_gpe_burst_handler ( void *data);144144+static acpi_status __init145145+acpi_fake_ecdt_polling_callback (146146+ acpi_handle handle,147147+ u32 Level,148148+ void *context,149149+ void **retval);150150+151151+static acpi_status __init152152+acpi_fake_ecdt_burst_callback (153153+ acpi_handle handle,154154+ u32 Level,155155+ void *context,156156+ void **retval);157157+158158+static int __init159159+acpi_ec_polling_get_real_ecdt(void);160160+static int __init161161+acpi_ec_burst_get_real_ecdt(void);100162/* If we find an EC via the ECDT, we need to keep a ptr to its context */101101-static struct acpi_ec *ec_ecdt;163163+static union acpi_ec *ec_ecdt;102164103165/* External interfaces use first EC only, so remember */104166static struct acpi_device *first_ec;167167+static int acpi_ec_polling_mode;105168106169/* --------------------------------------------------------------------------107170 Transaction Management108171 -------------------------------------------------------------------------- */109172110110-static inline u32 acpi_ec_read_status(struct acpi_ec *ec)173173+static inline u32 acpi_ec_read_status(union acpi_ec *ec)111174{112175 u32 status = 0;113176114114- acpi_hw_low_level_read(8, &status, &ec->status_addr);177177+ acpi_hw_low_level_read(8, &status, &ec->common.status_addr);115178 return status;116179}117180118118-static int acpi_ec_wait(struct acpi_ec *ec, unsigned int event)181181+static int182182+acpi_ec_wait (183183+ union acpi_ec *ec,184184+ u8 event)185185+{186186+ if (acpi_ec_polling_mode) 187187+ return acpi_ec_polling_wait (ec, event);188188+ else189189+ return acpi_ec_burst_wait (ec, event);190190+}191191+192192+static int193193+acpi_ec_polling_wait (194194+ union acpi_ec *ec,195195+ u8 event)196196+{197197+ u32 acpi_ec_status = 0;198198+ u32 i = ACPI_EC_UDELAY_COUNT;199199+200200+ if (!ec)201201+ return -EINVAL;202202+203203+ /* Poll the EC status register waiting for the event to occur. */204204+ switch (event) {205205+ case ACPI_EC_EVENT_OBF:206206+ do {207207+ acpi_hw_low_level_read(8, &acpi_ec_status, &ec->common.status_addr);208208+ if (acpi_ec_status & ACPI_EC_FLAG_OBF)209209+ return 0;210210+ udelay(ACPI_EC_UDELAY);211211+ } while (--i>0);212212+ break;213213+ case ACPI_EC_EVENT_IBE:214214+ do {215215+ acpi_hw_low_level_read(8, &acpi_ec_status, &ec->common.status_addr);216216+ if (!(acpi_ec_status & ACPI_EC_FLAG_IBF))217217+ return 0;218218+ udelay(ACPI_EC_UDELAY);219219+ } while (--i>0);220220+ break;221221+ default:222222+ return -EINVAL;223223+ }224224+225225+ return -ETIME;226226+}227227+static int acpi_ec_burst_wait(union acpi_ec *ec, unsigned int event)119228{120229 int result = 0;121230122231 ACPI_FUNCTION_TRACE("acpi_ec_wait");123232124124- ec->expect_event = event;233233+ ec->burst.expect_event = event;125234 smp_mb();126235127127- result = wait_event_interruptible_timeout(ec->wait,128128- !ec->expect_event,236236+ result = wait_event_interruptible_timeout(ec->burst.wait,237237+ !ec->burst.expect_event,129238 msecs_to_jiffies(ACPI_EC_DELAY));130239131131- ec->expect_event = 0;240240+ ec->burst.expect_event = 0;132241 smp_mb();133242134243 if (result < 0){···269160270161static int271162acpi_ec_enter_burst_mode (272272- struct acpi_ec *ec)163163+ union acpi_ec *ec)273164{274165 u32 tmp = 0;275166 int status = 0;···279170 status = acpi_ec_read_status(ec);280171 if (status != -EINVAL &&281172 !(status & ACPI_EC_FLAG_BURST)){282282- acpi_hw_low_level_write(8, ACPI_EC_BURST_ENABLE, &ec->command_addr);173173+ acpi_hw_low_level_write(8, ACPI_EC_BURST_ENABLE, &ec->common.command_addr);283174 status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF);284175 if (status){285285- acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR);176176+ acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);286177 return_VALUE(-EINVAL);287178 }288288- acpi_hw_low_level_read(8, &tmp, &ec->data_addr);289289- acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR);179179+ acpi_hw_low_level_read(8, &tmp, &ec->common.data_addr);180180+ acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);290181 if(tmp != 0x90 ) {/* Burst ACK byte*/291182 return_VALUE(-EINVAL);292183 }293184 }294185295295- atomic_set(&ec->leaving_burst , 0);186186+ atomic_set(&ec->burst.leaving_burst , 0);296187 return_VALUE(0);297188}298189299190static int300191acpi_ec_leave_burst_mode (301301- struct acpi_ec *ec)192192+ union acpi_ec *ec)302193{303194 int status =0;304195305196 ACPI_FUNCTION_TRACE("acpi_ec_leave_burst_mode");306197307307- atomic_set(&ec->leaving_burst , 1);198198+ atomic_set(&ec->burst.leaving_burst , 1);308199 status = acpi_ec_read_status(ec);309200 if (status != -EINVAL &&310201 (status & ACPI_EC_FLAG_BURST)){311311- acpi_hw_low_level_write(8, ACPI_EC_BURST_DISABLE, &ec->command_addr);202202+ acpi_hw_low_level_write(8, ACPI_EC_BURST_DISABLE, &ec->common.command_addr);312203 status = acpi_ec_wait(ec, ACPI_EC_FLAG_IBF);313204 if (status){314314- acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR);205205+ acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);315206 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,"------->wait fail\n"));316207 return_VALUE(-EINVAL);317208 }318318- acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR);209209+ acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);319210 status = acpi_ec_read_status(ec);320211 }321212···324215325216static int326217acpi_ec_read (327327- struct acpi_ec *ec,218218+ union acpi_ec *ec,219219+ u8 address,220220+ u32 *data)221221+{222222+ if (acpi_ec_polling_mode) 223223+ return acpi_ec_polling_read(ec, address, data);224224+ else225225+ return acpi_ec_burst_read(ec, address, data);226226+}227227+static int228228+acpi_ec_write (229229+ union acpi_ec *ec,230230+ u8 address,231231+ u8 data)232232+{233233+ if (acpi_ec_polling_mode) 234234+ return acpi_ec_polling_write(ec, address, data);235235+ else236236+ return acpi_ec_burst_write(ec, address, data);237237+}238238+static int239239+acpi_ec_polling_read (240240+ union acpi_ec *ec,241241+ u8 address,242242+ u32 *data)243243+{244244+ acpi_status status = AE_OK;245245+ int result = 0;246246+ unsigned long flags = 0;247247+ u32 glk = 0;248248+249249+ ACPI_FUNCTION_TRACE("acpi_ec_read");250250+251251+ if (!ec || !data)252252+ return_VALUE(-EINVAL);253253+254254+ *data = 0;255255+256256+ if (ec->common.global_lock) {257257+ status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk);258258+ if (ACPI_FAILURE(status))259259+ return_VALUE(-ENODEV);260260+ }261261+262262+ spin_lock_irqsave(&ec->polling.lock, flags);263263+264264+ acpi_hw_low_level_write(8, ACPI_EC_COMMAND_READ, &ec->common.command_addr);265265+ result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE);266266+ if (result)267267+ goto end;268268+269269+ acpi_hw_low_level_write(8, address, &ec->common.data_addr);270270+ result = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF);271271+ if (result)272272+ goto end;273273+274274+ acpi_hw_low_level_read(8, data, &ec->common.data_addr);275275+276276+ ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Read [%02x] from address [%02x]\n",277277+ *data, address));278278+279279+end:280280+ spin_unlock_irqrestore(&ec->polling.lock, flags);281281+282282+ if (ec->common.global_lock)283283+ acpi_release_global_lock(glk);284284+285285+ return_VALUE(result);286286+}287287+288288+289289+static int290290+acpi_ec_polling_write (291291+ union acpi_ec *ec,292292+ u8 address,293293+ u8 data)294294+{295295+ int result = 0;296296+ acpi_status status = AE_OK;297297+ unsigned long flags = 0;298298+ u32 glk = 0;299299+300300+ ACPI_FUNCTION_TRACE("acpi_ec_write");301301+302302+ if (!ec)303303+ return_VALUE(-EINVAL);304304+305305+ if (ec->common.global_lock) {306306+ status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk);307307+ if (ACPI_FAILURE(status))308308+ return_VALUE(-ENODEV);309309+ }310310+311311+ spin_lock_irqsave(&ec->polling.lock, flags);312312+313313+ acpi_hw_low_level_write(8, ACPI_EC_COMMAND_WRITE, &ec->common.command_addr);314314+ result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE);315315+ if (result)316316+ goto end;317317+318318+ acpi_hw_low_level_write(8, address, &ec->common.data_addr);319319+ result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE);320320+ if (result)321321+ goto end;322322+323323+ acpi_hw_low_level_write(8, data, &ec->common.data_addr);324324+ result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE);325325+ if (result)326326+ goto end;327327+328328+ ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Wrote [%02x] to address [%02x]\n",329329+ data, address));330330+331331+end:332332+ spin_unlock_irqrestore(&ec->polling.lock, flags);333333+334334+ if (ec->common.global_lock)335335+ acpi_release_global_lock(glk);336336+337337+ return_VALUE(result);338338+}339339+340340+static int341341+acpi_ec_burst_read (342342+ union acpi_ec *ec,328343 u8 address,329344 u32 *data)330345{···463230retry:464231 *data = 0;465232466466- if (ec->global_lock) {233233+ if (ec->common.global_lock) {467234 status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk);468235 if (ACPI_FAILURE(status))469236 return_VALUE(-ENODEV);470237 }471238472239 WARN_ON(in_interrupt());473473- down(&ec->sem);240240+ down(&ec->burst.sem);474241475242 if(acpi_ec_enter_burst_mode(ec))476243 goto end;477244478478- acpi_hw_low_level_write(8, ACPI_EC_COMMAND_READ, &ec->command_addr);245245+ acpi_hw_low_level_write(8, ACPI_EC_COMMAND_READ, &ec->common.command_addr);479246 status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE);480480- acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR);247247+ acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);481248 if (status) {482249 goto end;483250 }484251485485- acpi_hw_low_level_write(8, address, &ec->data_addr);252252+ acpi_hw_low_level_write(8, address, &ec->common.data_addr);486253 status= acpi_ec_wait(ec, ACPI_EC_EVENT_OBF);487254 if (status){488488- acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR);255255+ acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);489256 goto end;490257 }491258492492- acpi_hw_low_level_read(8, data, &ec->data_addr);493493- acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR);259259+ acpi_hw_low_level_read(8, data, &ec->common.data_addr);260260+ acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);494261495262 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Read [%02x] from address [%02x]\n",496263 *data, address));497264498265end:499266 acpi_ec_leave_burst_mode(ec);500500- up(&ec->sem);267267+ up(&ec->burst.sem);501268502502- if (ec->global_lock)269269+ if (ec->common.global_lock)503270 acpi_release_global_lock(glk);504271505505- if(atomic_read(&ec->leaving_burst) == 2){272272+ if(atomic_read(&ec->burst.leaving_burst) == 2){506273 ACPI_DEBUG_PRINT((ACPI_DB_INFO,"aborted, retry ...\n"));507507- while(atomic_read(&ec->pending_gpe)){274274+ while(atomic_read(&ec->burst.pending_gpe)){508275 msleep(1); 509276 }510510- acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR);277277+ acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);511278 goto retry;512279 }513280···516283517284518285static int519519-acpi_ec_write (520520- struct acpi_ec *ec,286286+acpi_ec_burst_write (287287+ union acpi_ec *ec,521288 u8 address,522289 u8 data)523290{···530297 if (!ec)531298 return_VALUE(-EINVAL);532299retry:533533- if (ec->global_lock) {300300+ if (ec->common.global_lock) {534301 status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk);535302 if (ACPI_FAILURE(status))536303 return_VALUE(-ENODEV);537304 }538305539306 WARN_ON(in_interrupt());540540- down(&ec->sem);307307+ down(&ec->burst.sem);541308542309 if(acpi_ec_enter_burst_mode(ec))543310 goto end;···545312 status = acpi_ec_read_status(ec);546313 if (status != -EINVAL &&547314 !(status & ACPI_EC_FLAG_BURST)){548548- acpi_hw_low_level_write(8, ACPI_EC_BURST_ENABLE, &ec->command_addr);315315+ acpi_hw_low_level_write(8, ACPI_EC_BURST_ENABLE, &ec->common.command_addr);549316 status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF);550317 if (status)551318 goto end;552552- acpi_hw_low_level_read(8, &tmp, &ec->data_addr);319319+ acpi_hw_low_level_read(8, &tmp, &ec->common.data_addr);553320 if(tmp != 0x90 ) /* Burst ACK byte*/554321 goto end;555322 }556323 /*Now we are in burst mode*/557324558558- acpi_hw_low_level_write(8, ACPI_EC_COMMAND_WRITE, &ec->command_addr);325325+ acpi_hw_low_level_write(8, ACPI_EC_COMMAND_WRITE, &ec->common.command_addr);559326 status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE);560560- acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR);327327+ acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);561328 if (status){562329 goto end;563330 }564331565565- acpi_hw_low_level_write(8, address, &ec->data_addr);332332+ acpi_hw_low_level_write(8, address, &ec->common.data_addr);566333 status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE);567334 if (status){568568- acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR);335335+ acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);569336 goto end;570337 }571338572572- acpi_hw_low_level_write(8, data, &ec->data_addr);339339+ acpi_hw_low_level_write(8, data, &ec->common.data_addr);573340 status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE);574574- acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR);341341+ acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);575342 if (status)576343 goto end;577344···580347581348end:582349 acpi_ec_leave_burst_mode(ec);583583- up(&ec->sem);350350+ up(&ec->burst.sem);584351585585- if (ec->global_lock)352352+ if (ec->common.global_lock)586353 acpi_release_global_lock(glk);587354588588- if(atomic_read(&ec->leaving_burst) == 2){355355+ if(atomic_read(&ec->burst.leaving_burst) == 2){589356 ACPI_DEBUG_PRINT((ACPI_DB_INFO,"aborted, retry ...\n"));590590- while(atomic_read(&ec->pending_gpe)){357357+ while(atomic_read(&ec->burst.pending_gpe)){591358 msleep(1); 592359 }593593- acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR);360360+ acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);594361 goto retry;595362 }596363···603370int604371ec_read(u8 addr, u8 *val)605372{606606- struct acpi_ec *ec;373373+ union acpi_ec *ec;607374 int err;608375 u32 temp_data;609376···626393int627394ec_write(u8 addr, u8 val)628395{629629- struct acpi_ec *ec;396396+ union acpi_ec *ec;630397 int err;631398632399 if (!first_ec)···640407}641408EXPORT_SYMBOL(ec_write);642409643643-644410static int645411acpi_ec_query (646646- struct acpi_ec *ec,412412+ union acpi_ec *ec,413413+ u32 *data)414414+{415415+ if (acpi_ec_polling_mode) 416416+ return acpi_ec_polling_query(ec, data);417417+ else418418+ return acpi_ec_burst_query(ec, data);419419+}420420+static int421421+acpi_ec_polling_query (422422+ union acpi_ec *ec,423423+ u32 *data)424424+{425425+ int result = 0;426426+ acpi_status status = AE_OK;427427+ unsigned long flags = 0;428428+ u32 glk = 0;429429+430430+ ACPI_FUNCTION_TRACE("acpi_ec_query");431431+432432+ if (!ec || !data)433433+ return_VALUE(-EINVAL);434434+435435+ *data = 0;436436+437437+ if (ec->common.global_lock) {438438+ status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk);439439+ if (ACPI_FAILURE(status))440440+ return_VALUE(-ENODEV);441441+ }442442+443443+ /*444444+ * Query the EC to find out which _Qxx method we need to evaluate.445445+ * Note that successful completion of the query causes the ACPI_EC_SCI446446+ * bit to be cleared (and thus clearing the interrupt source).447447+ */448448+ spin_lock_irqsave(&ec->polling.lock, flags);449449+450450+ acpi_hw_low_level_write(8, ACPI_EC_COMMAND_QUERY, &ec->common.command_addr);451451+ result = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF);452452+ if (result)453453+ goto end;454454+455455+ acpi_hw_low_level_read(8, data, &ec->common.data_addr);456456+ if (!*data)457457+ result = -ENODATA;458458+459459+end:460460+ spin_unlock_irqrestore(&ec->polling.lock, flags);461461+462462+ if (ec->common.global_lock)463463+ acpi_release_global_lock(glk);464464+465465+ return_VALUE(result);466466+}467467+static int468468+acpi_ec_burst_query (469469+ union acpi_ec *ec,647470 u32 *data)648471{649472 int status = 0;···711422 return_VALUE(-EINVAL);712423 *data = 0;713424714714- if (ec->global_lock) {425425+ if (ec->common.global_lock) {715426 status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk);716427 if (ACPI_FAILURE(status))717428 return_VALUE(-ENODEV);718429 }719430720720- down(&ec->sem);431431+ down(&ec->burst.sem);721432 if(acpi_ec_enter_burst_mode(ec))722433 goto end;723434 /*···725436 * Note that successful completion of the query causes the ACPI_EC_SCI726437 * bit to be cleared (and thus clearing the interrupt source).727438 */728728- acpi_hw_low_level_write(8, ACPI_EC_COMMAND_QUERY, &ec->command_addr);439439+ acpi_hw_low_level_write(8, ACPI_EC_COMMAND_QUERY, &ec->common.command_addr);729440 status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF);730441 if (status){731731- acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR);442442+ acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);732443 goto end;733444 }734445735735- acpi_hw_low_level_read(8, data, &ec->data_addr);736736- acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR);446446+ acpi_hw_low_level_read(8, data, &ec->common.data_addr);447447+ acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);737448 if (!*data)738449 status = -ENODATA;739450740451end:741452 acpi_ec_leave_burst_mode(ec);742742- up(&ec->sem);453453+ up(&ec->burst.sem);743454744744- if (ec->global_lock)455455+ if (ec->common.global_lock)745456 acpi_release_global_lock(glk);746457747747- if(atomic_read(&ec->leaving_burst) == 2){458458+ if(atomic_read(&ec->burst.leaving_burst) == 2){748459 ACPI_DEBUG_PRINT((ACPI_DB_INFO,"aborted, retry ...\n"));749749- acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR);460460+ acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);750461 status = -ENODATA;751462 }752463 return_VALUE(status);···757468 Event Management758469 -------------------------------------------------------------------------- */759470760760-struct acpi_ec_query_data {471471+union acpi_ec_query_data {761472 acpi_handle handle;762473 u8 data;763474};···766477acpi_ec_gpe_query (767478 void *ec_cxt)768479{769769- struct acpi_ec *ec = (struct acpi_ec *) ec_cxt;480480+ if (acpi_ec_polling_mode) 481481+ acpi_ec_gpe_polling_query(ec_cxt);482482+ else483483+ acpi_ec_gpe_burst_query(ec_cxt);484484+}485485+486486+static void487487+acpi_ec_gpe_polling_query (488488+ void *ec_cxt)489489+{490490+ union acpi_ec *ec = (union acpi_ec *) ec_cxt;491491+ u32 value = 0;492492+ unsigned long flags = 0;493493+ static char object_name[5] = {'_','Q','0','0','\0'};494494+ const char hex[] = {'0','1','2','3','4','5','6','7',495495+ '8','9','A','B','C','D','E','F'};496496+497497+ ACPI_FUNCTION_TRACE("acpi_ec_gpe_query");498498+499499+ if (!ec_cxt)500500+ goto end;501501+502502+ spin_lock_irqsave(&ec->polling.lock, flags);503503+ acpi_hw_low_level_read(8, &value, &ec->common.command_addr);504504+ spin_unlock_irqrestore(&ec->polling.lock, flags);505505+506506+ /* TBD: Implement asynch events!507507+ * NOTE: All we care about are EC-SCI's. Other EC events are508508+ * handled via polling (yuck!). This is because some systems509509+ * treat EC-SCIs as level (versus EDGE!) triggered, preventing510510+ * a purely interrupt-driven approach (grumble, grumble).511511+ */512512+ if (!(value & ACPI_EC_FLAG_SCI))513513+ goto end;514514+515515+ if (acpi_ec_query(ec, &value))516516+ goto end;517517+518518+ object_name[2] = hex[((value >> 4) & 0x0F)];519519+ object_name[3] = hex[(value & 0x0F)];520520+521521+ ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Evaluating %s\n", object_name));522522+523523+ acpi_evaluate_object(ec->common.handle, object_name, NULL, NULL);524524+525525+end: 526526+ acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);527527+}528528+static void529529+acpi_ec_gpe_burst_query (530530+ void *ec_cxt)531531+{532532+ union acpi_ec *ec = (union acpi_ec *) ec_cxt;770533 u32 value;771534 int result = -ENODATA;772535 static char object_name[5] = {'_','Q','0','0','\0'};···838497839498 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Evaluating %s\n", object_name));840499841841- acpi_evaluate_object(ec->handle, object_name, NULL, NULL);500500+ acpi_evaluate_object(ec->common.handle, object_name, NULL, NULL);842501end: 843843- atomic_dec(&ec->pending_gpe);502502+ atomic_dec(&ec->burst.pending_gpe);844503 return;845504}846505···848507acpi_ec_gpe_handler (849508 void *data)850509{510510+ if (acpi_ec_polling_mode) 511511+ return acpi_ec_gpe_polling_handler(data);512512+ else513513+ return acpi_ec_gpe_burst_handler(data); 514514+}515515+static u32516516+acpi_ec_gpe_polling_handler (517517+ void *data)518518+{851519 acpi_status status = AE_OK;852852- u32 value;853853- struct acpi_ec *ec = (struct acpi_ec *) data;520520+ union acpi_ec *ec = (union acpi_ec *) data;854521855522 if (!ec)856523 return ACPI_INTERRUPT_NOT_HANDLED;857524858858- acpi_disable_gpe(NULL, ec->gpe_bit, ACPI_ISR);525525+ acpi_disable_gpe(NULL, ec->common.gpe_bit, ACPI_ISR);526526+527527+ status = acpi_os_queue_for_execution(OSD_PRIORITY_GPE,528528+ acpi_ec_gpe_query, ec);529529+530530+ if (status == AE_OK)531531+ return ACPI_INTERRUPT_HANDLED;532532+ else533533+ return ACPI_INTERRUPT_NOT_HANDLED;534534+}535535+static u32536536+acpi_ec_gpe_burst_handler (537537+ void *data)538538+{539539+ acpi_status status = AE_OK;540540+ u32 value;541541+ union acpi_ec *ec = (union acpi_ec *) data;542542+543543+ if (!ec)544544+ return ACPI_INTERRUPT_NOT_HANDLED;545545+546546+ acpi_disable_gpe(NULL, ec->common.gpe_bit, ACPI_ISR);859547860548 value = acpi_ec_read_status(ec);861549862550 if((value & ACPI_EC_FLAG_IBF) &&863551 !(value & ACPI_EC_FLAG_BURST) &&864864- (atomic_read(&ec->leaving_burst) == 0)) { 552552+ (atomic_read(&ec->burst.leaving_burst) == 0)) { 865553 /*866554 * the embedded controller disables 867555 * burst mode for any reason other 868556 * than the burst disable command869557 * to process critical event.870558 */871871- atomic_set(&ec->leaving_burst , 2); /* block current pending transaction559559+ atomic_set(&ec->burst.leaving_burst , 2); /* block current pending transaction872560 and retry */873873- wake_up(&ec->wait);561561+ wake_up(&ec->burst.wait);874562 }else {875875- if ((ec->expect_event == ACPI_EC_EVENT_OBF &&563563+ if ((ec->burst.expect_event == ACPI_EC_EVENT_OBF &&876564 (value & ACPI_EC_FLAG_OBF)) ||877877- (ec->expect_event == ACPI_EC_EVENT_IBE &&565565+ (ec->burst.expect_event == ACPI_EC_EVENT_IBE &&878566 !(value & ACPI_EC_FLAG_IBF))) {879879- ec->expect_event = 0;880880- wake_up(&ec->wait);567567+ ec->burst.expect_event = 0;568568+ wake_up(&ec->burst.wait);881569 return ACPI_INTERRUPT_HANDLED;882570 }883571 }884572885573 if (value & ACPI_EC_FLAG_SCI){886886- atomic_add(1, &ec->pending_gpe) ;574574+ atomic_add(1, &ec->burst.pending_gpe) ;887575 status = acpi_os_queue_for_execution(OSD_PRIORITY_GPE,888576 acpi_ec_gpe_query, ec);889577 return status == AE_OK ?890578 ACPI_INTERRUPT_HANDLED : ACPI_INTERRUPT_NOT_HANDLED;891579 } 892892- acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_ISR);580580+ acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_ISR);893581 return status == AE_OK ?894582 ACPI_INTERRUPT_HANDLED : ACPI_INTERRUPT_NOT_HANDLED;895583}···955585 void *region_context)956586{957587 int result = 0;958958- struct acpi_ec *ec = NULL;588588+ union acpi_ec *ec = NULL;959589 u64 temp = *value;960590 acpi_integer f_v = 0;961591 int i = 0;···970600 return_VALUE(AE_BAD_PARAMETER);971601 }972602973973- ec = (struct acpi_ec *) handler_context;603603+ ec = (union acpi_ec *) handler_context;974604975605next_byte:976606 switch (function) {···1031661static int1032662acpi_ec_read_info (struct seq_file *seq, void *offset)1033663{10341034- struct acpi_ec *ec = (struct acpi_ec *) seq->private;664664+ union acpi_ec *ec = (union acpi_ec *) seq->private;10356651036666 ACPI_FUNCTION_TRACE("acpi_ec_read_info");1037667···1039669 goto end;10406701041671 seq_printf(seq, "gpe bit: 0x%02x\n",10421042- (u32) ec->gpe_bit);672672+ (u32) ec->common.gpe_bit);1043673 seq_printf(seq, "ports: 0x%02x, 0x%02x\n",10441044- (u32) ec->status_addr.address, (u32) ec->data_addr.address);674674+ (u32) ec->common.status_addr.address, (u32) ec->common.data_addr.address);1045675 seq_printf(seq, "use global lock: %s\n",10461046- ec->global_lock?"yes":"no");10471047- acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR);676676+ ec->common.global_lock?"yes":"no");677677+ acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);10486781049679end:1050680 return_VALUE(0);···1067697acpi_ec_add_fs (1068698 struct acpi_device *device)1069699{10701070- struct proc_dir_entry *entry;700700+ struct proc_dir_entry *entry = NULL;10717011072702 ACPI_FUNCTION_TRACE("acpi_ec_add_fs");1073703···1114744 Driver Interface1115745 -------------------------------------------------------------------------- */1116746747747+1117748static int11181118-acpi_ec_add (749749+acpi_ec_polling_add (1119750 struct acpi_device *device)1120751{11211121- int result;11221122- acpi_status status;11231123- struct acpi_ec *ec;752752+ int result = 0;753753+ acpi_status status = AE_OK;754754+ union acpi_ec *ec = NULL;1124755 unsigned long uid;11257561126757 ACPI_FUNCTION_TRACE("acpi_ec_add");···1129758 if (!device)1130759 return_VALUE(-EINVAL);113176011321132- ec = kmalloc(sizeof(struct acpi_ec), GFP_KERNEL);761761+ ec = kmalloc(sizeof(union acpi_ec), GFP_KERNEL);1133762 if (!ec)1134763 return_VALUE(-ENOMEM);11351135- memset(ec, 0, sizeof(struct acpi_ec));764764+ memset(ec, 0, sizeof(union acpi_ec));113676511371137- ec->handle = device->handle;11381138- ec->uid = -1;11391139- atomic_set(&ec->pending_gpe, 0);11401140- atomic_set(&ec->leaving_burst , 1);11411141- init_MUTEX(&ec->sem);11421142- init_waitqueue_head(&ec->wait);766766+ ec->common.handle = device->handle;767767+ ec->common.uid = -1;768768+ spin_lock_init(&ec->polling.lock);1143769 strcpy(acpi_device_name(device), ACPI_EC_DEVICE_NAME);1144770 strcpy(acpi_device_class(device), ACPI_EC_CLASS);1145771 acpi_driver_data(device) = ec;11467721147773 /* Use the global lock for all EC transactions? */11481148- acpi_evaluate_integer(ec->handle, "_GLK", NULL, &ec->global_lock);774774+ acpi_evaluate_integer(ec->common.handle, "_GLK", NULL, &ec->common.global_lock);11497751150776 /* If our UID matches the UID for the ECDT-enumerated EC,1151777 we now have the *real* EC info, so kill the makeshift one.*/11521152- acpi_evaluate_integer(ec->handle, "_UID", NULL, &uid);11531153- if (ec_ecdt && ec_ecdt->uid == uid) {778778+ acpi_evaluate_integer(ec->common.handle, "_UID", NULL, &uid);779779+ if (ec_ecdt && ec_ecdt->common.uid == uid) {1154780 acpi_remove_address_space_handler(ACPI_ROOT_OBJECT,1155781 ACPI_ADR_SPACE_EC, &acpi_ec_space_handler);11561156-11571157- acpi_remove_gpe_handler(NULL, ec_ecdt->gpe_bit, &acpi_ec_gpe_handler);782782+783783+ acpi_remove_gpe_handler(NULL, ec_ecdt->common.gpe_bit, &acpi_ec_gpe_handler);11587841159785 kfree(ec_ecdt);1160786 }11617871162788 /* Get GPE bit assignment (EC events). */1163789 /* TODO: Add support for _GPE returning a package */11641164- status = acpi_evaluate_integer(ec->handle, "_GPE", NULL, &ec->gpe_bit);790790+ status = acpi_evaluate_integer(ec->common.handle, "_GPE", NULL, &ec->common.gpe_bit);1165791 if (ACPI_FAILURE(status)) {1166792 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,1167793 "Error obtaining GPE bit assignment\n"));···11728041173805 printk(KERN_INFO PREFIX "%s [%s] (gpe %d)\n",1174806 acpi_device_name(device), acpi_device_bid(device),11751175- (u32) ec->gpe_bit);807807+ (u32) ec->common.gpe_bit);808808+809809+ if (!first_ec)810810+ first_ec = device;811811+812812+end:813813+ if (result)814814+ kfree(ec);815815+816816+ return_VALUE(result);817817+}818818+static int819819+acpi_ec_burst_add (820820+ struct acpi_device *device)821821+{822822+ int result = 0;823823+ acpi_status status = AE_OK;824824+ union acpi_ec *ec = NULL;825825+ unsigned long uid;826826+827827+ ACPI_FUNCTION_TRACE("acpi_ec_add");828828+829829+ if (!device)830830+ return_VALUE(-EINVAL);831831+832832+ ec = kmalloc(sizeof(union acpi_ec), GFP_KERNEL);833833+ if (!ec)834834+ return_VALUE(-ENOMEM);835835+ memset(ec, 0, sizeof(union acpi_ec));836836+837837+ ec->common.handle = device->handle;838838+ ec->common.uid = -1;839839+ atomic_set(&ec->burst.pending_gpe, 0);840840+ atomic_set(&ec->burst.leaving_burst , 1);841841+ init_MUTEX(&ec->burst.sem);842842+ init_waitqueue_head(&ec->burst.wait);843843+ strcpy(acpi_device_name(device), ACPI_EC_DEVICE_NAME);844844+ strcpy(acpi_device_class(device), ACPI_EC_CLASS);845845+ acpi_driver_data(device) = ec;846846+847847+ /* Use the global lock for all EC transactions? */848848+ acpi_evaluate_integer(ec->common.handle, "_GLK", NULL, &ec->common.global_lock);849849+850850+ /* If our UID matches the UID for the ECDT-enumerated EC,851851+ we now have the *real* EC info, so kill the makeshift one.*/852852+ acpi_evaluate_integer(ec->common.handle, "_UID", NULL, &uid);853853+ if (ec_ecdt && ec_ecdt->common.uid == uid) {854854+ acpi_remove_address_space_handler(ACPI_ROOT_OBJECT,855855+ ACPI_ADR_SPACE_EC, &acpi_ec_space_handler);856856+857857+ acpi_remove_gpe_handler(NULL, ec_ecdt->common.gpe_bit, &acpi_ec_gpe_handler);858858+859859+ kfree(ec_ecdt);860860+ }861861+862862+ /* Get GPE bit assignment (EC events). */863863+ /* TODO: Add support for _GPE returning a package */864864+ status = acpi_evaluate_integer(ec->common.handle, "_GPE", NULL, &ec->common.gpe_bit);865865+ if (ACPI_FAILURE(status)) {866866+ ACPI_DEBUG_PRINT((ACPI_DB_ERROR,867867+ "Error obtaining GPE bit assignment\n"));868868+ result = -ENODEV;869869+ goto end;870870+ }871871+872872+ result = acpi_ec_add_fs(device);873873+ if (result)874874+ goto end;875875+876876+ printk(KERN_INFO PREFIX "%s [%s] (gpe %d)\n",877877+ acpi_device_name(device), acpi_device_bid(device),878878+ (u32) ec->common.gpe_bit);11768791177880 if (!first_ec)1178881 first_ec = device;···1261822 struct acpi_device *device,1262823 int type)1263824{12641264- struct acpi_ec *ec;825825+ union acpi_ec *ec = NULL;12658261266827 ACPI_FUNCTION_TRACE("acpi_ec_remove");1267828···1283844 struct acpi_resource *resource,1284845 void *context)1285846{12861286- struct acpi_ec *ec = (struct acpi_ec *) context;847847+ union acpi_ec *ec = (union acpi_ec *) context;1287848 struct acpi_generic_address *addr;12888491289850 if (resource->id != ACPI_RSTYPE_IO) {···1295856 * the second address region returned is the status/command1296857 * port.1297858 */12981298- if (ec->data_addr.register_bit_width == 0) {12991299- addr = &ec->data_addr;13001300- } else if (ec->command_addr.register_bit_width == 0) {13011301- addr = &ec->command_addr;859859+ if (ec->common.data_addr.register_bit_width == 0) {860860+ addr = &ec->common.data_addr;861861+ } else if (ec->common.command_addr.register_bit_width == 0) {862862+ addr = &ec->common.command_addr;1302863 } else {1303864 return AE_CTRL_TERMINATE;1304865 }···1316877acpi_ec_start (1317878 struct acpi_device *device)1318879{13191319- acpi_status status;13201320- struct acpi_ec *ec;880880+ acpi_status status = AE_OK;881881+ union acpi_ec *ec = NULL;13218821322883 ACPI_FUNCTION_TRACE("acpi_ec_start");1323884···1332893 /*1333894 * Get I/O port addresses. Convert to GAS format.1334895 */13351335- status = acpi_walk_resources(ec->handle, METHOD_NAME__CRS,896896+ status = acpi_walk_resources(ec->common.handle, METHOD_NAME__CRS,1336897 acpi_ec_io_ports, ec);13371337- if (ACPI_FAILURE(status) || ec->command_addr.register_bit_width == 0) {898898+ if (ACPI_FAILURE(status) || ec->common.command_addr.register_bit_width == 0) {1338899 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error getting I/O port addresses"));1339900 return_VALUE(-ENODEV);1340901 }134190213421342- ec->status_addr = ec->command_addr;903903+ ec->common.status_addr = ec->common.command_addr;13439041344905 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "gpe=0x%02x, ports=0x%2x,0x%2x\n",13451345- (u32) ec->gpe_bit, (u32) ec->command_addr.address,13461346- (u32) ec->data_addr.address));906906+ (u32) ec->common.gpe_bit, (u32) ec->common.command_addr.address,907907+ (u32) ec->common.data_addr.address));908908+13479091348910 /*1349911 * Install GPE handler1350912 */13511351- status = acpi_install_gpe_handler(NULL, ec->gpe_bit,913913+ status = acpi_install_gpe_handler(NULL, ec->common.gpe_bit,1352914 ACPI_GPE_EDGE_TRIGGERED, &acpi_ec_gpe_handler, ec);1353915 if (ACPI_FAILURE(status)) {1354916 return_VALUE(-ENODEV);1355917 }13561356- acpi_set_gpe_type (NULL, ec->gpe_bit, ACPI_GPE_TYPE_RUNTIME);13571357- acpi_enable_gpe (NULL, ec->gpe_bit, ACPI_NOT_ISR);918918+ acpi_set_gpe_type (NULL, ec->common.gpe_bit, ACPI_GPE_TYPE_RUNTIME);919919+ acpi_enable_gpe (NULL, ec->common.gpe_bit, ACPI_NOT_ISR);135892013591359- status = acpi_install_address_space_handler (ec->handle,921921+ status = acpi_install_address_space_handler (ec->common.handle,1360922 ACPI_ADR_SPACE_EC, &acpi_ec_space_handler,1361923 &acpi_ec_space_setup, ec);1362924 if (ACPI_FAILURE(status)) {13631363- acpi_remove_gpe_handler(NULL, ec->gpe_bit, &acpi_ec_gpe_handler);925925+ acpi_remove_gpe_handler(NULL, ec->common.gpe_bit, &acpi_ec_gpe_handler);1364926 return_VALUE(-ENODEV);1365927 }1366928···1374934 struct acpi_device *device,1375935 int type)1376936{13771377- acpi_status status;13781378- struct acpi_ec *ec;937937+ acpi_status status = AE_OK;938938+ union acpi_ec *ec = NULL;13799391380940 ACPI_FUNCTION_TRACE("acpi_ec_stop");1381941···13849441385945 ec = acpi_driver_data(device);138694613871387- status = acpi_remove_address_space_handler(ec->handle,947947+ status = acpi_remove_address_space_handler(ec->common.handle,1388948 ACPI_ADR_SPACE_EC, &acpi_ec_space_handler);1389949 if (ACPI_FAILURE(status))1390950 return_VALUE(-ENODEV);139195113921392- status = acpi_remove_gpe_handler(NULL, ec->gpe_bit, &acpi_ec_gpe_handler);952952+ status = acpi_remove_gpe_handler(NULL, ec->common.gpe_bit, &acpi_ec_gpe_handler);1393953 if (ACPI_FAILURE(status))1394954 return_VALUE(-ENODEV);1395955···1403963 void *context,1404964 void **retval)1405965{966966+967967+ if (acpi_ec_polling_mode)968968+ return acpi_fake_ecdt_polling_callback(handle,969969+ Level, context, retval);970970+ else971971+ return acpi_fake_ecdt_burst_callback(handle,972972+ Level, context, retval);973973+}974974+975975+static acpi_status __init976976+acpi_fake_ecdt_polling_callback (977977+ acpi_handle handle,978978+ u32 Level,979979+ void *context,980980+ void **retval)981981+{1406982 acpi_status status;14079831408984 status = acpi_walk_resources(handle, METHOD_NAME__CRS,1409985 acpi_ec_io_ports, ec_ecdt);1410986 if (ACPI_FAILURE(status))1411987 return status;14121412- ec_ecdt->status_addr = ec_ecdt->command_addr;988988+ ec_ecdt->common.status_addr = ec_ecdt->common.command_addr;141398914141414- ec_ecdt->uid = -1;14151415- acpi_evaluate_integer(handle, "_UID", NULL, &ec_ecdt->uid);990990+ ec_ecdt->common.uid = -1;991991+ acpi_evaluate_integer(handle, "_UID", NULL, &ec_ecdt->common.uid);141699214171417- status = acpi_evaluate_integer(handle, "_GPE", NULL, &ec_ecdt->gpe_bit);993993+ status = acpi_evaluate_integer(handle, "_GPE", NULL, &ec_ecdt->common.gpe_bit);1418994 if (ACPI_FAILURE(status))1419995 return status;14201420- ec_ecdt->global_lock = TRUE;14211421- ec_ecdt->handle = handle;996996+ spin_lock_init(&ec_ecdt->polling.lock);997997+ ec_ecdt->common.global_lock = TRUE;998998+ ec_ecdt->common.handle = handle;142299914231000 printk(KERN_INFO PREFIX "GPE=0x%02x, ports=0x%2x, 0x%2x\n",14241424- (u32) ec_ecdt->gpe_bit, (u32) ec_ecdt->command_addr.address,14251425- (u32) ec_ecdt->data_addr.address);10011001+ (u32) ec_ecdt->common.gpe_bit, (u32) ec_ecdt->common.command_addr.address,10021002+ (u32) ec_ecdt->common.data_addr.address);10031003+10041004+ return AE_CTRL_TERMINATE;10051005+}10061006+10071007+static acpi_status __init10081008+acpi_fake_ecdt_burst_callback (10091009+ acpi_handle handle,10101010+ u32 Level,10111011+ void *context,10121012+ void **retval)10131013+{10141014+ acpi_status status;10151015+10161016+ init_MUTEX(&ec_ecdt->burst.sem);10171017+ init_waitqueue_head(&ec_ecdt->burst.wait);10181018+ status = acpi_walk_resources(handle, METHOD_NAME__CRS,10191019+ acpi_ec_io_ports, ec_ecdt);10201020+ if (ACPI_FAILURE(status))10211021+ return status;10221022+ ec_ecdt->common.status_addr = ec_ecdt->common.command_addr;10231023+10241024+ ec_ecdt->common.uid = -1;10251025+ acpi_evaluate_integer(handle, "_UID", NULL, &ec_ecdt->common.uid);10261026+10271027+ status = acpi_evaluate_integer(handle, "_GPE", NULL, &ec_ecdt->common.gpe_bit);10281028+ if (ACPI_FAILURE(status))10291029+ return status;10301030+ ec_ecdt->common.global_lock = TRUE;10311031+ ec_ecdt->common.handle = handle;10321032+10331033+ printk(KERN_INFO PREFIX "GPE=0x%02x, ports=0x%2x, 0x%2x\n",10341034+ (u32) ec_ecdt->common.gpe_bit, (u32) ec_ecdt->common.command_addr.address,10351035+ (u32) ec_ecdt->common.data_addr.address);1426103614271037 return AE_CTRL_TERMINATE;14281038}···1495100514961006 printk(KERN_INFO PREFIX "Try to make an fake ECDT\n");1497100714981498- ec_ecdt = kmalloc(sizeof(struct acpi_ec), GFP_KERNEL);10081008+ ec_ecdt = kmalloc(sizeof(union acpi_ec), GFP_KERNEL);14991009 if (!ec_ecdt) {15001010 ret = -ENOMEM;15011011 goto error;15021012 }15031503- memset(ec_ecdt, 0, sizeof(struct acpi_ec));10131013+ memset(ec_ecdt, 0, sizeof(union acpi_ec));1504101415051015 status = acpi_get_devices (ACPI_EC_HID,15061016 acpi_fake_ecdt_callback,···15211031static int __init15221032acpi_ec_get_real_ecdt(void)15231033{10341034+ if (acpi_ec_polling_mode)10351035+ return acpi_ec_polling_get_real_ecdt();10361036+ else10371037+ return acpi_ec_burst_get_real_ecdt();10381038+}10391039+10401040+static int __init10411041+acpi_ec_polling_get_real_ecdt(void)10421042+{10431043+ acpi_status status;10441044+ struct acpi_table_ecdt *ecdt_ptr;10451045+10461046+ status = acpi_get_firmware_table("ECDT", 1, ACPI_LOGICAL_ADDRESSING, 10471047+ (struct acpi_table_header **) &ecdt_ptr);10481048+ if (ACPI_FAILURE(status))10491049+ return -ENODEV;10501050+10511051+ printk(KERN_INFO PREFIX "Found ECDT\n");10521052+10531053+ /*10541054+ * Generate a temporary ec context to use until the namespace is scanned10551055+ */10561056+ ec_ecdt = kmalloc(sizeof(union acpi_ec), GFP_KERNEL);10571057+ if (!ec_ecdt)10581058+ return -ENOMEM;10591059+ memset(ec_ecdt, 0, sizeof(union acpi_ec));10601060+10611061+ ec_ecdt->common.command_addr = ecdt_ptr->ec_control;10621062+ ec_ecdt->common.status_addr = ecdt_ptr->ec_control;10631063+ ec_ecdt->common.data_addr = ecdt_ptr->ec_data;10641064+ ec_ecdt->common.gpe_bit = ecdt_ptr->gpe_bit;10651065+ spin_lock_init(&ec_ecdt->polling.lock);10661066+ /* use the GL just to be safe */10671067+ ec_ecdt->common.global_lock = TRUE;10681068+ ec_ecdt->common.uid = ecdt_ptr->uid;10691069+10701070+ status = acpi_get_handle(NULL, ecdt_ptr->ec_id, &ec_ecdt->common.handle);10711071+ if (ACPI_FAILURE(status)) {10721072+ goto error;10731073+ }10741074+10751075+ return 0;10761076+error:10771077+ printk(KERN_ERR PREFIX "Could not use ECDT\n");10781078+ kfree(ec_ecdt);10791079+ ec_ecdt = NULL;10801080+10811081+ return -ENODEV;10821082+}10831083+10841084+10851085+static int __init10861086+acpi_ec_burst_get_real_ecdt(void)10871087+{15241088 acpi_status status;15251089 struct acpi_table_ecdt *ecdt_ptr;15261090···15881044 /*15891045 * Generate a temporary ec context to use until the namespace is scanned15901046 */15911591- ec_ecdt = kmalloc(sizeof(struct acpi_ec), GFP_KERNEL);10471047+ ec_ecdt = kmalloc(sizeof(union acpi_ec), GFP_KERNEL);15921048 if (!ec_ecdt)15931049 return -ENOMEM;15941594- memset(ec_ecdt, 0, sizeof(struct acpi_ec));10501050+ memset(ec_ecdt, 0, sizeof(union acpi_ec));1595105115961596- init_MUTEX(&ec_ecdt->sem);15971597- init_waitqueue_head(&ec_ecdt->wait);15981598- ec_ecdt->command_addr = ecdt_ptr->ec_control;15991599- ec_ecdt->status_addr = ecdt_ptr->ec_control;16001600- ec_ecdt->data_addr = ecdt_ptr->ec_data;16011601- ec_ecdt->gpe_bit = ecdt_ptr->gpe_bit;10521052+ init_MUTEX(&ec_ecdt->burst.sem);10531053+ init_waitqueue_head(&ec_ecdt->burst.wait);10541054+ ec_ecdt->common.command_addr = ecdt_ptr->ec_control;10551055+ ec_ecdt->common.status_addr = ecdt_ptr->ec_control;10561056+ ec_ecdt->common.data_addr = ecdt_ptr->ec_data;10571057+ ec_ecdt->common.gpe_bit = ecdt_ptr->gpe_bit;16021058 /* use the GL just to be safe */16031603- ec_ecdt->global_lock = TRUE;16041604- ec_ecdt->uid = ecdt_ptr->uid;10591059+ ec_ecdt->common.global_lock = TRUE;10601060+ ec_ecdt->common.uid = ecdt_ptr->uid;1605106116061606- status = acpi_get_handle(NULL, ecdt_ptr->ec_id, &ec_ecdt->handle);10621062+ status = acpi_get_handle(NULL, ecdt_ptr->ec_id, &ec_ecdt->common.handle);16071063 if (ACPI_FAILURE(status)) {16081064 goto error;16091065 }···16361092 /*16371093 * Install GPE handler16381094 */16391639- status = acpi_install_gpe_handler(NULL, ec_ecdt->gpe_bit,10951095+ status = acpi_install_gpe_handler(NULL, ec_ecdt->common.gpe_bit,16401096 ACPI_GPE_EDGE_TRIGGERED, &acpi_ec_gpe_handler,16411097 ec_ecdt);16421098 if (ACPI_FAILURE(status)) {16431099 goto error;16441100 }16451645- acpi_set_gpe_type (NULL, ec_ecdt->gpe_bit, ACPI_GPE_TYPE_RUNTIME);16461646- acpi_enable_gpe (NULL, ec_ecdt->gpe_bit, ACPI_NOT_ISR);11011101+ acpi_set_gpe_type (NULL, ec_ecdt->common.gpe_bit, ACPI_GPE_TYPE_RUNTIME);11021102+ acpi_enable_gpe (NULL, ec_ecdt->common.gpe_bit, ACPI_NOT_ISR);1647110316481104 status = acpi_install_address_space_handler (ACPI_ROOT_OBJECT,16491105 ACPI_ADR_SPACE_EC, &acpi_ec_space_handler,16501106 &acpi_ec_space_setup, ec_ecdt);16511107 if (ACPI_FAILURE(status)) {16521652- acpi_remove_gpe_handler(NULL, ec_ecdt->gpe_bit,11081108+ acpi_remove_gpe_handler(NULL, ec_ecdt->common.gpe_bit,16531109 &acpi_ec_gpe_handler);16541110 goto error;16551111 }···1667112316681124static int __init acpi_ec_init (void)16691125{16701670- int result;11261126+ int result = 0;1671112716721128 ACPI_FUNCTION_TRACE("acpi_ec_init");16731129···17111167 return 0;17121168}17131169__setup("acpi_fake_ecdt", acpi_fake_ecdt_setup);11701170+static int __init acpi_ec_set_polling_mode(char *str)11711171+{11721172+ acpi_ec_polling_mode = EC_POLLING;11731173+ acpi_ec_driver.ops.add = acpi_ec_polling_add;11741174+ return 0;11751175+}11761176+__setup("ec_polling", acpi_ec_set_polling_mode);
+59-26
drivers/acpi/pci_irq.c
···269269/* --------------------------------------------------------------------------270270 PCI Interrupt Routing Support271271 -------------------------------------------------------------------------- */272272+typedef int (*irq_lookup_func)(struct acpi_prt_entry *, int *, int *, char **);272273274274+static int275275+acpi_pci_allocate_irq(struct acpi_prt_entry *entry,276276+ int *edge_level,277277+ int *active_high_low,278278+ char **link)279279+{280280+ int irq;281281+282282+ ACPI_FUNCTION_TRACE("acpi_pci_allocate_irq");283283+284284+ if (entry->link.handle) {285285+ irq = acpi_pci_link_allocate_irq(entry->link.handle,286286+ entry->link.index, edge_level, active_high_low, link);287287+ if (irq < 0) {288288+ ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Invalid IRQ link routing entry\n"));289289+ return_VALUE(-1);290290+ }291291+ } else {292292+ irq = entry->link.index;293293+ *edge_level = ACPI_LEVEL_SENSITIVE;294294+ *active_high_low = ACPI_ACTIVE_LOW;295295+ }296296+297297+ ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found IRQ %d\n", irq));298298+ return_VALUE(irq);299299+}300300+301301+static int302302+acpi_pci_free_irq(struct acpi_prt_entry *entry,303303+ int *edge_level,304304+ int *active_high_low,305305+ char **link)306306+{307307+ int irq;308308+309309+ ACPI_FUNCTION_TRACE("acpi_pci_free_irq");310310+ if (entry->link.handle) {311311+ irq = acpi_pci_link_free_irq(entry->link.handle);312312+ } else {313313+ irq = entry->link.index;314314+ }315315+ return_VALUE(irq);316316+}273317/*274318 * acpi_pci_irq_lookup275319 * success: return IRQ >= 0···326282 int pin,327283 int *edge_level,328284 int *active_high_low,329329- char **link)285285+ char **link,286286+ irq_lookup_func func)330287{331288 struct acpi_prt_entry *entry = NULL;332289 int segment = pci_domain_nr(bus);333290 int bus_nr = bus->number;334334- int irq;291291+ int ret;335292336293 ACPI_FUNCTION_TRACE("acpi_pci_irq_lookup");337294···346301 return_VALUE(-1);347302 }348303349349- if (entry->link.handle) {350350- irq = acpi_pci_link_get_irq(entry->link.handle,351351- entry->link.index, edge_level, active_high_low, link);352352- if (irq < 0) {353353- ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Invalid IRQ link routing entry\n"));354354- return_VALUE(-1);355355- }356356- } else {357357- irq = entry->link.index;358358- *edge_level = ACPI_LEVEL_SENSITIVE;359359- *active_high_low = ACPI_ACTIVE_LOW;360360- }361361-362362- ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found IRQ %d\n", irq));363363-364364- return_VALUE(irq);304304+ ret = func(entry, edge_level, active_high_low, link);305305+ return_VALUE(ret);365306}366307367308/*···361330 int pin,362331 int *edge_level,363332 int *active_high_low,364364- char **link)333333+ char **link,334334+ irq_lookup_func func)365335{366336 struct pci_dev *bridge = dev;367337 int irq = -1;···395363 }396364397365 irq = acpi_pci_irq_lookup(bridge->bus, PCI_SLOT(bridge->devfn),398398- pin, edge_level, active_high_low, link);366366+ pin, edge_level, active_high_low, link, func);399367 }400368401369 if (irq < 0) {···447415 * values override any BIOS-assigned IRQs set during boot.448416 */449417 irq = acpi_pci_irq_lookup(dev->bus, PCI_SLOT(dev->devfn), pin,450450- &edge_level, &active_high_low, &link);418418+ &edge_level, &active_high_low, &link, acpi_pci_allocate_irq);451419452420 /*453421 * If no PRT entry was found, we'll try to derive an IRQ from the···455423 */456424 if (irq < 0)457425 irq = acpi_pci_irq_derive(dev, pin, &edge_level,458458- &active_high_low, &link);426426+ &active_high_low, &link, acpi_pci_allocate_irq);459427460428 /*461429 * No IRQ known to the ACPI subsystem - maybe the BIOS / ···494462EXPORT_SYMBOL(acpi_pci_irq_enable);495463496464497497-#ifdef CONFIG_ACPI_DEALLOCATE_IRQ465465+/* FIXME: implement x86/x86_64 version */466466+void __attribute__((weak)) acpi_unregister_gsi(u32 i) {}467467+498468void499469acpi_pci_irq_disable (500470 struct pci_dev *dev)···523489 * First we check the PCI IRQ routing table (PRT) for an IRQ.524490 */525491 gsi = acpi_pci_irq_lookup(dev->bus, PCI_SLOT(dev->devfn), pin,526526- &edge_level, &active_high_low, NULL);492492+ &edge_level, &active_high_low, NULL, acpi_pci_free_irq);527493 /*528494 * If no PRT entry was found, we'll try to derive an IRQ from the529495 * device's parent bridge.530496 */531497 if (gsi < 0)532498 gsi = acpi_pci_irq_derive(dev, pin,533533- &edge_level, &active_high_low, NULL);499499+ &edge_level, &active_high_low, NULL, acpi_pci_free_irq);534500 if (gsi < 0)535501 return_VOID;536502···546512547513 return_VOID;548514}549549-#endif /* CONFIG_ACPI_DEALLOCATE_IRQ */
+87-16
drivers/acpi/pci_link.c
···6868 },6969};70707171+/*7272+ * If a link is initialized, we never change its active and initialized7373+ * later even the link is disable. Instead, we just repick the active irq7474+ */7175struct acpi_pci_link_irq {7276 u8 active; /* Current IRQ */7377 u8 edge_level; /* All IRQs */···8076 u8 possible_count;8177 u8 possible[ACPI_PCI_LINK_MAX_POSSIBLE];8278 u8 initialized:1;8383- u8 suspend_resume:1;8484- u8 reserved:6;7979+ u8 reserved:7;8580};86818782struct acpi_pci_link {···8885 struct acpi_device *device;8986 acpi_handle handle;9087 struct acpi_pci_link_irq irq;8888+ int refcnt;9189};92909391static struct {9492 int count;9593 struct list_head entries;9694} acpi_link;9595+DECLARE_MUTEX(acpi_link_lock);979698979998/* --------------------------------------------------------------------------···537532538533 ACPI_FUNCTION_TRACE("acpi_pci_link_allocate");539534540540- if (link->irq.suspend_resume) {541541- acpi_pci_link_set(link, link->irq.active);542542- link->irq.suspend_resume = 0;543543- }544544- if (link->irq.initialized)535535+ if (link->irq.initialized) {536536+ if (link->refcnt == 0)537537+ /* This means the link is disabled but initialized */538538+ acpi_pci_link_set(link, link->irq.active);545539 return_VALUE(0);540540+ }546541547542 /*548543 * search for active IRQ in list of possible IRQs.···601596}602597603598/*604604- * acpi_pci_link_get_irq599599+ * acpi_pci_link_allocate_irq605600 * success: return IRQ >= 0606601 * failure: return -1607602 */608603609604int610610-acpi_pci_link_get_irq (605605+acpi_pci_link_allocate_irq (611606 acpi_handle handle,612607 int index,613608 int *edge_level,···618613 struct acpi_device *device = NULL;619614 struct acpi_pci_link *link = NULL;620615621621- ACPI_FUNCTION_TRACE("acpi_pci_link_get_irq");616616+ ACPI_FUNCTION_TRACE("acpi_pci_link_allocate_irq");622617623618 result = acpi_bus_get_device(handle, &device);624619 if (result) {···638633 return_VALUE(-1);639634 }640635641641- if (acpi_pci_link_allocate(link))636636+ down(&acpi_link_lock);637637+ if (acpi_pci_link_allocate(link)) {638638+ up(&acpi_link_lock);642639 return_VALUE(-1);640640+ }643641644642 if (!link->irq.active) {643643+ up(&acpi_link_lock);645644 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Link active IRQ is 0!\n"));646645 return_VALUE(-1);647646 }647647+ link->refcnt ++;648648+ up(&acpi_link_lock);648649649650 if (edge_level) *edge_level = link->irq.edge_level;650651 if (active_high_low) *active_high_low = link->irq.active_high_low;651652 if (name) *name = acpi_device_bid(link->device);653653+ ACPI_DEBUG_PRINT((ACPI_DB_INFO,654654+ "Link %s is referenced\n", acpi_device_bid(link->device)));652655 return_VALUE(link->irq.active);653656}654657658658+/*659659+ * We don't change link's irq information here. After it is reenabled, we660660+ * continue use the info661661+ */662662+int663663+acpi_pci_link_free_irq(acpi_handle handle)664664+{665665+ struct acpi_device *device = NULL;666666+ struct acpi_pci_link *link = NULL;667667+ acpi_status result;655668669669+ ACPI_FUNCTION_TRACE("acpi_pci_link_free_irq");670670+671671+ result = acpi_bus_get_device(handle, &device);672672+ if (result) {673673+ ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid link device\n"));674674+ return_VALUE(-1);675675+ }676676+677677+ link = (struct acpi_pci_link *) acpi_driver_data(device);678678+ if (!link) {679679+ ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid link context\n"));680680+ return_VALUE(-1);681681+ }682682+683683+ down(&acpi_link_lock);684684+ if (!link->irq.initialized) {685685+ up(&acpi_link_lock);686686+ ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Link isn't initialized\n"));687687+ return_VALUE(-1);688688+ }689689+690690+ link->refcnt --;691691+ ACPI_DEBUG_PRINT((ACPI_DB_INFO,692692+ "Link %s is dereferenced\n", acpi_device_bid(link->device)));693693+694694+ if (link->refcnt == 0) {695695+ acpi_ut_evaluate_object(link->handle, "_DIS", 0, NULL);696696+ }697697+ up(&acpi_link_lock);698698+ return_VALUE(link->irq.active);699699+}656700/* --------------------------------------------------------------------------657701 Driver Interface658702 -------------------------------------------------------------------------- */···731677 strcpy(acpi_device_class(device), ACPI_PCI_LINK_CLASS);732678 acpi_driver_data(device) = link;733679680680+ down(&acpi_link_lock);734681 result = acpi_pci_link_get_possible(link);735682 if (result)736683 goto end;···767712end:768713 /* disable all links -- to be activated on use */769714 acpi_ut_evaluate_object(link->handle, "_DIS", 0, NULL);715715+ up(&acpi_link_lock);770716771717 if (result)772718 kfree(link);···782726{783727 struct list_head *node = NULL;784728 struct acpi_pci_link *link = NULL;729729+ int ret = 0;785730786731 ACPI_FUNCTION_TRACE("irqrouter_suspend");787732788733 list_for_each(node, &acpi_link.entries) {789734 link = list_entry(node, struct acpi_pci_link, node);790735 if (!link) {791791- ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid link context\n"));736736+ ACPI_DEBUG_PRINT((ACPI_DB_ERROR,737737+ "Invalid link context\n"));792738 continue;793739 }794794- if (link->irq.active && link->irq.initialized)795795- link->irq.suspend_resume = 1;740740+ if (link->irq.initialized && link->refcnt != 0741741+ /* We ignore legacy IDE device irq */742742+ && link->irq.active != 14 && link->irq.active !=15) {743743+ printk(KERN_WARNING PREFIX744744+ "%d drivers with interrupt %d neglected to call"745745+ " pci_disable_device at .suspend\n",746746+ link->refcnt,747747+ link->irq.active);748748+ printk(KERN_WARNING PREFIX749749+ "Fix the driver, or rmmod before suspend\n");750750+ link->refcnt = 0;751751+ ret = -EINVAL;752752+ }796753 }797797- return_VALUE(0);754754+ return_VALUE(ret);798755}799756800757···825756826757 link = (struct acpi_pci_link *) acpi_driver_data(device);827758828828- /* TBD: Acquire/release lock */759759+ down(&acpi_link_lock);829760 list_del(&link->node);761761+ up(&acpi_link_lock);830762831763 kfree(link);832764···919849__setup("acpi_irq_balance", acpi_irq_balance_set);920850921851852852+/* FIXME: we will remove this interface after all drivers call pci_disable_device */922853static struct sysdev_class irqrouter_sysdev_class = {923854 set_kset_name("irqrouter"),924855 .suspend = irqrouter_suspend,
+17-14
drivers/acpi/processor_idle.c
···8181 *8282 * To skip this limit, boot/load with a large max_cstate limit.8383 */8484-static int no_c2c3(struct dmi_system_id *id)8484+static int set_max_cstate(struct dmi_system_id *id)8585{8686 if (max_cstate > ACPI_PROCESSOR_MAX_POWER)8787 return 0;88888989- printk(KERN_NOTICE PREFIX "%s detected - C2,C3 disabled."8989+ printk(KERN_NOTICE PREFIX "%s detected - %s disabled."9090 " Override with \"processor.max_cstate=%d\"\n", id->ident,9191+ ((int)id->driver_data == 1)? "C2,C3":"C3",9192 ACPI_PROCESSOR_MAX_POWER + 1);92939393- max_cstate = 1;9494+ max_cstate = (int)id->driver_data;94959596 return 0;9697}979898999999-100100-101100static struct dmi_system_id __initdata processor_power_dmi_table[] = {102102- { no_c2c3, "IBM ThinkPad R40e", {101101+ { set_max_cstate, "IBM ThinkPad R40e", {103102 DMI_MATCH(DMI_BIOS_VENDOR,"IBM"),104104- DMI_MATCH(DMI_BIOS_VERSION,"1SET60WW") }},105105- { no_c2c3, "Medion 41700", {103103+ DMI_MATCH(DMI_BIOS_VERSION,"1SET60WW") }, (void*)1},104104+ { set_max_cstate, "Medion 41700", {106105 DMI_MATCH(DMI_BIOS_VENDOR,"Phoenix Technologies LTD"),107107- DMI_MATCH(DMI_BIOS_VERSION,"R01-A1J") }},106106+ DMI_MATCH(DMI_BIOS_VERSION,"R01-A1J") }, (void*)1},107107+ { set_max_cstate, "Clevo 5600D", {108108+ DMI_MATCH(DMI_BIOS_VENDOR,"Phoenix Technologies LTD"),109109+ DMI_MATCH(DMI_BIOS_VERSION,"SHE845M0.86C.0013.D.0302131307") },110110+ (void*)2},108111 {},109112};110113···552549 ACPI_FUNCTION_TRACE("acpi_processor_get_power_info_default_c1");553550554551 for (i = 0; i < ACPI_PROCESSOR_MAX_POWER; i++)555555- memset(pr->power.states, 0, sizeof(struct acpi_processor_cx));552552+ memset(&(pr->power.states[i]), 0, 553553+ sizeof(struct acpi_processor_cx));556554557555 /* if info is obtained from pblk/fadt, type equals state */558556 pr->power.states[ACPI_STATE_C1].type = ACPI_STATE_C1;···584580585581 pr->power.count = 0;586582 for (i = 0; i < ACPI_PROCESSOR_MAX_POWER; i++)587587- memset(pr->power.states, 0, sizeof(struct acpi_processor_cx));583583+ memset(&(pr->power.states[i]), 0, 584584+ sizeof(struct acpi_processor_cx));588585589586 status = acpi_evaluate_object(pr->handle, "_CST", NULL, &buffer);590587 if (ACPI_FAILURE(status)) {···768763 }769764770765 if (pr->flags.bm_check) {771771- printk("Disabling BM access before entering C3\n");772766 /* bus mastering control is necessary */773767 if (!pr->flags.bm_control) {774768 ACPI_DEBUG_PRINT((ACPI_DB_INFO,···775771 return_VOID;776772 }777773 } else {778778- printk("Invalidating cache before entering C3\n");779774 /*780775 * WBINVD should be set in fadt, for C3 state to be781776 * supported on when bm_check is not required.···845842 result = acpi_processor_get_power_info_cst(pr);846843 if ((result) || (acpi_processor_power_verify(pr) < 2)) {847844 result = acpi_processor_get_power_info_fadt(pr);848848- if (result)845845+ if ((result) || (acpi_processor_power_verify(pr) < 2))849846 result = acpi_processor_get_power_info_default_c1(pr);850847 }851848
···5656/* ACPI PCI Interrupt Link (pci_link.c) */57575858int acpi_irq_penalty_init (void);5959-int acpi_pci_link_get_irq (acpi_handle handle, int index, int *edge_level,5959+int acpi_pci_link_allocate_irq (acpi_handle handle, int index, int *edge_level,6060 int *active_high_low, char **name);6161+int acpi_pci_link_free_irq(acpi_handle handle);61626263/* ACPI PCI Interrupt Routing (pci_irq.c) */6364
-4
include/linux/acpi.h
···453453 * If this matches the last registration, any IRQ resources for gsi454454 * are freed.455455 */456456-#ifdef CONFIG_ACPI_DEALLOCATE_IRQ457456void acpi_unregister_gsi (u32 gsi);458458-#endif459457460458#ifdef CONFIG_ACPI_PCI461459···478480int acpi_pci_irq_enable (struct pci_dev *dev);479481void acpi_penalize_isa_irq(int irq, int active);480482481481-#ifdef CONFIG_ACPI_DEALLOCATE_IRQ482483void acpi_pci_irq_disable (struct pci_dev *dev);483483-#endif484484485485struct acpi_pci_driver {486486 struct acpi_pci_driver *next;